eradiate.converters¶
- eradiate.converters.auto_or(wrapped_converter)[source]¶
A converter that allows an attribute to be set to
AUTO.- Parameters:
wrapped_converter (
callable()) – The converter that is used for non-AUTOvalues.- Returns:
- eradiate.converters.convert_absdb(value)[source]¶
Attempt conversion of a value to an absorption database.
- Parameters:
value – The value for which conversion is attempted.
- Returns:
MonoAbsorptionDatabaseorCKDAbsorptionDatabase
Notes
Conversion rules are as follows:
If
valueis a string, try converting using the factory’screate()method. Do not raise if this fails.If
valueis a string or a path, try converting using thefrom_directory()constructor after passing through the file resolver. The returned type is consistent with the active mode.If
valueis a dict, try converting using thefrom_dict()constructor. The returned type is consistent with the active mode.Otherwise, do not convert.
- eradiate.converters.convert_thermoprops(value)[source]¶
Converter for atmosphere thermophysical properties specifications.
- eradiate.converters.on_quantity(wrapped_converter)[source]¶
Apply a converter to the magnitude of a
pint.Quantity.- Parameters:
wrapped_converter (
callable()) – The converter which will be applied to the magnitude of apint.Quantity.- Returns:
- eradiate.converters.passthrough(predicate)[source]¶
Pass through values for which
predicatereturnsTrue; otherwise, apply wrapped converter.See also
- eradiate.converters.passthrough_type(types)[source]¶
Pass through values of a specified type; otherwise, apply wrapped converter.
See also
- eradiate.converters.resolve_keyword(path_forming_func)[source]¶
Attempt resolving a keyword into a path constructed from a keyword by the
path_forming_funcparameter.If the generated path points to a file, the path is returned; otherwise,
valueis returned without modification.- Parameters:
path_forming_func (
callable()) – A callable with signaturef(x: str) -> Paththat constructs relative or absolute paths from keywords. Relative paths are then resolved by the file resolver.
- eradiate.converters.resolve_path(value)[source]¶
Resolve a file path with the file resolver. The current working directory is included in the path lookup.
- eradiate.converters.to_mi_scalar_transform(value)[source]¶
Convert an array-like value to a
mitsuba.ScalarTransform4f. If value is a Numpy array, it is used to initialize amitsuba.ScalarTransform4fwithout copy; if it is a list, a Numpy array is first created from it. Otherwise, value is forwarded without change.