Mondaic

salvus.project.components.action.inversion.inversion_action_component

salvus.project.components.action.inversion.inversion_action_component salvus project components action inversion inversion_action_component

Inversion action component.

Classes

InversionActionComponent

class InversionActionComponent(builtins.object):
    def __init__(self, project: Project): ...

Inversion specific actions, mainly to process tasks that require simulations.

Parameters
  • project Project — The project for the component.
Methods
compute_gradients()
def compute_gradients(
    self,
    simulation_configuration: str,
    misfit_configuration: str,
    events: str | list[str] | Event | list[Event] | EventCollection,
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
    memory_per_rank_in_MB: float | None = None,
    max_events_per_job_submission: int = 0,
    wavefield_compression: WavefieldCompression | None = None,
    gradient_parameters: set[str] | None = None,
    delete_dependent_jobs: bool = True,
    verbosity: int = 0,
) -> dict[str, pathlib.Path] | None: ...

Compute event gradients for a given simulation configuration, misfit configuration.

Parameters
  • simulation_configuration str — Name of the simulation configuration for the forward run.
  • misfit_configuration str — Name of the misfit configuration.
  • events str | list[str] | Event | list[Event] | EventCollection — One or more events.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — Wall time per job.
  • memory_per_rank_in_MB float | None — Optional memory settings for the site.
  • max_events_per_job_submission int — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.
  • wavefield_compression WavefieldCompression | None — Wavefield compression settings.
  • gradient_parameters set[str] | None — Model parameters to compute the gradients for. Must be a subset of the model parameters. If not given, gradients will be computed for all model fields.
  • delete_dependent_jobs bool — Delete job and all its dependencies at remote site after the outputs have been downloaded.
  • verbosity int — Verbosity.
Returns dict[str, pathlib.Path] | None — A dictionary with the path to the gradient file for each event.
compute_misfits()
def compute_misfits(
    self,
    simulation_configuration: str,
    misfit_configuration: str,
    events: str | list[str] | Event | list[Event] | EventCollection,
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
    memory_per_rank_in_MB: float | None = None,
    max_events_per_job_submission: int = 0,
    derived_job_config: WavefieldCompression | None = None,
    delete_dependent_jobs: bool = True,
    verbosity: int = 0,
    store_checkpoints: bool | None = None,
) -> dict[str, float] | None: ...

Compute event misfits for a given simulation configuration, misfit configuration.

Parameters
  • simulation_configuration str — Name of the simulation configuration for the forward run.
  • misfit_configuration str — Name of the misfit configuration.
  • events str | list[str] | Event | list[Event] | EventCollection — One or more events.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — Wall time per job.
  • memory_per_rank_in_MB float | None — Optional memory settings for the site.
  • max_events_per_job_submission int — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.
  • derived_job_config WavefieldCompression | None — Options that have an effect on the output of subsequent simulations but must already be known now. Currently allows the specification of some techniques to compress wavefields for the purpose of gradient computations.
  • delete_dependent_jobs bool — Delete job and all its dependencies at remote site after the outputs have been downloaded.
  • verbosity int — Verbosity.
  • store_checkpoints bool | None — Deprecated. Please use the derived_job_config parameter.
Returns dict[str, float] | None — A dictionary with the aggregated misfit from all receivers for each event.
smooth_model()
def smooth_model(
    self,
    model: UnstructuredMesh | UnstructuredModel,
    smoothing_configuration: (
        ConstantSmoothing | ModelDependentSmoothing | SpaceDependentSmoothing
    ),
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: salvus._core.types.float_ | None = None,
    verbosity: int = 0,
    run_async: bool = False,
) -> UnstructuredMesh | SalvusJobArray: ...

Smooth a model or gradient.

Parameters
  • model UnstructuredMesh | UnstructuredModel — Input model (gradient) that should be smoothed.
  • smoothing_configuration ConstantSmoothing | ModelDependentSmoothing | SpaceDependentSmoothing — Smoothing configuration.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job salvus._core.types.float_ | None — Wall time per job.
  • verbosity int — Verbosity.
  • run_async bool — Optional switch to run smoothing asynchronously. This is mainly for internal use.
Returns UnstructuredMesh | SalvusJobArray — The smoothed model (gradient) as UnstructuredMesh object or - in case of running asynchronously - a SalvusJobarray of the smoothing job.
sum_gradients()
def sum_gradients(
    self,
    simulation_configuration: str,
    misfit_configuration: str,
    events: str | list[str] | Event | list[Event] | EventCollection,
    wavefield_compression: WavefieldCompression | None = None,
    gradient_parameters: set[str] | None = None,
) -> UnstructuredMesh: ...

Compute the sum of all gradients for a list of events. The function will raise if the gradients have not been computed yet for the given combination of simulation_configuration, misfit_configuration and events.

Parameters
  • simulation_configuration str — Name of the simulation configuration for the forward run.
  • misfit_configuration str — Name of the misfit configuration.
  • events str | list[str] | Event | list[Event] | EventCollection — One or more events.
  • wavefield_compression WavefieldCompression | None — Wavefield compression for the gradients to choose.
  • gradient_parameters set[str] | None — Model parameters to compute the gradients for. Must be a subset of the model parameters. If not given, gradients will be computed for all model fields.
Returns UnstructuredMesh — An unstructured mesh object with the summed gradient.

Used in tutorials