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
InversionActionComponentclass InversionActionComponent(builtins.object):
def __init__(self, project: Project): ...Inversion specific actions, mainly to process tasks that require simulations.
Parameters
projectProject — The project for the component.
Methods
compute_gradients()
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_configurationstr — Name of the simulation configuration for the forward run.misfit_configurationstr — Name of the misfit configuration.eventsstr | list[str] | Event | list[Event] | EventCollection — One or more events.site_namestr — Site to use.ranks_per_jobint — Ranks per job.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — Wall time per job.memory_per_rank_in_MBfloat | None — Optional memory settings for the site.max_events_per_job_submissionint — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.wavefield_compressionWavefieldCompression | None — Wavefield compression settings.gradient_parametersset[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_jobsbool — Delete job and all its dependencies at remote site after the outputs have been downloaded.verbosityint — Verbosity.
Returns dict[str, pathlib.Path] | None — A dictionary with the path to the gradient file for each event.
compute_misfits()
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_configurationstr — Name of the simulation configuration for the forward run.misfit_configurationstr — Name of the misfit configuration.eventsstr | list[str] | Event | list[Event] | EventCollection — One or more events.site_namestr — Site to use.ranks_per_jobint — Ranks per job.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — Wall time per job.memory_per_rank_in_MBfloat | None — Optional memory settings for the site.max_events_per_job_submissionint — Optional chunkwise job submission. If set to a positive number, simulations will be launched in chunks.derived_job_configWavefieldCompression | 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_jobsbool — Delete job and all its dependencies at remote site after the outputs have been downloaded.verbosityint — Verbosity.store_checkpointsbool | None — Deprecated. Please use thederived_job_configparameter.
Returns dict[str, float] | None — A dictionary with the aggregated misfit from all receivers for each event.
smooth_model()
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
modelUnstructuredMesh | UnstructuredModel — Input model (gradient) that should be smoothed.smoothing_configurationConstantSmoothing | ModelDependentSmoothing | SpaceDependentSmoothing — Smoothing configuration.site_namestr — Site to use.ranks_per_jobint — Ranks per job.wall_time_in_seconds_per_jobsalvus._core.types.float_ | None — Wall time per job.verbosityint — Verbosity.run_asyncbool — 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()
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_configurationstr — Name of the simulation configuration for the forward run.misfit_configurationstr — Name of the misfit configuration.eventsstr | list[str] | Event | list[Event] | EventCollection — One or more events.wavefield_compressionWavefieldCompression | None — Wavefield compression for the gradients to choose.gradient_parametersset[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.