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

salvus.opt.data_normalizations

Data normalizations and their jacobians.

Functions

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()

def get_data_normalization(name: str) -> TraceNormalization: ...

Get a built-in data normalization via its name.

Parameters
  • name str — The name of the data normalization.
Returns TraceNormalization

Classes

TraceNormalization

class 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
  • forward typing.Callable[[npt.NDArray, npt.NDArray, float], tuple[npt.NDArray, npt.NDArray]] — Function implementing the data normalization.
  • jacobian typing.Callable[[npt.NDArray, npt.NDArray, npt.NDArray, float], npt.NDArray] — Function implementing the jacobian of the data normalization.
  • skip_validation bool — 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()
def from_json(d: Dict) -> Any: ...

Recreate the object from a dictionary serialization of its initialization parameters.

Parameters
  • d Dict — Dictionary containing its init parameters and a few other things.
Returns Any
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_synthetic npt.NDArray — The synthetic data trace without normalization.
  • data_observed npt.NDArray — The observed data trace without normalization.
  • sampling_rate_in_hertz float — The sampling rate of both data traces in Hz.
Returns tuple[npt.NDArray, npt.NDArray]
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_source npt.NDArray — The adjoint source.
  • data_synthetic npt.NDArray — The synthetic data trace without normalization.
  • data_observed npt.NDArray — The observed data trace without normalization.
  • sampling_rate_in_hertz float — The sampling rate of the adjoint source and data in Hz.
Returns npt.NDArray
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()
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_hash Optional[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

Submodules