Version:

salvus.project.configuration.inverse_problem_configuration

salvus.project.configuration.inverse_problem_configuration salvus project configuration inverse_problem_configuration
The inverse problem configuration.

Classes

InverseProblemConfiguration

Configuration for an inverse problem.
SIGNATURE
class 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,
    ): ...
ARGUMENTS
Required
name
Type:str
Description:
Name of the inverse problem.
Required
prior_model
Type:str
Description:
Prior model.
Required
events
Type:str | typing.Sequence[str]
Description:
List of events to consider.
Required
method
Type:TrustRegion
Description:
Descent method to solve the inverse problem.
Required
mapping
Type:Mapping
Description:
Mapping between inversion and simulation domain.
Optional
preconditioner
Type:ConstantSmoothing | ModelDependentSmoothing | SpaceDependentSmoothing | typing.Callable | str | None
Default value:None
Description:
Preconditioner used by the descent method.
Optional
extra_kwargs_preconditioner
Type:dict | None
Default value:None
Description:
Additional keyword arguments for custom preconditioners.
Optional
misfit_configuration
Type:MisfitConfiguration | str | None
Default value:None
Description:
The misfit configuration.
Optional
wavefield_compression
Type:WavefieldCompression | None
Default value:None
Description:
The compression settings for checkpoints and recomputing the forward wavefield during the adjoint run.
Optional
event_batch_selection
Type:str | typing.Callable | None
Default value:None
Description:
Optional callback function for selecting a new subset of events in every new iteration.
Optional
job_submission
Type:SiteConfig | TaskChainSiteConfig | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]] | MPIExecutionConfiguration | None
Default value:None
Description:
Submission settings for asynchronous jobs.

Properties

  • event_batch_selection(typing.Callable | None)-Get the event batch selection callback if available.
  • event_batch_selection_str(str | None)-Get the event batch selection callback as string if available.

Class Methods

InverseProblemConfiguration.from_json()
Construct object from a JSON-serializable dictionary.
SIGNATURE
def from_json(
    d: dict, json_path: pathlib.Path, model_inventory_path: pathlib.Path
) -> InverseProblemConfiguration: ...
ARGUMENTS
Required
d
Type:dict
Description:
JSON dictionary of the inverse problem.
Required
json_path
Type:pathlib.Path
Description:
Path to serialized json file.
Required
model_inventory_path
Type:pathlib.Path
Description:
Path to the model inventory at the project level.

Methods

InverseProblemConfiguration.add_events()
Add events to the inverse problem.
SIGNATURE
def add_events(self, events: typing.Sequence[str]) -> None: ...
ARGUMENTS
Required
events
Type:typing.Sequence[str]
Description:
List of event names.
InverseProblemConfiguration.add_iteration()
Add an interation to the inverse problem.
SIGNATURE
def add_iteration(
    self, iteration: Iteration[UnstructuredModel], comm: int | None = None
) -> None: ...
ARGUMENTS
Required
iteration
Type:Iteration[UnstructuredModel]
Description:
Iteration.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
InverseProblemConfiguration.check_stopping_criteria()
Check if the iteration satisfies at least one of the stopping criteria are satisfied.
SIGNATURE
def check_stopping_criteria(
    self, iteration_id: salvus._core.types.int_ | None = None
) -> bool: ...
ARGUMENTS
Optional
iteration_id
Type:salvus._core.types.int_ | None
Default value:None
Description:
Iteration id.
InverseProblemConfiguration.delete_iteration()
Delete an iteration from the inverse problem.
SIGNATURE
def delete_iteration(self, id: int) -> None: ...
ARGUMENTS
Required
id
Type:int
Description:
ID of the iteration to delete.
InverseProblemConfiguration.get_all_branches()
Return a dictionary of all branches in the inversion tree. The keys are set to the tips of the branches.
SIGNATURE
def get_all_branches(self) -> dict[str, list[int]]: ...
InverseProblemConfiguration.get_branch_ids()
Obtain the ids of an inversion branch.
SIGNATURE
def get_branch_ids(self, latest: int) -> list[int]: ...
ARGUMENTS
Required
latest
Type:int
Description:
Id of the latest iteration.
InverseProblemConfiguration.get_iteration()
Obtain an iteration object from the inverse problem.
SIGNATURE
def get_iteration(self, id: int) -> Iteration: ...
ARGUMENTS
Required
id
Type:int
Description:
ID of the iteration.
InverseProblemConfiguration.get_iteration_directory()
Obtain the path where all models and gradients of this iteration are stored.
SIGNATURE
def get_iteration_directory(self, iteration_id: int) -> pathlib.Path: ...
ARGUMENTS
Required
iteration_id
Type:int
Description:
ID of the iteration.
InverseProblemConfiguration.get_iteration_ids()
Get the IDs of all iterations with a certain status.
SIGNATURE
def get_iteration_ids(self, status: str = "all") -> typing.Sequence[int]: ...
ARGUMENTS
Optional
status
Type:str
Default value:'all'
Description:
Status of the iteration.
InverseProblemConfiguration.get_new_iteration_id()
Obtain the next available iteration ID.
SIGNATURE
def get_new_iteration_id(self) -> int: ...
InverseProblemConfiguration.set_constraints()
Define box constraints on the inversion parameters.
SIGNATURE
def set_constraints(
    self, constraints: dict[str, UnstructuredModel]
) -> None: ...
ARGUMENTS
Required
constraints
Type:dict[str, UnstructuredModel]
Description:
Optional lower and upper bounds on the model parameters.
InverseProblemConfiguration.set_job_submission()
Set job submission configuration for asynchronous tasks.
SIGNATURE
def set_job_submission(
    self,
    job_submission: (
        SiteConfig
        | TaskChainSiteConfig
        | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]]
    ),
    comm: int | None = None,
) -> None: ...
ARGUMENTS
Required
job_submission
Type:SiteConfig | TaskChainSiteConfig | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]]
Description:
Either a SiteConfig or a dictionary of SiteConfigs or with keys forward, adjoint and preconditioner. Instead of a SiteConfig it is also possible to pass a dictionary of TaskChainSiteConfigs for forward and adjoint.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
InverseProblemConfiguration.set_stopping_criteria()
Set stopping criteria to limit the maximum cost of an inversion.
SIGNATURE
def set_stopping_criteria(self, criteria: dict) -> None: ...
ARGUMENTS
Required
criteria
Type:dict
Description:
Dictionary of stopping criteria. If any of them is true, no further iterations will be added. Currently supported are max_iterations for the maximum number of iterations per branch and max_iterations_global for the maximum number of iterations in the entire inversion tree.
InverseProblemConfiguration.set_wavefield_compression()
Set wavefield compression settings for gradient computations.
SIGNATURE
def set_wavefield_compression(
    self, wavefield_compression: WavefieldCompression, comm: int | None = None
) -> None: ...
ARGUMENTS
Required
wavefield_compression
Type:WavefieldCompression
Description:
Wavefield compression settings.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
InverseProblemConfiguration.to_json()
Serialize the object to dictionary that can be written to JSON. Auxiliary files will be written to the specified path.
SIGNATURE
def to_json(
    self,
    external_file_hash: str | None = None,
    timer: Timer | None = None,
    log_to_logger: bool = False,
    comm: int | None = None,
) -> dict: ...
ARGUMENTS
Optional
external_file_hash
Type:str | None
Default value:None
Description:
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.
Optional
timer
Type:Timer | None
Default value:None
Description:
Execution timer.
Optional
log_to_logger
Type:bool
Default value:False
Description:
Log timings to the logger.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
InverseProblemConfiguration.update_iteration()
Update an iteration. The same iteration ID must already exist in the inverse problem.
SIGNATURE
def update_iteration(
    self, iteration: Iteration[UnstructuredModel], comm: int | None = None
) -> None: ...
ARGUMENTS
Required
iteration
Type:Iteration[UnstructuredModel]
Description:
Iteration to update.
Optional
comm
Type:int | None
Default value:None
Description:
MPI communicator, if any.
PAGE CONTENTS