salvus.project.configuration.inverse_problem_configuration
Classes
InverseProblemConfiguration
InverseProblemConfigurationclass InverseProblemConfiguration(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
name: str,
prior_model: str,
events: Union[str, Sequence[str]],
method: TrustRegion,
mapping: Mapping,
preconditioner: Optional[
salvus.opt.preconditioner.ConstantSmoothing,
salvus.opt.preconditioner.ModelDependentSmoothing,
salvus.opt.preconditioner.SpaceDependentSmoothing,
] = None,
misfit_configuration: Optional[
salvus.project.configuration.misfit_configuration.MisfitConfiguration
] = None,
wavefield_compression: Optional[
salvus.flow.collections.wavefield_compression.WavefieldCompression
] = None,
event_batch_selection: Optional[str, Callable] = None,
job_submission: Optional[
salvus.flow.sites.site_utils.SiteConfig,
Dict[
str,
Union[
salvus.flow.sites.site_utils.SiteConfig,
bool,
Dict[
str,
salvus.flow.sites.task_chain.task_chain_site_config.TaskChainSiteConfig,
],
],
],
] = None,
):
...Configuration for an inverse problem.
namestr — Name of the inverse problem.prior_modelstr — Prior model.eventsUnion[str, Sequence[str]] — List of events to consider.methodTrustRegion — Descent method to solve the inverse problem.mappingMapping — Mapping between inversion and simulation domain.preconditionerOptional[salvus.opt.preconditioner.ConstantSmoothing, salvus.opt.preconditioner.ModelDependentSmoothing, salvus.opt.preconditioner.SpaceDependentSmoothing] — Preconditioner used by the descent method.misfit_configurationOptional[salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The misfit configuration.wavefield_compressionOptional[salvus.flow.collections.wavefield_compression.WavefieldCompression] — The compression settings for checkpoints and recomputing the forward wavefield during the adjoint run.event_batch_selectionOptional[str, Callable] — Optional callback function for selecting a new subset of events in every new iteration.job_submissionOptional[salvus.flow.sites.site_utils.SiteConfig, Dict[str, Union[salvus.flow.sites.site_utils.SiteConfig, bool, Dict[str, salvus.flow.sites.task_chain.task_chain_site_config.TaskChainSiteConfig]]]] — Submission settings for asynchronous jobs.
event_batch_selection Optional[Callable]
event_batch_selection Optional[Callable]Get the event batch selection callback if available.
event_batch_selection_str Optional[str]
event_batch_selection_str Optional[str]Get the event batch selection callback as string if available.
from_json()
from_json()def from_json(
d: Dict, json_path: pathlib.Path, model_inventory_path: pathlib.Path
) -> InverseProblemConfiguration:
...Construct object from a JSON-serializable dictionary.
dDict — JSON dictionary of the inverse problem.json_pathpathlib.Path — Path to serialized json file.model_inventory_pathpathlib.Path — Path to the model inventory at the project level.
add_events()
add_events()def add_events(self, events: Sequence[str]) -> None:
...Add events to the inverse problem
eventsSequence[str] — List of event names.
add_iteration()
add_iteration()def add_iteration(self, iteration: salvus.opt.iteration.Iteration) -> None:
...Add an interation to the inverse problem
iterationsalvus.opt.iteration.Iteration — Iteration.
check_stopping_criteria()
check_stopping_criteria()def check_stopping_criteria(
self, iteration_id: Optional[int, numpy.int32, numpy.int64] = None
) -> bool:
...Check if the iteration satisfies at least one of the stopping criteria are satisfied.
iteration_idOptional[int, numpy.int32, numpy.int64] — Iteration id.
delete_iteration()
delete_iteration()def delete_iteration(self, id: int) -> None:
...Delete an iteration from the inverse problem.
idint — ID of the iteration to delete.
get_all_branches()
get_all_branches()def get_all_branches(self) -> Dict[str, List[int]]:
...Return a dictionary of all branches in the inversion tree. The keys are set to the tips of the branches.
get_branch_ids()
get_branch_ids()def get_branch_ids(self, latest: int) -> List[int]:
...Obtain the ids of an inversion branch.
latestint — Id of the latest iteration.
get_iteration()
get_iteration()def get_iteration(self, id: int) -> salvus.opt.iteration.Iteration:
...Obtain an iteration object from the inverse problem.
idint — ID of the iteration.
get_iteration_directory()
get_iteration_directory()def get_iteration_directory(self, iteration_id: int) -> pathlib.Path:
...Obtain the path where all models and gradients of this iteration are stored.
iteration_idint — ID of the iteration.
get_iteration_ids()
get_iteration_ids()def get_iteration_ids(self, status: str = "all") -> Sequence[int]:
...Get the IDs of all iterations with a certain status
statusstr — Status of the iteration.
get_new_iteration_id()
get_new_iteration_id()def get_new_iteration_id(self) -> int:
...Obtain the next available iteration ID.
set_constraints()
set_constraints()def set_constraints(
self,
constraints: Dict[
str, salvus.opt.models.unstructured_model.UnstructuredModel
],
) -> None:
...Define box constraints on the inversion parameters.
constraintsDict[str, salvus.opt.models.unstructured_model.UnstructuredModel] — Optional lower and upper bounds on the model parameters.
set_job_submission()
set_job_submission()def set_job_submission(
self,
job_submission: Union[
salvus.flow.sites.site_utils.SiteConfig,
Dict[
str,
Union[
salvus.flow.sites.site_utils.SiteConfig,
bool,
Dict[
str,
salvus.flow.sites.task_chain.task_chain_site_config.TaskChainSiteConfig,
],
],
],
],
) -> None:
...Set job submission configuration for asynchronous tasks.
job_submissionUnion[salvus.flow.sites.site_utils.SiteConfig, Dict[str, Union[salvus.flow.sites.site_utils.SiteConfig, bool, Dict[str, salvus.flow.sites.task_chain.task_chain_site_config.TaskChainSiteConfig]]]] — Either aSiteConfigor a dictionary ofSiteConfigs or with keysforward,adjointandpreconditioner. Instead of aSiteConfigit is also possible to pass a dictionary ofTaskChainSiteConfigs forforwardandadjoint.
set_stopping_criteria()
set_stopping_criteria()def set_stopping_criteria(self, criteria: Dict) -> None:
...Set stopping criteria to limit the maximum cost of an inversion.
criteriaDict — Dictionary of stopping criteria. If any of them is true, no further iterations will be added. Currently supported aremax_iterationsfor the maximum number of iterations per branch andmax_iterations_globalfor the maximum number of iterations in the entire inversion tree.
set_wavefield_compression()
set_wavefield_compression()def set_wavefield_compression(
self,
wavefield_compression: salvus.flow.collections.wavefield_compression.WavefieldCompression,
) -> None:
...Set wavefield compression settings for gradient computations.
wavefield_compressionsalvus.flow.collections.wavefield_compression.WavefieldCompression — Wavefield compression settings.
to_json()
to_json()def to_json(self) -> Dict:
...Serialize the object to dictionary that can be written to JSON. Auxiliary files will be written to the specified path.
update_iteration()
update_iteration()def update_iteration(self, iteration: salvus.opt.iteration.Iteration) -> None:
...Update an iteration. The same iteration ID must already exist in the inverse problem.
iterationsalvus.opt.iteration.Iteration — Iteration to update.