Adjoint Sources Component

The Adjoint source component takes care of adjoint source calculation and the preparation of the adjoint sources for further usage in adjoint simulations.

Contents:

class lasif.components.adjoint_sources.AdjointSourcesComponent(folder, communicator, component_name)[source]

Component dealing with the adjoint sources.

Parameters
  • folder – The folder where the files are stored.

  • communicator – The communicator instance.

  • component_name – The name of this component for the communicator.

calculate_adjoint_sources(event: str, iteration: str, window_set_name: str, plot: bool = False, **kwargs)[source]

Calculate adjoint sources based on the type of misfit defined in the lasif config file. The computed misfit for each station is also written down into a misfit toml file.

Parameters
  • event (str) – Name of event

  • iteration (str) – Name of iteration

  • window_set_name (str) – Name of window set

  • plot (bool, optional) – Should the adjoint source be plotted?, defaults to False

calculate_adjoint_sources_multiprocessing(event: str, iteration: str, window_set_name: str, num_processes: int, plot: bool = False, **kwargs)[source]

Calculate adjoint sources based on the type of misfit defined in the lasif config file. The computed misfit for each station is also written down into a misfit toml file. This function uses multiprocessing for parallelization

Parameters
  • event (str) – Name of event

  • iteration (str) – Name of iteration

  • window_set_name (str) – Name of window set

  • num_processes (int) – The number of processes used in multiprocessing

  • plot (bool, optional) – Should the adjoint source be plotted?, defaults to False

calculate_validation_misfits(event: str, iteration: str)[source]

This fuction computed the L2 weighted waveform misfit over a whole trace. It is meant to provide misfits for validation purposes. E.g. to steer regularization parameters.

Parameters
  • event (str) – name of the event

  • iteration (str) – iteration for which to get the misfit

finalize_adjoint_sources(iteration_name: str, event_name: str, weight_set_name: Optional[str] = None)[source]

Work with adjoint source in a way that it is written down properly into an hdf5 file and prepared for being used as a source time function. The misfit values and adjoint sources are multiplied by the weight of the event and the station.

Parameters
  • iteration_name (str) – Name of iteration

  • event_name (str) – Name of event

  • weight_set_name (str, optional) – Name of station weights, defaults to None

get_filename(event: str, iteration: str)[source]

Gets the filename for the adjoint source.

Parameters
  • event (str) – The event.

  • iteration (str) – The iteration name.

get_misfit_file(iteration: str)[source]

Get path to the iteration misfit file

Parameters

iteration (str) – Name of iteration

get_misfit_for_event(event: str, iteration: str, weight_set_name: Optional[str] = None, include_station_misfit: bool = False)[source]

This function returns the total misfit for an event.

Parameters
  • event (str) – name of the event

  • iteration (str) – iteration for which to get the misfit

  • weight_set_name (str, optional) – Name of station weights, defaults to None

  • include_station_misfit (bool, optional) – Whether individual station misfits should be written down or not, defaults to False