MaterialFile#
- class ansys.speos.core.input_files.material.MaterialFile(description='Optical Glass', material_type=MaterialType.isotropic, dispersion=None, absorption_wavelengths=None, absorption_values=None, measured_concentration=1.0, user_concentration=1.0, scattering_wavelengths=None, scattering_values=None, scattering=None, axis_j=_DEFAULT_AXIS_J, axis_k=_DEFAULT_AXIS_K, absorption_values_b=None, absorption_values_c=None, fluorescent_pigments=None)#
Bases:
ansys.speos.core.input_files._base.SpeosTextFileFormatSpeos
*.materialfile, holding the volume optical properties of a body.The file always describes how the refractive index and the absorption vary with the wavelength. Setting
MaterialFile.scatteringadds a volume scattering block, which turns the file into the scattering flavor of the format.MaterialFile.material_typeselects the flavor of the format, and with it the modelsMaterialFile.dispersionaccepts. A metallic material holds nothing but the complex refractive index of the metal, while a birefringent one holds an index per axis, the orientation of these axes and an absorption curve per axis.- Parameters:
- description
str,optional Free text written on the second line of the file. By default,
"Optical Glass"- material_type
MaterialType,optional Type of material. By default,
MaterialType.isotropic.- dispersion
Union[MaterialDispersion,MaterialBirefringence,MaterialMetallicCurve],optional How the refractive index varies with the wavelength. A metallic material needs a
ansys.speos.core.input_files.material.MaterialMetallicCurveand a birefringent one needs one of theansys.speos.core.input_files.material.MaterialBirefringencemodels. By default, aansys.speos.core.input_files.material.MaterialDispersionCurvemodel with its default index curve.- absorption_wavelengths
List[float],optional Wavelengths of the absorption curve, in nm. Left empty by a metallic material, whose extinction coefficient already holds the absorption. By default,
[486.0, 532.0, 643.0], or[]for a metallic material.- absorption_values
List[float],optional Absorption coefficient at each wavelength, in mm-1. For a birefringent material, the absorption along the
aaxis. By default,[0.0, 0.0, 0.0], or[]for a metallic material.- measured_concentration
float,optional Concentration the absorption curve was measured at. By default,
1.0.- user_concentration
float,optional Concentration the absorption curve is scaled to. By default,
1.0.- scattering_wavelengths
List[float],optional Wavelengths of the diffusion curve, in nm. By default,
[486.0, 532.0, 643.0]whenscatteringis given,[]otherwise.- scattering_values
List[float],optional Diffusion coefficient at each wavelength, in mm-1. By default,
0.1at each default diffusion wavelength whenscatteringis given,[]otherwise.- scattering
Optional[VolumeScattering],optional Scattering phase function. By default,
None, which writes a non-scattering material.- axis_j
Sequence[float],optional Direction of the
baxis of a birefringent material. Ignored by the other flavors. By default,[1.0, 0.0, 0.0].- axis_k
Sequence[float],optional Direction of the
caxis of a birefringent material. Ignored by the other flavors. By default,[0.0, 1.0, 0.0].- absorption_values_b
List[float],optional Absorption of a birefringent material along its
baxis, one value per wavelength of the absorption curve. By default,0.0per absorption wavelength for a birefringent material,[]otherwise.- absorption_values_c
List[float],optional Absorption of a birefringent material along its
caxis, one value per wavelength of the absorption curve. By default,0.0per absorption wavelength for a birefringent material,[]otherwise.- fluorescent_pigments
Sequence[FluorescentPigment],optional Dye entries used by a fluorescent material. By default, no dyes are included; at least one must be added before saving.
- description
- Parameters:
description (str)
material_type (MaterialType)
dispersion (Union[MaterialDispersion, MaterialBirefringence, MaterialMetallicCurve, None])
absorption_wavelengths (List[float] | None)
absorption_values (List[float] | None)
measured_concentration (float)
user_concentration (float)
scattering_wavelengths (List[float] | None)
scattering_values (List[float] | None)
scattering (Optional[VolumeScattering])
axis_j (Sequence[float])
axis_k (Sequence[float])
absorption_values_b (List[float] | None)
absorption_values_c (List[float] | None)
fluorescent_pigments (Sequence[ansys.speos.core.input_files.fluorescence.FluorescentPigment] | None)
Notes
Called without arguments, the constructor creates an isotropic optical glass of index 1.5 that neither absorbs nor scatters light. The defaults of the curves depend on
material_typeandscatteringonly so that each flavor stays valid; a fluorescent material defaults to the Speos editor’s description and empty dye list, which must be populated before saving. The default dispersion model is always an index curve, so pass a matching model for a metallic or birefringent material.Setters validate candidate data without partially updating the material. List getters return copies; dispersion and phase models remain shared with validated properties. Empty columns permit staged construction, while
MaterialFile.validate()andsave()require complete data and recheck shared child models. To resize a curve, clear all dependent value columns before changing its wavelengths, then repopulate the columns. Likewise, clear all phase parameter columns before changing phase wavelengths. To change between isotropic, metallic and birefringent flavors, construct a new material with the matching dispersion model rather than changing the flavor in place.Examples
>>> from ansys.speos.core.input_files.material import MaterialFile, MaterialConstringence >>> MaterialFile( ... description="PMMA", ... dispersion=MaterialConstringence(constringence=57.2, index=1.49), ... absorption_wavelengths=[486.0, 643.0], ... absorption_values=[0.0001, 0.0005], ... ).save("pmma.material")
Overview#
Check the material against the constraints of the |
Single-line description. |
|
Absorption wavelengths in nm, returned as a copy. |
|
Absorption coefficients in mm-1, returned as a copy. |
|
Concentration at which absorption was measured. |
|
Concentration to which absorption is scaled. |
|
Diffusion wavelengths in nm, returned as a copy. |
|
Diffusion coefficients in mm-1, returned as a copy. |
|
Volume scattering phase function. |
|
Direction of the b axis, returned as a copy. |
|
Direction of the c axis, returned as a copy. |
|
Absorption coefficients along b, returned as a copy. |
|
Absorption coefficients along c, returned as a copy. |
|
Fluorescent dye entries, returned as a copied list. |
|
Material flavor matching the dispersion model. |
|
Dispersion model of this material flavor. |
Usual file extension of the format. |
|
First line of the file. Empty when the format has no header line. |
|
Version-agnostic start of |
|
Material type of the default flavor of the format. |
|
Material type of the metallic flavor of the format. |
|
Material type of the birefringent flavor of the format. |
|
Material type of the fluorescent flavor of the format. |
|
Dispersion models the file can hold. |
|
Dispersion models a birefringent material can hold. |
|
Scattering phase functions the file can hold. |
Import detail#
from ansys.speos.core.input_files.material import MaterialFile
Property detail#
- property MaterialFile.absorption_wavelengths: List[float]#
Absorption wavelengths in nm, returned as a copy.
- property MaterialFile.absorption_values: List[float]#
Absorption coefficients in mm-1, returned as a copy.
- property MaterialFile.measured_concentration: float#
Concentration at which absorption was measured.
- property MaterialFile.scattering_wavelengths: List[float]#
Diffusion wavelengths in nm, returned as a copy.
- property MaterialFile.scattering_values: List[float]#
Diffusion coefficients in mm-1, returned as a copy.
- property MaterialFile.scattering: VolumeScattering | None#
Volume scattering phase function.
- Parameters:
- value
Optional[VolumeScattering] New scattering phase function.
- value
- Returns:
Optional[VolumeScattering]Shared phase model, or None for a nonscattering material.
- property MaterialFile.absorption_values_b: List[float]#
Absorption coefficients along b, returned as a copy.
- property MaterialFile.absorption_values_c: List[float]#
Absorption coefficients along c, returned as a copy.
- property MaterialFile.fluorescent_pigments: List[ansys.speos.core.input_files.fluorescence.FluorescentPigment]#
Fluorescent dye entries, returned as a copied list.
- Parameters:
- values
Sequence[FluorescentPigment] New dye entries. Only fluorescent materials can contain dyes.
- values
- Returns:
List[FluorescentPigment]Dye entries whose nested models remain shared and editable.
- property MaterialFile.material_type: MaterialType#
Material flavor matching the dispersion model.
- Parameters:
- value
MaterialType New type of material.
- value
- Returns:
MaterialTypeIsotropic, metallic, birefringent, or fluorescent.
Notes
Construct a new material to switch to a flavor requiring another dispersion type.
- property MaterialFile.dispersion: MaterialDispersion | MaterialBirefringence | MaterialMetallicCurve#
Dispersion model of this material flavor.
- Parameters:
- value
Union[MaterialDispersion,MaterialBirefringence,MaterialMetallicCurve] New how the refractive index varies with the wavelength. A metallic material needs a
ansys.speos.core.input_files.material.MaterialMetallicCurveand a birefringent one needs one of theansys.speos.core.input_files.material.MaterialBirefringencemodels.
- value
- Returns:
Union[MaterialDispersion,MaterialBirefringence,MaterialMetallicCurve]Shared model with locally validated properties.
Attribute detail#
- MaterialFile.EXTENSION = '.material'#
Usual file extension of the format.
- MaterialFile.HEADER = 'OPTIS - Material file v13'#
First line of the file. Empty when the format has no header line.
- MaterialFile.HEADER_PREFIX = 'OPTIS - Material file'#
Version-agnostic start of
HEADER, used to validate a file being read.
- MaterialFile.ISOTROPIC: ClassVar[MaterialType]#
Material type of the default flavor of the format.
- MaterialFile.METALLIC: ClassVar[MaterialType]#
Material type of the metallic flavor of the format.
- MaterialFile.BIREFRINGENT: ClassVar[MaterialType]#
Material type of the birefringent flavor of the format.
- MaterialFile.FLUORESCENT: ClassVar[MaterialType]#
Material type of the fluorescent flavor of the format.
Method detail#
- MaterialFile.validate()#
Check the material against the constraints of the
*.materialformat.- Raises:
ValueErrorIf the dispersion model does not match
MaterialFile.material_type, if the absorption curve is empty or inconsistent, if a scattering phase function is set without a matching diffusion curve, if a fluorescent material has no pigments, or if a material carries data the format cannot store.