Version:

salvus.project.components.misfit_component

salvus.project.components.misfit_component salvus project components misfit_component
The misfit component.

Classes

MisfitComponent

Project subclass handling all things related to misfits and gradients.
SIGNATURE
class MisfitComponent(builtins.object):
    def __init__(self, project: salvus.project.project.Project): ...
ARGUMENTS
Required
project
Type:salvus.project.project.Project
Description:
The project to attach the waveform component to.

Methods

MisfitComponent.compute_adjoint_source()
Compute adjoint sources and store them in the project cache for a given simulation configuration, misfit configuration and a list of events.
As a by-product, the misfit value will be added to the internal MisfitStore.
SIGNATURE
def compute_adjoint_source(
    self,
    simulation_configuration: str | _SimulationConfigurationBase,
    misfit_configuration: str | MisfitConfiguration,
    events: (
        str
        | typing.Sequence[str]
        | Event
        | typing.Sequence[Event]
        | EventCollection
    ),
) -> None: ...
ARGUMENTS
Required
simulation_configuration
Type:str | _SimulationConfigurationBase
Description:
Name of the simulation configuration for the forward run.
Required
misfit_configuration
Type:str | MisfitConfiguration
Description:
The name of the misfit configuration.
Required
events
Type:str | typing.Sequence[str] | Event | typing.Sequence[Event] | EventCollection
Description:
One or more events.
MisfitComponent.get()
Get a misfit dictionary for a given simulation configuration, misfit configuration and a list of events.
SIGNATURE
def get(
    self,
    simulation_configuration: str | SimulationConfiguration,
    misfit_configuration: str | MisfitConfiguration,
    events: (
        str
        | typing.Sequence[str]
        | Event
        | typing.Sequence[Event]
        | EventCollection
    ),
    skip_writing_adjoint_source: bool | None = False,
) -> dict[str, float]: ...
ARGUMENTS
Required
simulation_configuration
Type:str | SimulationConfiguration
Description:
Name of the simulation configuration for the forward run.
Required
misfit_configuration
Type:str | MisfitConfiguration
Description:
The name of the misfit configuration.
Required
events
Type:str | typing.Sequence[str] | Event | typing.Sequence[Event] | EventCollection
Description:
One or more events.
Optional
skip_writing_adjoint_source
Type:bool | None
Default value:False
Description:
Optionally skip writing the adjoint source file.
MisfitComponent.get_event_misfit_object()
Return the internally used EventMisfit object. Once you have this you are free to whatever you want but you are breaking out of the project and SalvusProject does no longer know what you are doing.
SIGNATURE
def get_event_misfit_object(
    self,
    simulation_configuration: str,
    misfit_configuration: str | MisfitConfiguration,
    event: Event | str,
) -> EventMisfit: ...
ARGUMENTS
Required
simulation_configuration
Type:str
Description:
Name of the simulation configuration for the forward run.
Required
misfit_configuration
Type:str | MisfitConfiguration
Description:
Name of the misfit configuration.
Required
event
Type:Event | str
Description:
The event to use.
MisfitComponent.get_gradient_filenames()
Get the paths to the gradient HDF5 and XDMF files.
SIGNATURE
def get_gradient_filenames(
    self,
    simulation_configuration: str | SimulationConfiguration,
    misfit_configuration: str | MisfitConfiguration,
    event: str | Event,
    wavefield_compression: WavefieldCompression,
    gradient_parameters: set[str] | None = None,
) -> dict[str, pathlib.Path]: ...
ARGUMENTS
Required
simulation_configuration
Type:str | SimulationConfiguration
Description:
Simulation configuration for the forward run.
Required
misfit_configuration
Type:str | MisfitConfiguration
Description:
The name of the misfit configuration.
Required
event
Type:str | Event
Description:
The event for which to get the gradient filenames.
Required
wavefield_compression
Type:WavefieldCompression
Description:
Wavefield compression settings.
Optional
gradient_parameters
Type:set[str] | None
Default value:None
Description:
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.
MisfitComponent.get_misfit_comparison_table()
Return a pandas DataFrame comparing the misfits for different simulation configurations per receiver. The final will contains the misfit values per receiver for each passed simulation configuration as well as the absolute reduction for each with respect to the reference.
SIGNATURE
def get_misfit_comparison_table(
    self,
    reference_data: str,
    other_data: builtins.list[str] | None = None,
    misfit_configuration: str,
    event: str | Event,
    shorten_names: bool = False,
) -> pd.DataFrame: ...
ARGUMENTS
Required
reference_data
Type:str
Description:
The simulation configuration name for the baseline misfit.
Optional
other_data
Type:builtins.list[str] | None
Default value:None
Description:
One or more other simulation configurations whose misfits will be compared against the reference.
Required
misfit_configuration
Type:str
Description:
The misfit configuration.
Required
event
Type:str | Event
Description:
The event to do it for.
Optional
shorten_names
Type:bool
Default value:False
Description:
If True, the names of all columns will be shortened so they are as short as possible while still being unique.
MisfitComponent.list()
Get a list of all misfit configurations.
SIGNATURE
def list(self) -> list[str]: ...
PAGE CONTENTS