ScatteringSurfaceFile#
- class ansys.speos.core.input_files.scattering_surface.ScatteringSurfaceFile(wavelengths=_DEFAULT_WAVELENGTHS, incident_angles=_DEFAULT_INCIDENT_ANGLES, samples=None, description=_DEFAULT_DESCRIPTION)#
Bases:
ansys.speos.core.input_files._base.SpeosTextFileFormatSpeos
*.scatteringfile, a scattering surface varying with angle and wavelength.The file holds one
ansys.speos.core.input_files.scattering_surface.ScatteringSurfaceSampleper angle of incidence and per wavelength, stored insamples[incidence_index][wavelength_index].- Parameters:
- wavelengths
Sequence[float],optional Wavelengths of the samples, in nm, sorted in increasing order. At least two wavelengths are required. By default,
[400.0, 550.0, 700.0].- incident_angles
Sequence[float],optional Angles of incidence of the samples, in degrees, sorted in increasing order.
0and90are required. By default,[0.0, 60.0, 90.0].- samples
List[List[ScatteringSurfaceSample]],optional Contributions, 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.scattering_surface.ScatteringSurfaceSampleobjects, which specularly reflect all the light.- description
str,optional Free text written on the second line of the file. By default,
"Scattering surface".
- wavelengths
- Parameters:
wavelengths (Sequence[float])
incident_angles (Sequence[float])
samples (List[List[ScatteringSurfaceSample]] | None)
description (str)
Notes
Called without arguments, the constructor creates a 3 x 3 grid of perfect specular reflectors. Pass
wavelengths,incident_anglesandsamplestogether to describe another grid, since each default only matches the other ones.Empty lists allow staged construction, but
ScatteringSurfaceFile.validate()andsave()require a complete surface. Nonempty assignments are checked against the configured axes and grid. To resize a populated grid, clearScatteringSurfaceFile.samples, assign the new axes, then assign the new grid. List getters return copies of the containers, while sample objects remain shared so their validated properties can be edited directly.Examples
>>> from ansys.speos.core.input_files.scattering_surface import ( ... ScatteringSurfaceFile, ... ScatteringSurfaceSample, ... ) >>> grey = ScatteringSurfaceSample(specular_reflection=0.0, lambertian_reflection=50.0) >>> surface = ScatteringSurfaceFile( ... wavelengths=[400.0, 700.0], ... incident_angles=[0.0, 90.0], ... samples=[[grey, grey], [grey, grey]], ... ) >>> surface.save("grey.scattering")
Overview#
Check the surface against the constraints of the |
Wavelengths in nm, returned as a copy. |
|
Angles of incidence in degrees, returned as a copy. |
|
Sample grid, returned with copied row containers. |
|
Free text written on the second line of the file. |
Usual file extension of the format. |
|
First line of the file. Empty when the format has no header line. |
|
Version-agnostic start of |
Import detail#
from ansys.speos.core.input_files.scattering_surface import ScatteringSurfaceFile
Property detail#
- property ScatteringSurfaceFile.incident_angles: List[float]#
Angles of incidence in degrees, returned as a copy.
- property ScatteringSurfaceFile.samples: List[List[ScatteringSurfaceSample]]#
Sample grid, returned with copied row containers.
- Parameters:
- values
List[List[ScatteringSurfaceSample]] New contributions, one row per angle of incidence and one column per wavelength.
- values
- Returns:
List[List[ScatteringSurfaceSample]]One row per incidence and one column per wavelength. Sample objects remain shared and their properties can be updated through their validated setters.
Notes
Assign the grid back to this property to replace, add, or remove entries.
Attribute detail#
- ScatteringSurfaceFile.EXTENSION = '.scattering'#
Usual file extension of the format.
- ScatteringSurfaceFile.HEADER = 'OPTIS - Scattering surface file v1.0'#
First line of the file. Empty when the format has no header line.
- ScatteringSurfaceFile.HEADER_PREFIX = 'OPTIS - Scattering surface file'#
Version-agnostic start of
HEADER, used to validate a file being read.
Method detail#
- ScatteringSurfaceFile.validate()#
Check the surface against the constraints of the
*.scatteringformat.- Raises:
ValueErrorIf fewer than two wavelengths are given, the angles of incidence do not span 0 to 90 degrees, the sample grid does not match the wavelengths and angles, or a sample holds invalid contributions.