Mondaic
This API reference is not for the latest stable Salvus version.

salvus.project.components.action.inversion.inversion_action_component

Classes

InversionActionComponent

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

Inversion specific actions, mainly to process tasks that require simulations

Parameters
  • project salvus.project.project.Project — The project for the component.
Methods
compute_gradients()
def compute_gradients(
    self,
    simulation_configuration: str,
    misfit_configuration: str,
    events: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: Optional[int] = None,
    memory_per_rank_in_MB: Optional[float] = None,
    max_events_per_job_submission: int = 0,
    wavefield_compression: Optional[
        salvus.flow.collections.wavefield_compression.WavefieldCompression
    ] = None,
    delete_dependent_jobs: bool = True,
    verbosity: int = 0,
) -> Optional[Dict[str, pathlib.Path]]:
    ...

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 Union[str, Sequence[str], salvus.flow.collections.event.Event, Sequence[salvus.flow.collections.event.Event], salvus.flow.collections.event_collection.EventCollection] — One or more events.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job Optional[int] — Wall time per job.
  • memory_per_rank_in_MB Optional[float] — 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 Optional[salvus.flow.collections.wavefield_compression.WavefieldCompression] — Wavefield compression settings.
  • delete_dependent_jobs bool — Delete job and all its dependencies at remote site after the outputs have been downloaded.
  • verbosity int — Verbosity.
Returns Optional[Dict[str, pathlib.Path]] — 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: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: Optional[int] = None,
    memory_per_rank_in_MB: Optional[float] = None,
    max_events_per_job_submission: int = 0,
    derived_job_config: Optional[
        salvus.flow.collections.wavefield_compression.WavefieldCompression
    ] = None,
    delete_dependent_jobs: bool = True,
    verbosity: int = 0,
    store_checkpoints: Optional[bool] = None,
) -> Optional[Dict[str, float]]:
    ...

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 Union[str, Sequence[str], salvus.flow.collections.event.Event, Sequence[salvus.flow.collections.event.Event], salvus.flow.collections.event_collection.EventCollection] — One or more events.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job Optional[int] — Wall time per job.
  • memory_per_rank_in_MB Optional[float] — 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 Optional[salvus.flow.collections.wavefield_compression.WavefieldCompression] — 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 Optional[bool] — Deprecated. Please use the derived_job_config parameter.
Returns Optional[Dict[str, float]] — A dictionary with the aggregated misfit from all receivers for each event.
smooth_model()
def smooth_model(
    self,
    model: Union[
        salvus.mesh.unstructured_mesh.UnstructuredMesh,
        salvus.opt.models.unstructured_model.UnstructuredModel,
    ],
    smoothing_configuration: Union[
        salvus.opt.preconditioner.ConstantSmoothing,
        salvus.opt.preconditioner.ModelDependentSmoothing,
        salvus.opt.preconditioner.SpaceDependentSmoothing,
    ],
    site_name: str,
    ranks_per_job: int,
    wall_time_in_seconds_per_job: Optional[int] = None,
    verbosity: int = 0,
    run_async: bool = False,
) -> Union[
    salvus.mesh.unstructured_mesh.UnstructuredMesh,
    salvus.flow.sites.salvus_job_array.SalvusJobArray,
]:
    ...

Smooth a model or gradient.

Parameters
  • model Union[salvus.mesh.unstructured_mesh.UnstructuredMesh, salvus.opt.models.unstructured_model.UnstructuredModel] — Input model (gradient) that should be smoothed.
  • smoothing_configuration Union[salvus.opt.preconditioner.ConstantSmoothing, salvus.opt.preconditioner.ModelDependentSmoothing, salvus.opt.preconditioner.SpaceDependentSmoothing] — Smoothing configuration.
  • site_name str — Site to use.
  • ranks_per_job int — Ranks per job.
  • wall_time_in_seconds_per_job Optional[int] — Wall time per job.
  • verbosity int — Verbosity.
  • run_async bool — Optional switch to run smoothing asynchronously. This is mainly for internal use.
Returns Union[salvus.mesh.unstructured_mesh.UnstructuredMesh, salvus.flow.sites.salvus_job_array.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: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
    wavefield_compression: Optional[
        salvus.flow.collections.wavefield_compression.WavefieldCompression
    ] = None,
) -> salvus.mesh.unstructured_mesh.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 Union[str, Sequence[str], salvus.flow.collections.event.Event, Sequence[salvus.flow.collections.event.Event], salvus.flow.collections.event_collection.EventCollection] — One or more events.
  • wavefield_compression Optional[salvus.flow.collections.wavefield_compression.WavefieldCompression] — Wavefield compression for the gradients to choose.
Returns salvus.mesh.unstructured_mesh.UnstructuredMesh — An unstructured mesh object with the summed gradient.