salvus.project.configuration.inverse_problem_configuration
salvus.project.configuration.inverse_problem_configuration salvus project configuration inverse_problem_configuration The inverse problem configuration.
Classes
InverseProblemConfiguration
InverseProblemConfigurationclass InverseProblemConfiguration(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
name: str,
prior_model: str,
events: str | typing.Sequence[str],
method: TrustRegion,
mapping: Mapping,
preconditioner: (
ConstantSmoothing
| ModelDependentSmoothing
| SpaceDependentSmoothing
| typing.Callable
| str
| None
) = None,
extra_kwargs_preconditioner: dict | None = None,
misfit_configuration: MisfitConfiguration | str | None = None,
wavefield_compression: WavefieldCompression | None = None,
event_batch_selection: str | typing.Callable | None = None,
job_submission: (
SiteConfig
| TaskChainSiteConfig
| dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]]
| MPIExecutionConfiguration
| None
) = None,
): ...Configuration for an inverse problem.
namestr — Name of the inverse problem.prior_modelstr — Prior model.eventsstr | typing.Sequence[str] — List of events to consider.methodTrustRegion — Descent method to solve the inverse problem.mappingMapping — Mapping between inversion and simulation domain.preconditionerConstantSmoothing | ModelDependentSmoothing | SpaceDependentSmoothing | typing.Callable | str | None — Preconditioner used by the descent method.extra_kwargs_preconditionerdict | None — Additional keyword arguments for custom preconditioners.misfit_configurationMisfitConfiguration | str | None — The misfit configuration.wavefield_compressionWavefieldCompression | None — The compression settings for checkpoints and recomputing the forward wavefield during the adjoint run.event_batch_selectionstr | typing.Callable | None — Optional callback function for selecting a new subset of events in every new iteration.job_submissionSiteConfig | TaskChainSiteConfig | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]] | MPIExecutionConfiguration | None — Submission settings for asynchronous jobs.
event_batch_selection typing.Callable | None
event_batch_selection typing.Callable | NoneGet the event batch selection callback if available.
event_batch_selection_str str | None
event_batch_selection_str str | NoneGet 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: typing.Sequence[str]) -> None: ...Add events to the inverse problem.
eventstyping.Sequence[str] — List of event names.
add_iteration()
add_iteration()def add_iteration(
self, iteration: Iteration[UnstructuredModel], comm: int | None = None
) -> None: ...Add an interation to the inverse problem.
iterationIteration[UnstructuredModel] — Iteration.commint | None — MPI communicator, if any.
check_stopping_criteria()
check_stopping_criteria()def check_stopping_criteria(
self, iteration_id: salvus._core.types.int_ | None = None
) -> bool: ...Check if the iteration satisfies at least one of the stopping criteria are satisfied.
iteration_idsalvus._core.types.int_ | None — 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) -> 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") -> typing.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, UnstructuredModel]
) -> None: ...Define box constraints on the inversion parameters.
constraintsdict[str, UnstructuredModel] — Optional lower and upper bounds on the model parameters.
set_job_submission()
set_job_submission()def set_job_submission(
self,
job_submission: (
SiteConfig
| TaskChainSiteConfig
| dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]]
),
comm: int | None = None,
) -> None: ...Set job submission configuration for asynchronous tasks.
job_submissionSiteConfig | TaskChainSiteConfig | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]] — Either aSiteConfigor a dictionary ofSiteConfigs or with keysforward,adjointandpreconditioner. Instead of aSiteConfigit is also possible to pass a dictionary ofTaskChainSiteConfigs forforwardandadjoint.commint | None — MPI communicator, if any.
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: WavefieldCompression, comm: int | None = None
) -> None: ...Set wavefield compression settings for gradient computations.
wavefield_compressionWavefieldCompression — Wavefield compression settings.commint | None — MPI communicator, if any.
to_json()
to_json()def to_json(
self,
external_file_hash: str | None = None,
timer: Timer | None = None,
log_to_logger: bool = False,
comm: int | None = None,
) -> dict: ...Serialize the object to dictionary that can be written to JSON. Auxiliary files will be written to the specified path.
external_file_hashstr | 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.timerTimer | None — Execution timer.log_to_loggerbool — Log timings to the logger.commint | None — MPI communicator, if any.
update_iteration()
update_iteration()def update_iteration(
self, iteration: Iteration[UnstructuredModel], comm: int | None = None
) -> None: ...Update an iteration. The same iteration ID must already exist in the inverse problem.
iterationIteration[UnstructuredModel] — Iteration to update.commint | None — MPI communicator, if any.