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

salvus.project.components.misfit_component

Classes

MisfitComponent

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

Project subclass handling all things related to misfits and gradients.

Parameters
  • project salvus.project.project.Project — The project to attach the waveform component to.
Methods
compute_adjoint_source()
def compute_adjoint_source(
    self,
    simulation_configuration: Union[
        str,
        salvus.project.configuration.simulation_configuration.SimulationConfiguration,
    ],
    misfit_configuration: Union[
        str,
        salvus.project.configuration.misfit_configuration.MisfitConfiguration,
    ],
    events: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
) -> None:
    ...

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.

Parameters
  • simulation_configuration Union[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Name of the simulation configuration for the forward run.
  • misfit_configuration Union[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The 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.
Returns None
get()
def get(
    self,
    simulation_configuration: Union[
        str,
        salvus.project.configuration.simulation_configuration.SimulationConfiguration,
    ],
    misfit_configuration: Union[
        str,
        salvus.project.configuration.misfit_configuration.MisfitConfiguration,
    ],
    events: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
    skip_writing_adjoint_source: Optional[bool] = False,
) -> Dict[str, float]:
    ...

Get a misfit dictionary for a given simulation configuration, misfit configuration and a list of events.

Parameters
  • simulation_configuration Union[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Name of the simulation configuration for the forward run.
  • misfit_configuration Union[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The 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.
  • skip_writing_adjoint_source Optional[bool] — Optionally skip writing the adjoint source file.
Returns Dict[str, float]
get_event_misfit_object()
def get_event_misfit_object(
    self,
    simulation_configuration: str,
    misfit_configuration: Union[
        str,
        salvus.project.configuration.misfit_configuration.MisfitConfiguration,
    ],
    event: Union[salvus.flow.collections.event.Event, str],
) -> salvus.flow.collections.event_misfit.EventMisfit:
    ...

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.

Parameters
  • simulation_configuration str — Name of the simulation configuration for the forward run.
  • misfit_configuration Union[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — Name of the misfit configuration.
  • event Union[salvus.flow.collections.event.Event, str] — The event to use.
Returns salvus.flow.collections.event_misfit.EventMisfit
get_gradient_filenames()
def get_gradient_filenames(
    self,
    simulation_configuration: Union[
        str,
        salvus.project.configuration.simulation_configuration.SimulationConfiguration,
    ],
    misfit_configuration: Union[
        str,
        salvus.project.configuration.misfit_configuration.MisfitConfiguration,
    ],
    event: Union[str, salvus.flow.collections.event.Event],
    wavefield_compression: salvus.flow.collections.wavefield_compression.WavefieldCompression,
) -> Dict[str, pathlib.Path]:
    ...

Get the paths to the gradient HDF5 and XDMF files.

Parameters
  • simulation_configuration Union[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Simulation configuration for the forward run.
  • misfit_configuration Union[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The name of the misfit configuration.
  • event Union[str, salvus.flow.collections.event.Event] — The event for which to get the gradient filenames.
  • wavefield_compression salvus.flow.collections.wavefield_compression.WavefieldCompression — Wavefield compression settings.
Returns Dict[str, pathlib.Path] — A dictionary with two keys: "xdmf_filename" and "hdf5_filename". The values are the respective file paths.
get_misfit_comparison_table()
def get_misfit_comparison_table(
    self,
    reference_data: str,
    other_data: Optional[List[str]] = None,
    misfit_configuration: str,
    event: Union[str, salvus.flow.collections.event.Event],
    shorten_names: bool = False,
) -> pandas.core.frame.DataFrame:
    ...

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.

Parameters
  • reference_data str — The simulation configuration name for the baseline misfit.
  • other_data Optional[List[str]] — One or more other simulation configurations whose misfits will be compared against the reference.
  • misfit_configuration str — The misfit configuration.
  • event Union[str, salvus.flow.collections.event.Event] — The event to do it for.
  • shorten_names bool — If True, the names of all columns will be shortened so they are as short as possible while still being unique.
Returns pandas.core.frame.DataFrame
list()
def list(self) -> List[str]:
    ...

Get a list of all misfit configurations.

Returns List[str]