Optional
observed_event| Type: | EventData | None |
| Default value: | None |
| Description: | The observed data. Optional because certain types of misfits can be computed without observed data. In that case the misfit function must also not take observed data. |
class EventMisfit(builtins.object):
def __init__(
self,
observed_event: EventData | None = None,
synthetic_event: EventData,
misfit_function: str | dict[str, str | int] | typing.Callable,
extra_kwargs_misfit_function: dict | None = None,
receiver_field: str,
max_samples_for_misfit_computation: int | None = None,
normalization: (
str
| data_normalizations.Normalization
| data_normalizations.TraceNormalization
| None
) = None,
): ...| Type: | EventData | None |
| Default value: | None |
| Description: | The observed data. Optional because certain types of misfits can be computed without observed data. In that case the misfit function must also not take observed data. |
| Type: | EventData |
| Description: | The synthetic data. |
| Type: | str | dict[str, str | int] | typing.Callable |
| Description: | The misfit function or name of the function. Can be one of three things: 1. The of one of Salvus' built-in misfit functions. In that case the latest available version will be chosen. 2. A dictionary of the form {"misfit_name": "L2", "version": 1} to directly select a specific version of a built-in misfit function. 3. A custom function that computes misfits and adjoint sources. |
| Type: | dict | None |
| Default value: | None |
| Description: | Extra arguments passed on to the misfit function. |
| Type: | str |
| Description: | The receiver field to consider for the misfit computation. |
| Type: | int | None |
| Default value: | None |
| Description: | If given, and if the number of samples in the data for the misfit and adjoint source computation is larger than the given number, synthetic and observed data will be downsampled to the chosen number of samples and the adjoint source will later be upsampled again. Very useful for some expensive to compute misfits with strongly oversampled signals. The adjoint source will be correctly scaled at the end. This does result in the adjoint source no longer being the exact discrete derivative of the misfit but in most cases this should not be a problem. |
| Type: | str | data_normalizations.Normalization | data_normalizations.TraceNormalization | None |
| Default value: | None |
| Description: | If given, normalize the observed and synthetic traces prior to misfit and adjoint source computations. This will be accounted for during the computation of the derivatives to ensure consistency. Useful for some problems but it does make them a bit more non-linear. Available choices: * "l2_energy_per_measurement": Normalize each trace by the L2-norm of the weighted trace. |
str)-Name of the misfit object's events.dict[str, dict])-Cached dictionary mapping receiver names to their contents for the
meta json - naturally only exists for synthetic data.xr.DataArray)-Return the misfit per receiver and component and weight set.dict)-Return the misfit per receiver and component and weight set.float)-Cumulative misfit for the whole event.list[str])-Return a list of receivers for the misfit object.
This will always be the receivers of the synthetic data.def clear_caches(self) -> None: ...create_adjoint_waveform_simulation from the module
salvus.flow.simple_config.simulation_generator instead.def generate_adjoint_simulation_object(
self, gradient_parameterization: str
) -> Waveform: ...| Type: | str |
| Description: | Desired gradient parameters. |
def get_misfit_and_adjoint_source_for_event(
self, extra_output: ExtraOutput | None = None
) -> tuple[xr.Dataset, xr.DataArray] | None: ...| Type: | ExtraOutput | None |
| Default value: | None |
| Description: | Optional configuration of extra outputs. |
None in case no observed data is available or the
receiver has been fully deselected via temporal weights.def get_misfit_and_adjoint_source_for_receiver(
self, receiver_name: str, plot: bool = False
) -> xr.Dataset | None: ...| Type: | str |
| Description: | The name of the receiver or receiver channel. |
| Type: | bool |
| Default value: | False |
| Description: | Plot the adjoint source. |
def write(
self,
filename: pathlib.Path,
group_name: str = "adjoint_sources",
hdf5_file_open_mode: str = "w",
extra_output: ExtraOutput | None = None,
) -> None: ...| Type: | pathlib.Path |
| Description: | File to write to. |
| Type: | str |
| Default value: | 'adjoint_sources' |
| Description: | The group in the HDF5 file in which to create the adjoint sources. This later on needs to be specified when passing the adjoint source to Salvus. The default is fine in most cases, setting the group name enables more advanced use cases. |
| Type: | str |
| Default value: | 'w' |
| Description: | Mode in which h5py will open the file. Useful for advanced use cases to store different sets of adjoint sources in the HDF5 file. |
| Type: | ExtraOutput | None |
| Default value: | None |
| Description: | Optional configuration of extra outputs. |