CoatedSurfaceFile#

class ansys.speos.core.input_files.coated_surface.CoatedSurfaceFile(wavelengths=_DEFAULT_WAVELENGTHS, incident_angles=_DEFAULT_INCIDENT_ANGLES, samples=None, description=_DEFAULT_DESCRIPTION)#

Bases: ansys.speos.core.input_files._base.SpeosTextFileFormat

Speos *.coated file, a non-scattering coating varying with angle and wavelength.

The file holds one ansys.speos.core.input_files.coated_surface.CoatedSurfaceSample per angle of incidence and per wavelength, stored in samples[incidence_index][wavelength_index].

Parameters:
wavelengthsSequence[float], optional

Wavelengths of the samples, in nm, sorted in increasing order. By default, [400.0, 550.0, 700.0].

incident_anglesSequence[float], optional

Angles of incidence of the samples, in degrees, sorted in increasing order. By default, [0.0, 60.0, 90.0].

samplesList[List[CoatedSurfaceSample]], optional

Coating responses, one row per angle of incidence and one column per wavelength. By default, a 3 x 3 grid of independent default ansys.speos.core.input_files.coated_surface.CoatedSurfaceSample objects, which reflect all the light.

descriptionstr, optional

Free text written on the second line of the file. By default, "Coating surface".

Parameters:

Notes

Called without arguments, the constructor creates a 3 x 3 grid of perfect reflectors. Pass wavelengths, incident_angles and samples together to describe another grid, since each default only matches the other ones.

A Speos coating is only valid for the rays crossing the interface in one direction. List getters copy the containers, while sample objects remain shared and editable through validated properties. To resize a populated grid, clear CoatedSurfaceFile.samples, set the axes, then assign the new grid. Empty lists allow drafts; save() requires complete axes and samples.

Examples

>>> from ansys.speos.core.input_files.coated_surface import (
...     CoatedSurfaceFile,
...     CoatedSurfaceSample,
... )
>>> sample = CoatedSurfaceSample(31.9, 68.1, 31.9, 68.1)
>>> CoatedSurfaceFile(
...     wavelengths=[480.0, 780.0],
...     incident_angles=[0.0, 90.0],
...     samples=[[sample, sample], [sample, sample]],
... ).save("mirror.coated")

Overview#

validate

Check the coating against the constraints of the *.coated format.

wavelengths

Sorted wavelengths in nm, returned as a copy.

incident_angles

Sorted incidence angles in degrees, returned as a copy.

samples

Sample grid with copied containers and shared samples.

description

Single-line description.

EXTENSION

Usual file extension of the format.

HEADER

First line of the file. Empty when the format has no header line.

HEADER_PREFIX

Version-agnostic start of HEADER, used to validate a file being read.

Import detail#

from ansys.speos.core.input_files.coated_surface import CoatedSurfaceFile

Property detail#

property CoatedSurfaceFile.wavelengths: List[float]#

Sorted wavelengths in nm, returned as a copy.

Parameters:
valuesSequence[float]

New wavelengths of the samples, in nm, sorted in increasing order.

Returns:
List[float]

Finite wavelengths, or an empty draft column.

property CoatedSurfaceFile.incident_angles: List[float]#

Sorted incidence angles in degrees, returned as a copy.

Parameters:
valuesSequence[float]

New angles of incidence of the samples, in degrees, sorted in increasing order.

Returns:
List[float]

Angles between 0 and 90, or an empty draft column.

property CoatedSurfaceFile.samples: List[List[CoatedSurfaceSample]]#

Sample grid with copied containers and shared samples.

Parameters:
valuesList[List[CoatedSurfaceSample]]

New coating responses, one row per angle of incidence and one column per wavelength.

Returns:
List[List[CoatedSurfaceSample]]

Rows per incidence and columns per wavelength.

property CoatedSurfaceFile.description: str#

Single-line description.

Parameters:
valuestr

New free text written on the second line of the file.

Returns:
str

Free text written after the header.

Attribute detail#

CoatedSurfaceFile.EXTENSION = '.coated'#

Usual file extension of the format.

CoatedSurfaceFile.HEADER = 'OPTIS - Coated surface file v1.0'#

First line of the file. Empty when the format has no header line.

CoatedSurfaceFile.HEADER_PREFIX = 'OPTIS - Coated surface file'#

Version-agnostic start of HEADER, used to validate a file being read.

Method detail#

CoatedSurfaceFile.validate()#

Check the coating against the constraints of the *.coated format.

Raises:
ValueError

If no wavelength or angle of incidence is given, they are not sorted, the sample grid does not match them, or a sample holds invalid values.