salvus.material.acoustic.hexagonal
salvus.material.acoustic.hexagonal salvus material acoustic hexagonal Hexagonal (VTI) anisotropic acoustic materials.
Classes
TensorComponents
TensorComponentsclass TensorComponents(
salvus.material.acoustic.hexagonal._Hexagonal,
salvus.material.acoustic.AcousticTensorComponents,
):
def __init__(
self,
M0: _pd.types.ParameterOrConstantT,
D11: _pd.types.ParameterOrConstantT,
D33: _pd.types.ParameterOrConstantT,
D13: _pd.types.ParameterOrConstantT,
extensions: typing.Mapping[str, Material] = default,
) -> None: ...Hexagonal anisotropic acoustic material parametrized by acoustic tensor.
M0_pd.types.ParameterOrConstantT — The density in kg / m^3.D11_pd.types.ParameterOrConstantT — The d_11 component of the acoustic tensor.D33_pd.types.ParameterOrConstantT — The d_33 component of the acoustic tensor.D13_pd.types.ParameterOrConstantT — The d_13 component of the acoustic tensor.extensionstyping.Mapping[str, Material] =<factory>— Attached extension materials. Supported: attenuation, orientation.
attenuation Material | None
attenuation Material | NoneOptional attenuation extension.
ds typing.Mapping
ds typing.MappingMaterial’s xarray representation.
flatten dict
flatten dictGet all parameters as a dict, including extension parameters.
orientation Material | None
orientation Material | NoneOptional orientation extension.
all_components()
all_components()def all_components() -> list[str]: ...Get all components.
equal_components()
equal_components()def equal_components() -> dict[str, str]: ...Get equal components for a material class.
from_dataset()
from_dataset()def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...Construct a material from an xarray Dataset.
dsxr.Dataset — The dataset to construct the material from.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Only load trusted input.
dDict — Dictionary containing its init parameters and a few other things.
from_material()
from_material()def from_material(
m: Material[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> Self: ...Construct this material from another within the same physical system.
mMaterial[_pd.types.ParameterFlavorT] — Material to transform.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
from_params()
from_params()def from_params(
m0: _pd.types.ParameterInput,
d11: _pd.types.ParameterInput,
d33: _pd.types.ParameterInput,
d13: _pd.types.ParameterInput,
) -> typing.Self: ...Construct a hexagonal material from acoustic constants.
m0_pd.types.ParameterInput — The density in kg / m^3.d11_pd.types.ParameterInput — The d_11 component of the acoustic tensor.d33_pd.types.ParameterInput — The d_33 component of the acoustic tensor.d13_pd.types.ParameterInput — The d_13 component of the acoustic tensor.
from_tensor_components()
from_tensor_components()def from_tensor_components(
m: GenericTensorComponents[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> Self: ...Create material from tensor components acoustic parameter material.
Overwrite this method if your material can not be constructed from acoustic constants.
A class method to create a anisotropic material of a desired symmetry class from a canonical TC material. The method will automatically check if the canonical material that is passed meets the symmetry requirements of the desired materials. If it does not, a TypeError will be raised.
mGenericTensorComponents[_pd.types.ParameterFlavorT] — The material in tensor components parametrization to be used to construct the new material.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
material_system()
material_system()def material_system() -> type[PhysicalMaterial]: ...Get the material system of the material.
nonzero_components()
nonzero_components()def nonzero_components() -> list[str]: ...Get nonzero components for a material class.
zero_components()
zero_components()def zero_components() -> list[str]: ...Get zero components for a material class.
map()
map()def map(
self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> Self: ...Generic map for materials, recursing into extension materials.
See dataclass_utils.MappableDataclass.map for the base semantics.
Extension materials (in extensions) are mapped independently, since
f is defined in terms of a single material’s own parameter names.
ftyping.Callable[[str, typing.Any], tuple[str, typing.Any]] — Callable taking (key, value) and returning (key, value).
map_realized_parameters()
map_realized_parameters()def map_realized_parameters(
self,
f_constant: typing.Callable[
[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter
] = salvus.material.base_materials._map_realized_default,
f_discrete: typing.Callable[
[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter
] = salvus.material.base_materials._map_realized_default,
f_analytic: typing.Callable[
[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter
] = salvus.material.base_materials._map_realized_default,
) -> Self: ...Apply functions to each parameter individually, distinguishing _pd.
Useful when one wants to transform each parameter type separately. For instance, transformations of discrete parameters often require more associated logic than their constant equivalents. This function abstracts away the boilerplate of check for each parameter type, and subsequently transforming it with some function, as well as ensuring that the parameters are indeed of the correct realized type.
The signatures of each transformation function should take the parameter’s name and value as two distinct inputs, and return the (potentially modified) parameter value.
f_constanttyping.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to constant parameters. Defaults to returning the parameter as-is.f_discretetyping.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to discrete parameters. Defaults to returning the parameter as-is.f_analytictyping.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to analytic parameters. Defaults to returning the parameter as-is.
qc_test()
qc_test()def qc_test(
self,
level: validation.QCLevel | str = QCLevel.strict,
display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...Run a series of material quality control tests.
The function also prints a summary of the issues found, including their severity and any mitigation steps that can be taken.
levelvalidation.QCLevel | str =QCLevel.strict— The level of quality control to perform. The BASIC level performs minimal checks, while the STRICT level performs more thorough checks that are potentially slow. One can pass an enumeration value or a string representation of the level.display_issuesbool =True— If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
type is the type of the issue (e.g, “mesh” or “material”) and code is a specific code for the issue (e.g., “NON_POSITIVE_VP”). If no issues are found, an empty dictionary is returned.to_json()
to_json()def to_json(
self,
external_file_hash: Optional[str] = None,
timer: Optional[salvus._core.timer.timer.Timer] = None,
log_to_logger: bool = False,
comm: Optional[int] = None,
) -> Dict: ...Serialize the object to a dictionary that can be written to JSON.
external_file_hashOptional[str] =None— Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.timerOptional[salvus._core.timer.timer.Timer] =None— Execution timer.log_to_loggerbool =False— Log timings to the logger.commOptional[int] =None— MPI communicator, if any.
to_tensor_components()
to_tensor_components()def to_tensor_components(
self, expand_symmetries: bool = False
) -> MaterialDict | GenericTensorComponents: ...Generate a tensor component representation of the material.
This method ensures compatibility with solver and other symmetries.
expand_symmetriesbool =False— boolean determining if to return a expanded canonical parameters instead of the TensorComponents object in the relevant symmetry system. Defaults to False.
to_wavelength_oracle()
to_wavelength_oracle()def to_wavelength_oracle(
self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...The wavelength oracle.
n_dimtyping.Literal[2, 3] | None =None— Dimension to return the oracle for, deprecated.
with_attenuation()
with_attenuation()def with_attenuation(self, attenuation: Material | None) -> Self: ...Add attenuation to an object.
attenuationMaterial | None — The attenuation material.
with_extension()
with_extension()def with_extension(self, name: str, value: Material | None) -> Self: ...Attach or detach an extension material by name.
Passing value=None always removes the extension, even if name
isn’t in _supported_extensions (mirrors removing something that
was never there). Attaching a real value that isn’t supported
raises, as does constructing the material with it directly.
namestr — Extension name (e.g.,"attenuation","orientation").valueMaterial | None — Extension material, orNoneto remove.
with_orientation()
with_orientation()def with_orientation(self, orientation: Material | None) -> Self: ...Add orientation to a material.
orientationMaterial | None — The orientation.
Thomsen
Thomsenclass Thomsen(salvus.material.acoustic.hexagonal._Hexagonal):
def __init__(
self,
RHO: _pd.types.ParameterOrConstantT,
VP: _pd.types.ParameterOrConstantT,
DELTA: _pd.types.ParameterOrConstantT,
EPSILON: _pd.types.ParameterOrConstantT,
extensions: typing.Mapping[str, Material] = default,
) -> None: ...Define a hexagonal acoustic material from Thomsen’s parameters.
Salvus’ acoustic anisotropic wave equation uses a rank-2 stiffness tensor
D_ij (so the squared phase speed is the quadratic form
n_hat @ D @ n_hat / rho). Slowness surfaces of that operator are always
ellipsoids, while real transversely-isotropic media generally have
non-ellipsoidal qP wavefronts. The two coincide exactly only for Thomsen’s
elliptical case epsilon = delta.
RHO_pd.types.ParameterOrConstantT — Density in kg / m^3.VP_pd.types.ParameterOrConstantT — P-wave velocity in m / s.DELTA_pd.types.ParameterOrConstantT — Thomsen’s delta parameter (dimensionless).EPSILON_pd.types.ParameterOrConstantT — Thomsen’s epsilon parameter (dimensionless).extensionstyping.Mapping[str, Material] =<factory>— Attached extension materials. Supported: attenuation, orientation.
attenuation Material | None
attenuation Material | NoneOptional attenuation extension.
ds typing.Mapping
ds typing.MappingMaterial’s xarray representation.
flatten dict
flatten dictGet all parameters as a dict, including extension parameters.
orientation Material | None
orientation Material | NoneOptional orientation extension.
from_dataset()
from_dataset()def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...Construct a material from an xarray Dataset.
dsxr.Dataset — The dataset to construct the material from.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Only load trusted input.
dDict — Dictionary containing its init parameters and a few other things.
from_material()
from_material()def from_material(
m: Material[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> Self: ...Construct this material from another within the same physical system.
mMaterial[_pd.types.ParameterFlavorT] — Material to transform.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
from_params()
from_params()def from_params(
rho: _pd.types.ParameterInput,
vp: _pd.types.ParameterInput,
delta: _pd.types.ParameterInput,
epsilon: _pd.types.ParameterInput,
) -> Thomsen: ...Construct this material from generic parameters.
rho_pd.types.ParameterInput — Density in kg / m^3.vp_pd.types.ParameterInput — P-wave velocity in m / s.delta_pd.types.ParameterInput — Thomsen’s delta parameter (dimensionless).epsilon_pd.types.ParameterInput — Thomsen’s epsilon parameter (dimensionless).
from_tensor_components()
from_tensor_components()def from_tensor_components(
m: GenericTensorComponents[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> Thomsen: ...Create material from tensor components acoustic parameter material.
Overwrite this method if your material can not be constructed from acoustic constants.
A class method to create a anisotropic material of a desired symmetry class from a canonical TC material. The method will automatically check if the canonical material that is passed meets the symmetry requirements of the desired materials. If it does not, a TypeError will be raised.
mGenericTensorComponents[_pd.types.ParameterFlavorT] — The material in tensor components parametrization to be used to construct the new material.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
material_system()
material_system()def material_system() -> type[PhysicalMaterial]: ...Get the material system of the material.
map()
map()def map(
self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> Self: ...Generic map for materials, recursing into extension materials.
See dataclass_utils.MappableDataclass.map for the base semantics.
Extension materials (in extensions) are mapped independently, since
f is defined in terms of a single material’s own parameter names.
ftyping.Callable[[str, typing.Any], tuple[str, typing.Any]] — Callable taking (key, value) and returning (key, value).
map_realized_parameters()
map_realized_parameters()def map_realized_parameters(
self,
f_constant: typing.Callable[
[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter
] = salvus.material.base_materials._map_realized_default,
f_discrete: typing.Callable[
[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter
] = salvus.material.base_materials._map_realized_default,
f_analytic: typing.Callable[
[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter
] = salvus.material.base_materials._map_realized_default,
) -> Self: ...Apply functions to each parameter individually, distinguishing _pd.
Useful when one wants to transform each parameter type separately. For instance, transformations of discrete parameters often require more associated logic than their constant equivalents. This function abstracts away the boilerplate of check for each parameter type, and subsequently transforming it with some function, as well as ensuring that the parameters are indeed of the correct realized type.
The signatures of each transformation function should take the parameter’s name and value as two distinct inputs, and return the (potentially modified) parameter value.
f_constanttyping.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to constant parameters. Defaults to returning the parameter as-is.f_discretetyping.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to discrete parameters. Defaults to returning the parameter as-is.f_analytictyping.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to analytic parameters. Defaults to returning the parameter as-is.
qc_test()
qc_test()def qc_test(
self,
level: validation.QCLevel | str = QCLevel.strict,
display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...Run a series of material quality control tests.
The function also prints a summary of the issues found, including their severity and any mitigation steps that can be taken.
levelvalidation.QCLevel | str =QCLevel.strict— The level of quality control to perform. The BASIC level performs minimal checks, while the STRICT level performs more thorough checks that are potentially slow. One can pass an enumeration value or a string representation of the level.display_issuesbool =True— If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
type is the type of the issue (e.g, “mesh” or “material”) and code is a specific code for the issue (e.g., “NON_POSITIVE_VP”). If no issues are found, an empty dictionary is returned.to_json()
to_json()def to_json(
self,
external_file_hash: Optional[str] = None,
timer: Optional[salvus._core.timer.timer.Timer] = None,
log_to_logger: bool = False,
comm: Optional[int] = None,
) -> Dict: ...Serialize the object to a dictionary that can be written to JSON.
external_file_hashOptional[str] =None— Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.timerOptional[salvus._core.timer.timer.Timer] =None— Execution timer.log_to_loggerbool =False— Log timings to the logger.commOptional[int] =None— MPI communicator, if any.
to_tensor_components()
to_tensor_components()def to_tensor_components(
self, expand_symmetries: bool = False
) -> MaterialDict | GenericTensorComponents: ...Generate a tensor component representation of the material.
This method ensures compatibility with solver and other symmetries.
expand_symmetriesbool =False— boolean determining if to return a expanded canonical parameters instead of the TensorComponents object in the relevant symmetry system. Defaults to False.
to_wavelength_oracle()
to_wavelength_oracle()def to_wavelength_oracle(
self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...The wavelength oracle.
n_dimtyping.Literal[2, 3] | None =None— Dimension to return the oracle for, deprecated.
with_attenuation()
with_attenuation()def with_attenuation(self, attenuation: Material | None) -> Self: ...Add attenuation to an object.
attenuationMaterial | None — The attenuation material.
with_extension()
with_extension()def with_extension(self, name: str, value: Material | None) -> Self: ...Attach or detach an extension material by name.
Passing value=None always removes the extension, even if name
isn’t in _supported_extensions (mirrors removing something that
was never there). Attaching a real value that isn’t supported
raises, as does constructing the material with it directly.
namestr — Extension name (e.g.,"attenuation","orientation").valueMaterial | None — Extension material, orNoneto remove.
with_orientation()
with_orientation()def with_orientation(self, orientation: Material | None) -> Self: ...Add orientation to a material.
orientationMaterial | None — The orientation.
Velocity
Velocityclass Velocity(salvus.material.acoustic.hexagonal._Hexagonal):
def __init__(
self,
RHO: _pd.types.ParameterOrConstantT,
VPV: _pd.types.ParameterOrConstantT,
VPH: _pd.types.ParameterOrConstantT,
DELTA: _pd.types.ParameterOrConstantT,
extensions: typing.Mapping[str, Material] = default,
) -> None: ...Define a hexagonal anisotropic acoustic material from velocities.
This material has the same elliptical-only restriction as Thomsen — the
implicit Thomsen epsilon = 0.5 * ((VPH/VPV)**2 - 1) enters the same
rank-2 D tensor. The simulation is exact when epsilon = delta.
RHO_pd.types.ParameterOrConstantT — Density in kg / m^3.VPV_pd.types.ParameterOrConstantT — Vertical P-wave velocity in m / s.VPH_pd.types.ParameterOrConstantT — Horizontal P-wave velocity in m / s.DELTA_pd.types.ParameterOrConstantT — Thomsen’s delta parameter (dimensionless).extensionstyping.Mapping[str, Material] =<factory>— Attached extension materials. Supported: attenuation, orientation.
attenuation Material | None
attenuation Material | NoneOptional attenuation extension.
ds typing.Mapping
ds typing.MappingMaterial’s xarray representation.
flatten dict
flatten dictGet all parameters as a dict, including extension parameters.
orientation Material | None
orientation Material | NoneOptional orientation extension.
from_dataset()
from_dataset()def from_dataset(ds: xr.Dataset) -> Material[_pd.types.ParameterFlavorT]: ...Construct a material from an xarray Dataset.
dsxr.Dataset — The dataset to construct the material from.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Only load trusted input.
dDict — Dictionary containing its init parameters and a few other things.
from_material()
from_material()def from_material(
m: Material[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> Self: ...Construct this material from another within the same physical system.
mMaterial[_pd.types.ParameterFlavorT] — Material to transform.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
from_params()
from_params()def from_params(
rho: _pd.types.ParameterInput,
vpv: _pd.types.ParameterInput,
vph: _pd.types.ParameterInput,
delta: _pd.types.ParameterInput,
) -> typing.Self: ...Construct this material from generic parameters.
rho_pd.types.ParameterInput — Density in kg / m^3.vpv_pd.types.ParameterInput — Vertical P-wave velocity in m / s.vph_pd.types.ParameterInput — Horizontal P-wave velocity in m / s.delta_pd.types.ParameterInput — Thomsen’s delta parameter.
from_tensor_components()
from_tensor_components()def from_tensor_components(
m: GenericTensorComponents[_pd.types.ParameterFlavorT],
reduction_method: (
typing.Literal["remove-components", "force"] | None
) = None,
) -> typing.Self: ...Create material from tensor components acoustic parameter material.
Overwrite this method if your material can not be constructed from acoustic constants.
A class method to create a anisotropic material of a desired symmetry class from a canonical TC material. The method will automatically check if the canonical material that is passed meets the symmetry requirements of the desired materials. If it does not, a TypeError will be raised.
mGenericTensorComponents[_pd.types.ParameterFlavorT] — The material in tensor components parametrization to be used to construct the new material.reduction_methodtyping.Literal['remove-components', 'force'] | None =None— Method to move between incompatible symmetry classes. None will only move to symmetries that are equal or more permissive, whileremove-componentswill drop components that are found to match the new material’s constraints as necessary, and thus leading to loss of free parameters but not of information. The option “force” will take all information necessary to construct the new parameter set without verification, leading to loss of information.
material_system()
material_system()def material_system() -> type[PhysicalMaterial]: ...Get the material system of the material.
map()
map()def map(
self, f: typing.Callable[[str, typing.Any], tuple[str, typing.Any]]
) -> Self: ...Generic map for materials, recursing into extension materials.
See dataclass_utils.MappableDataclass.map for the base semantics.
Extension materials (in extensions) are mapped independently, since
f is defined in terms of a single material’s own parameter names.
ftyping.Callable[[str, typing.Any], tuple[str, typing.Any]] — Callable taking (key, value) and returning (key, value).
map_realized_parameters()
map_realized_parameters()def map_realized_parameters(
self,
f_constant: typing.Callable[
[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter
] = salvus.material.base_materials._map_realized_default,
f_discrete: typing.Callable[
[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter
] = salvus.material.base_materials._map_realized_default,
f_analytic: typing.Callable[
[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter
] = salvus.material.base_materials._map_realized_default,
) -> Self: ...Apply functions to each parameter individually, distinguishing _pd.
Useful when one wants to transform each parameter type separately. For instance, transformations of discrete parameters often require more associated logic than their constant equivalents. This function abstracts away the boilerplate of check for each parameter type, and subsequently transforming it with some function, as well as ensuring that the parameters are indeed of the correct realized type.
The signatures of each transformation function should take the parameter’s name and value as two distinct inputs, and return the (potentially modified) parameter value.
f_constanttyping.Callable[[str, _pd.realized.constant.Parameter], _pd.realized.constant.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to constant parameters. Defaults to returning the parameter as-is.f_discretetyping.Callable[[str, _pd.realized.discrete.Parameter], _pd.realized.discrete.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to discrete parameters. Defaults to returning the parameter as-is.f_analytictyping.Callable[[str, _pd.realized.analytic.Parameter], _pd.realized.analytic.Parameter] =salvus.material.base_materials._map_realized_default— The function to apply to analytic parameters. Defaults to returning the parameter as-is.
qc_test()
qc_test()def qc_test(
self,
level: validation.QCLevel | str = QCLevel.strict,
display_issues: bool = True,
) -> dict[str, MaterialQCIssue]: ...Run a series of material quality control tests.
The function also prints a summary of the issues found, including their severity and any mitigation steps that can be taken.
levelvalidation.QCLevel | str =QCLevel.strict— The level of quality control to perform. The BASIC level performs minimal checks, while the STRICT level performs more thorough checks that are potentially slow. One can pass an enumeration value or a string representation of the level.display_issuesbool =True— If True, prints the issues found during the quality control checks. If False, issues are collected but not printed.
type is the type of the issue (e.g, “mesh” or “material”) and code is a specific code for the issue (e.g., “NON_POSITIVE_VP”). If no issues are found, an empty dictionary is returned.to_json()
to_json()def to_json(
self,
external_file_hash: Optional[str] = None,
timer: Optional[salvus._core.timer.timer.Timer] = None,
log_to_logger: bool = False,
comm: Optional[int] = None,
) -> Dict: ...Serialize the object to a dictionary that can be written to JSON.
external_file_hashOptional[str] =None— Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.timerOptional[salvus._core.timer.timer.Timer] =None— Execution timer.log_to_loggerbool =False— Log timings to the logger.commOptional[int] =None— MPI communicator, if any.
to_tensor_components()
to_tensor_components()def to_tensor_components(
self, expand_symmetries: bool = False
) -> MaterialDict | GenericTensorComponents: ...Generate a tensor component representation of the material.
This method ensures compatibility with solver and other symmetries.
expand_symmetriesbool =False— boolean determining if to return a expanded canonical parameters instead of the TensorComponents object in the relevant symmetry system. Defaults to False.
to_wavelength_oracle()
to_wavelength_oracle()def to_wavelength_oracle(
self, n_dim: typing.Literal[2, 3] | None = None
) -> _pd.types.ParameterOrConstantT: ...The wavelength oracle.
n_dimtyping.Literal[2, 3] | None =None— Dimension to return the oracle for, deprecated.
with_attenuation()
with_attenuation()def with_attenuation(self, attenuation: Material | None) -> Self: ...Add attenuation to an object.
attenuationMaterial | None — The attenuation material.
with_extension()
with_extension()def with_extension(self, name: str, value: Material | None) -> Self: ...Attach or detach an extension material by name.
Passing value=None always removes the extension, even if name
isn’t in _supported_extensions (mirrors removing something that
was never there). Attaching a real value that isn’t supported
raises, as does constructing the material with it directly.
namestr — Extension name (e.g.,"attenuation","orientation").valueMaterial | None — Extension material, orNoneto remove.
with_orientation()
with_orientation()def with_orientation(self, orientation: Material | None) -> Self: ...Add orientation to a material.
orientationMaterial | None — The orientation.