salvus.opt.mappings.mappings
Mappings between inversion parameters and simulation meshes.
Classes
BaseMapping
BaseMappingclass BaseMapping(salvus.flow.utils.serialization_helpers.SerializationMixin):
def __init__(
self,
inversion_parameters: List[str],
scaling: str,
map_to_physical_parameters: Optional[Dict[str, str]] = None,
discontinuous_model_blocks: Optional[List[List[int]]] = None,
): ...Class to map between model and simulation domains.
inversion_parametersList[str] — List of inversion parameters.scalingstr — Scaling of the inversion model.map_to_physical_parametersOptional[Dict[str, str]] — Dictionary defining the mapping from the model to the simulation space.discontinuous_model_blocksOptional[List[List[int]]] — Optionally specify which blocks in the unstructured mesh form discontinous regions of the model. The integer IDs refer to the fieldblockwhich must be store in the prior mesh.
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.
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.
Mapping
Mappingclass Mapping(salvus.opt.mappings.mappings.BaseMapping):
def __init__(
self,
inversion_parameters: List[str],
scaling: types,
map_to_physical_parameters: Optional[Dict[str, str]] = None,
region_of_interest: types = None,
source_cutout_radius_in_meters: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
receiver_cutout_radius_in_meters: Optional[
int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64
] = None,
discontinuous_model_blocks: Optional[List[List[int]]] = None,
postprocess_model_update: Optional[str, Callable] = None,
): ...Class to map between model and simulation domains.
inversion_parametersList[str] — List of inversion parameters.scalingtypes — Scaling of the inversion model. Must be one ofabsolute,absolute_deviation_from_priororrelative_deviation_from_prioror custom point-wise scaling values provided as a numpy array or dictionary of numpy arrays for each of the physical parameters.map_to_physical_parametersOptional[Dict[str, str]] — Dictionary defining the mapping from the model to the simulation space.region_of_interesttypes — Optional region of interest defined on an UnstructuredMesh or numpy array. Sensitivities outside the region of interest will be masked out during the adjoint mapping.source_cutout_radius_in_metersOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional event-dependent region-of-interest that cuts out a sphere around the source location(s).receiver_cutout_radius_in_metersOptional[int, numpy.int32, numpy.int64, float, numpy.float32, numpy.float64] — Optional event-dependent region-of-interest that cuts out a sphere around the receiver location(s).discontinuous_model_blocksOptional[List[List[int]]] — Optionally specify which blocks in the unstructured mesh form discontinous regions of the model. The integer IDs refer to the fieldblockwhich must be store in the prior mesh.postprocess_model_updateOptional[str, Callable] — Optionally pass a function to post-process the model update, e.g., by enforcing thresholds or inter-parameter relations which are not handled explicitly by constraints.
from_disk()
from_disk()def from_disk(d: Dict, path: types = None) -> Mapping: ...Construct object from a JSON-serializable dictionary.
dDict — JSON dictionary of the iteration.pathtypes — 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.
adjoint()
adjoint()def adjoint(
self,
mesh: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
prior: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
model: types = None,
event: types = None,
name: str = "tmp",
) -> salvus.opt.models.unstructured_model.UnstructuredModel: ...Adjoint mapping to transform gradients from physical to modle space.
meshsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Model in physical space to apply the adjoint mapping to.priorsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Prior in physical / simulation space.modeltypes — Model at which the adjoint mapping is evaluated. Can be None for linear mappings.eventtypes — Event required for event-dependent mappings.namestr — Optional name of the resulting inversion model.
forward()
forward()def forward(
self,
model: salvus.opt.models.unstructured_model.UnstructuredModel,
prior: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
event: types = None,
) -> (
salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh
): ...Map inversion model parameters to physical parameters on a mesh.
modelsalvus.opt.models.unstructured_model.UnstructuredModel — Inversion model.priorsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Prior in physical / simulation space.eventtypes — Event required for event-dependent mappings.
inverse()
inverse()def inverse(
self,
mesh: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
prior: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
event: types = None,
name: str = "tmp",
) -> salvus.opt.models.unstructured_model.UnstructuredModel: ...Inverse mapping to transform a model in physical / simulation space to the inversion space.
meshsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Model in physical space to apply the inverse mapping to.priorsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Prior in physical / simulation space.eventtypes — Event required for event-dependent mappings.namestr — Optional name of the resulting inversion model.
to_disk()
to_disk()def to_disk(
self, path: types = None, external_file_hash: types = None
) -> Dict: ...Serialize the object to dictionary that can be written to JSON. Auxiliary files will be written to the specified path.
pathtypes — Path to store auxiliary files.external_file_hashtypes — 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.
validate()
validate()def validate(
self,
prior: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
) -> None: ...Validate mapping for a given prior.
priorsalvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — Prior model.