salvus.opt.preconditioner
Simplified preconditioner interface for unstructured meshes
Functions
validate()
validate()def validate(
preconditioner: Union[
salvus.opt.preconditioner.ConstantSmoothing,
salvus.opt.preconditioner.SpaceDependentSmoothing,
salvus.opt.preconditioner.ModelDependentSmoothing,
],
inversion_parameters: Sequence[str],
prior: Optional[
salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh
] = None,
) -> None: ...Validate a preconditioner instance for a set of inversion paramaters, and, optionally, the prior model.
preconditionerUnion[salvus.opt.preconditioner.ConstantSmoothing, salvus.opt.preconditioner.SpaceDependentSmoothing, salvus.opt.preconditioner.ModelDependentSmoothing] — Preconditioner.inversion_parametersSequence[str] — List of inversion parameters.priorOptional[salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh] — Prior model.
Classes
ConstantSmoothing
ConstantSmoothingclass ConstantSmoothing(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
smoothing_lengths_in_meters: Dict[
str,
Union[
int,
numpy.int32,
numpy.int64,
float,
numpy.float32,
numpy.float64,
Sequence[
Union[
int,
numpy.int32,
numpy.int64,
float,
numpy.float32,
numpy.float64,
]
],
],
],
courant_number: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
time_step_in_seconds: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
): ...Constant (an)-isotropic smoothing
smoothing_lengths_in_metersDict[str, Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64, Sequence[Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]]]] — Smoothing length in meters. Provide a float for isotropic smoothing, or a list of length dim for anisotropic smoothing. Depending on the reference frame of the input mesh the indices of the list either correspond toX,Y,Zorr,theta,phi.courant_numberOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom Courant number for auto-time-step detection.time_step_in_secondsOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom time step for diffusion equation.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
dDict — Dictionary containing its init parameters and a few other things.
get_smoothing_config()
get_smoothing_config()def get_smoothing_config(self) -> Dict[str, Any]: ...to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict: ...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
ModelDependentSmoothing
ModelDependentSmoothingclass ModelDependentSmoothing(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
smoothing_lengths_in_wavelengths: Dict[
str,
Union[
int,
numpy.int32,
numpy.int64,
float,
numpy.float32,
numpy.float64,
Sequence[
Union[
int,
numpy.int32,
numpy.int64,
float,
numpy.float32,
numpy.float64,
]
],
],
],
reference_frequency_in_hertz: Union[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
],
reference_model: str,
reference_velocities: Optional[Dict[str, str]] = None,
courant_number: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
time_step_in_seconds: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
): ...Model-dependent (an)-isotropic smoothing
smoothing_lengths_in_wavelengthsDict[str, Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64, Sequence[Union[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64]]]] — Smoothing length in wave lengths. Provide a float for isotropic smoothing, or a list of length dim for anisotropic smoothing. Depending on the reference frame of the input mesh the indices of the list either correspond toX,Y,Zorr,theta,phi.reference_frequency_in_hertzUnion[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Reference frequency to compute the wave length in Hz.reference_modelstr — Reference model to extract the reference velocity from. This can either be a model from an arbitrary simulation configuration, orpriorto use the prior model of the inverse problem configuration, orcurrentto use the model of the current iteration, when the preconditioner is applied.reference_velocitiesOptional[Dict[str, str]] — Optional mapping providing the field name of the reference velocity to compute the wave length in Hz. If no reference velocity is provided, the same field name will be used.courant_numberOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom Courant number for auto-time-step detection.time_step_in_secondsOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom time step for diffusion equation.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
dDict — Dictionary containing its init parameters and a few other things.
get_smoothing_config()
get_smoothing_config()def get_smoothing_config(self) -> Dict[str, Any]: ...to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict: ...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.
SpaceDependentSmoothing
SpaceDependentSmoothingclass SpaceDependentSmoothing(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
smoothing_model: Union[
str,
pathlib.Path,
salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
],
field_names: Dict[str, Union[str, Sequence[str]]],
courant_number: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
time_step_in_seconds: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
): ...Space-dependent (an)-isotropic smoothing
smoothing_modelUnion[str, pathlib.Path, salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh] — Unstructured mesh object containing the smoothing lengths.field_namesDict[str, Union[str, Sequence[str]]] — Dictionary specifying the field names that contain the smoothing length in meters for each parameter field. This could either be a single field for isotropic, or a list for anisoptropic smoothing, respectively. Depending on the reference frame of the input mesh this is eitherX,Y,ZorN,E,Z.”courant_numberOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom Courant number for auto-time-step detection.time_step_in_secondsOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional custom time step for diffusion equation.
from_disk()
from_disk()def from_disk(
d: Dict, path: Optional[pathlib.Path] = None
) -> SpaceDependentSmoothing: ...Construct object from a JSON-serializable dictionary.
dDict — JSON dictionary of the iteration.pathOptional[pathlib.Path] — Path to the folder containing auxiliary files.
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
dDict — Dictionary containing its init parameters and a few other things.
get_smoothing_config()
get_smoothing_config()def get_smoothing_config(self) -> Dict[str, Any]: ...to_disk()
to_disk()def to_disk(
self,
path: Optional[pathlib.Path] = None,
external_file_hash: Optional[str] = None,
) -> Dict: ...Serialize the object to dictionary that can be written to JSON. Auxiliary files will be written to the specified path.
pathOptional[pathlib.Path] — Path to store auxiliary files.external_file_hashOptional[str] — 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.
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict: ...Serialize the object to dictionary that can be written to JSON.
external_file_hashOptional[str] — 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.