salvus.opt.data_normalizations
Data normalizations and their jacobians.
Functions
get_available_data_normalizations()
get_available_data_normalizations()def get_available_data_normalizations() -> typing.List[str]: ...Get a list of all available data normalizations.
Returns typing.List[str]
get_data_normalization()
get_data_normalization()def get_data_normalization(name: str) -> TraceNormalization: ...Get a built-in data normalization via its name.
Parameters
namestr — The name of the data normalization.
Returns TraceNormalization
Classes
TraceNormalization
TraceNormalizationclass TraceNormalization(
salvus.flow.utils.serialization_helpers.SerializationMixin
):
def __init__(
self,
forward: typing.Callable[
[npt.NDArray, npt.NDArray, float], tuple[npt.NDArray, npt.NDArray]
],
jacobian: typing.Callable[
[npt.NDArray, npt.NDArray, npt.NDArray, float], npt.NDArray
],
skip_validation: bool = False,
): ...A per-trace type of data normalization and its jacobian.
Parameters
forwardtyping.Callable[[npt.NDArray, npt.NDArray, float], tuple[npt.NDArray, npt.NDArray]] — Function implementing the data normalization.jacobiantyping.Callable[[npt.NDArray, npt.NDArray, npt.NDArray, float], npt.NDArray] — Function implementing the jacobian of the data normalization.skip_validationbool — By default the forward and jacobian functions will be validated with a gradient test. Set this to True to skip that test.
Methods
from_json()
from_json()def from_json(d: Dict) -> Any: ...Recreate the object from a dictionary serialization of its initialization parameters.
Parameters
dDict — Dictionary containing its init parameters and a few other things.
Returns Any
forward()
forward()def forward(
self,
data_synthetic: npt.NDArray,
data_observed: npt.NDArray,
sampling_rate_in_hertz: float,
) -> tuple[npt.NDArray, npt.NDArray]: ...Apply the forward data normalization function.
Returns the normalized synthetic and observed data traces, respectively.
Parameters
data_syntheticnpt.NDArray — The synthetic data trace without normalization.data_observednpt.NDArray — The observed data trace without normalization.sampling_rate_in_hertzfloat — The sampling rate of both data traces in Hz.
Returns tuple[npt.NDArray, npt.NDArray]
jacobian()
jacobian()def jacobian(
self,
adjoint_source: npt.NDArray,
data_synthetic: npt.NDArray,
data_observed: npt.NDArray,
sampling_rate_in_hertz: float,
) -> npt.NDArray: ...Apply the jacobian of the forward data normalization function to the adjoint source and return it.
Parameters
adjoint_sourcenpt.NDArray — The adjoint source.data_syntheticnpt.NDArray — The synthetic data trace without normalization.data_observednpt.NDArray — The observed data trace without normalization.sampling_rate_in_hertzfloat — The sampling rate of the adjoint source and data in Hz.
Returns npt.NDArray
perform_gradient_test()
perform_gradient_test()def perform_gradient_test(self) -> None: ...Perform a gradient test to validate the jacobian function.
This will test that the jacobian is the correct jacobian for the chosen forward normalization.
Returns None
to_json()
to_json()def to_json(self, external_file_hash: Optional[str] = None) -> Dict: ...Serialize the object to dictionary that can be written to JSON.
Parameters
external_file_hashOptional[str] — Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file.
Returns Dict