Required
project| Type: | Project |
| Description: | The project for the component. |
class InversionComponent(builtins.object):
def __init__(self, project: Project): ...| Type: | Project |
| Description: | The project for the component. |
def add_events(
self,
inverse_problem_configuration: str,
events: str | typing.Sequence[str],
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | str | typing.Sequence[str] |
| Description: | Event name or list of event names. |
def add_iteration(
self,
inverse_problem_configuration: str,
model: str | None = None,
events: typing.Sequence[str] | None = None,
control_group_events: typing.Sequence[str] | None = None,
misfit_configuration: str | None = None,
parent_id: int | None = None,
comm: int | None = None,
timer: Timer | None = None,
log_to_logger: bool = False,
) -> bool: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | str | None |
| Default value: | None |
| Description: | The model of the iteration. If not provided either the final model from the parent iteration or the prior model of the inverse problem is used. |
| Type: | typing.Sequence[str] | None |
| Default value: | None |
| Description: | Iteration-specific event selection. |
| Type: | typing.Sequence[str] | None |
| Default value: | None |
| Description: | Iteration-specific control group. |
| Type: | str | None |
| Default value: | None |
| Description: | Name of the misfit configuration. |
| Type: | int | None |
| Default value: | None |
| Description: | Id of the parent iteration that this iteration should be derived from. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator for distributed operations, if applicable. |
| Type: | Timer | None |
| Default value: | None |
| Description: | Execution timer. |
| Type: | bool |
| Default value: | False |
| Description: | Log timings to logger. |
def delete(self, inverse_problem_name: str) -> None: ...| Type: | str |
| Description: | The inverse problem to be deleted. |
def delete_disposable_files(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
iteration_id: int | None = None,
data_to_remove: str | typing.Sequence[str] = "auxiliary",
keep_data_from_first_iteration: bool = True,
keep_data_from_unfinished_iterations: bool = True,
comm: int | None = None,
) -> None: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | int | None |
| Default value: | None |
| Description: | Optional iteration ID. If not specified, disposable files from all finished iterations except the initial model will be deleted. |
| Type: | str | typing.Sequence[str] |
| Default value: | 'auxiliary' |
| Description: | Specify which data to delete. Can be either all for all that can be recomputed, or any combination of auxiliary, waveforms, and gradients. Note that waveforms are cheaper to recompute than gradients and should be deleted second after auxiliary files. |
| Type: | bool |
| Default value: | True |
| Description: | Option to also remove data from iterations without a parent id. If True, the files of the initial iteration will be kept. |
| Type: | bool |
| Default value: | True |
| Description: | Option to also remove data from unfinished iterations, including the current one. Running this function with False is recommended when finishing an inversion. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator, if any. |
def delete_iteration(
self, inverse_problem_configuration: str, id: int
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | int |
| Description: | Id of the iteration to be deleted. |
def get_iteration(
self, inverse_problem_configuration: str, iteration_id: int
) -> Iteration: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | int |
| Description: | Iteration ID. |
def get_iteration_directory(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
iteration_id: int,
) -> pathlib.Path: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | int |
| Description: | Iteration ID. |
misfit_type. It supports filtering by specific inversions and
events.combine_event_misfits is True and no events are found for an
inversion, and empty list is returned as the misfit array for that
inversion. If combine_event_misfits is False, empty dictionaries
will be returned per inversion for which no events are found.def get_misfits(
self,
inversions: typing.Sequence[str] | None = None,
combine_event_misfits: bool = False,
events: typing.Sequence[str] | None = None,
misfit_type: typing.Literal[
"absolute", "relative", "iteration_relative"
] = "absolute",
) -> dict[str, npt.NDArray] | dict[str, dict[str, npt.NDArray]]: ...| Type: | typing.Sequence[str] | None |
| Default value: | None |
| Description: | An optional sequence of inversion problem identifiers. If None, misfits for all inversions are retrieved. |
| Type: | bool |
| Default value: | False |
| Description: | A flag indicating whether to aggregate misfits across events. If True, misfits for each inversion are combined into a single value per inversion; otherwise, misfits are returned per event per inversion. This will raise a ValueError if used in conjuction with iteration-dependent event selections. |
| Type: | typing.Sequence[str] | None |
| Default value: | None |
| Description: | An optional sequence of event identifiers. If None, misfits for all events are retrieved. |
| Type: | typing.Literal['absolute', 'relative', 'iteration_relative'] |
| Default value: | 'absolute' |
| Description: | Specifies the type of misfit calculation. Can be 'absolute', 'relative', or 'iteration_relative'. |
def get_model(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
iteration_id: int,
) -> UnstructuredMesh: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | int |
| Description: | Iteration ID. |
def get_simulation_name(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
iteration_id: int,
) -> str: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | int |
| Description: | Iteration ID. |
def iterate(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
timeout_in_seconds: salvus._core.types.float_,
ping_interval_in_seconds: salvus._core.types.float_ | None = None,
iteration_ids: str | int | builtins.list[int] = "latest",
delete_disposable_files: str | builtins.list[str] | None = None,
timer: Timer | None = None,
verbosity: int = 1,
comm: int | None = None,
log_to_logger: bool = False,
) -> None: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | salvus._core.types.float_ |
| Description: | Maximum time spent after which the function returns even if the iteration has not been completed yet. |
| Type: | salvus._core.types.float_ | None |
| Default value: | None |
| Description: | Ping interval to check for updated on the simulations. |
| Type: | str | int | builtins.list[int] |
| Default value: | 'latest' |
| Description: | List of iteration IDs to be processed. Alternatively, the key words latest (default, use only the latest iteration) or all (use all running iterations) can be provided. |
| Type: | str | builtins.list[str] | None |
| Default value: | None |
| Description: | Optional cleanup stage when finalizing the iteration. Possible choices are all, or any combination of auxiliary, checkpoints, waveforms, and gradients. |
| Type: | Timer | None |
| Default value: | None |
| Description: | Execution timer. |
| Type: | int |
| Default value: | 1 |
| Description: | Verbosity level. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator, if any. |
| Type: | bool |
| Default value: | False |
| Description: | Whether to log timing information to the logger. |
def list(self) -> list[str]: ...def resume(
self,
inverse_problem_configuration: str | InverseProblemConfiguration,
iteration_ids: str | int | builtins.list[int] = "latest",
verbosity: int = 2,
timer: Timer | None = None,
comm: int | None = None,
log_to_logger: bool = False,
) -> bool: ...| Type: | str | InverseProblemConfiguration |
| Description: | The inverse problem. |
| Type: | str | int | builtins.list[int] |
| Default value: | 'latest' |
| Description: | List of iteration IDs to be processed. If not provided, all running iterations will be considered. |
| Type: | int |
| Default value: | 2 |
| Description: | Verbosity level. |
| Type: | Timer | None |
| Default value: | None |
| Description: | Execution timer. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator, if any. |
| Type: | bool |
| Default value: | False |
| Description: | Whether to log timing information to the logger. |
def set_constraints(
self, inverse_problem_configuration: str, constraints: dict
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | dict |
| Description: | Dictionary of constraints. Currently supported are pointwise lower and/or upper bounds on the inversion parameters. |
def set_job_submission_configuration(
self,
inverse_problem_configuration: str,
job_submission: (
SiteConfig
| TaskChainSiteConfig
| dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]]
| MPIExecutionConfiguration
),
comm: int | None = None,
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | SiteConfig | TaskChainSiteConfig | dict[str, SiteConfig | bool | dict[str, TaskChainSiteConfig]] | MPIExecutionConfiguration |
| Description: | Either a SiteConfig or a dictionary of SiteConfigs with keys forward, adjoint, and preconditioner. Alternatively it could be a TaskChainSiteConfig object or a dictionary of dictionaries with many task chain configurations on remote sites. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator, if any. |
def set_stopping_criteria(
self, inverse_problem_configuration: str, criteria: dict
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| 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. |
def set_wavefield_compression(
self,
inverse_problem_configuration: str,
wavefield_compression: WavefieldCompression,
) -> None: ...| Type: | str |
| Description: | The inverse problem. |
| Type: | WavefieldCompression |
| Description: | Wavefield compression settings. |