salvus.project.components.misfit_component
Classes
MisfitComponent
MisfitComponentclass MisfitComponent(builtins.object):
def __init__(self, project: salvus.project.project.Project):
...Project subclass handling all things related to misfits and gradients.
projectsalvus.project.project.Project — The project to attach the waveform component to.
compute_adjoint_source()
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.
simulation_configurationUnion[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Name of the simulation configuration for the forward run.misfit_configurationUnion[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The name of the misfit configuration.eventsUnion[str, Sequence[str], salvus.flow.collections.event.Event, Sequence[salvus.flow.collections.event.Event], salvus.flow.collections.event_collection.EventCollection] — One or more events.
get()
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.
simulation_configurationUnion[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Name of the simulation configuration for the forward run.misfit_configurationUnion[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The name of the misfit configuration.eventsUnion[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_sourceOptional[bool] — Optionally skip writing the adjoint source file.
get_event_misfit_object()
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.
simulation_configurationstr — Name of the simulation configuration for the forward run.misfit_configurationUnion[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — Name of the misfit configuration.eventUnion[salvus.flow.collections.event.Event, str] — The event to use.
get_gradient_filenames()
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.
simulation_configurationUnion[str, salvus.project.configuration.simulation_configuration.SimulationConfiguration] — Simulation configuration for the forward run.misfit_configurationUnion[str, salvus.project.configuration.misfit_configuration.MisfitConfiguration] — The name of the misfit configuration.eventUnion[str, salvus.flow.collections.event.Event] — The event for which to get the gradient filenames.wavefield_compressionsalvus.flow.collections.wavefield_compression.WavefieldCompression — Wavefield compression settings.
"xdmf_filename" and "hdf5_filename". The values are the respective file paths.get_misfit_comparison_table()
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.
reference_datastr — The simulation configuration name for the baseline misfit.other_dataOptional[List[str]] — One or more other simulation configurations whose misfits will be compared against the reference.misfit_configurationstr — The misfit configuration.eventUnion[str, salvus.flow.collections.event.Event] — The event to do it for.shorten_namesbool — If True, the names of all columns will be shortened so they are as short as possible while still being unique.
list()
list()def list(self) -> List[str]:
...Get a list of all misfit configurations.