Mondaic

salvus.project.configuration.processing

salvus.project.configuration.processing salvus project configuration processing

Processing configurations.

Classes

ProcessingConfiguration

class ProcessingConfiguration(
    salvus.flow.utils.serialization_helpers.SerializationMixin
):
    def __init__(
        self,
        name: str,
        data_source_name: str,
        processing_function: str | typing.Callable,
    ): ...

Keeps track of the initial arguments passed to an objects and can later on serialize them to JSON document.

It will only consider whatever is passed in the init.

Define processing within SalvusProject with a function. Any function with a suitable signature is acceptable.

For block processing, the function must take the following arguments:

  • data_array: An xarray.DataArray object with the data.
  • event: The corresponding event.

Or, if the processing should be applied per receiver:

  • st: An obspy.Stream object with the data.
  • receiver: The receiver object for the receiver.
  • sources: All sources for the event.

In the case of seismological data it can also optionally take:

  • inv: An obspy.Inventory object for the station in case it is stored in an ASDF file. Might be None.

The function must return the processed xarray.DataArray or obspy.Stream object which must contain exactly the same number of traces.

Parameters
  • name str — Name of the processing configuration.
  • data_source_name str — Name of the original data source.
  • processing_function str | typing.Callable — The actual function.
Methods
from_json()
def from_json(d: builtins.dict) -> Any: ...

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

Parameters
  • d builtins.dict — Dictionary containing its init parameters and a few other things.
Returns Any
to_json()
def to_json(
    self,
    external_file_hash: str | None = None,
    timer: Timer | None = None,
    log_to_logger: bool = False,
    comm: int | None = None,
) -> dict: ...

Convert object to a JSON-serializable dictionary.

Parameters
  • external_file_hash str | None — 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.
  • timer Timer | None — Execution timer.
  • log_to_logger bool — Log timings to the logger.
  • comm int | None — MPI communicator, if any.
Returns dict

Submodules

Used in tutorials