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

salvus.project.components.waveform_component

Classes

WaveformComponent

class WaveformComponent(builtins.object):
    def __init__(self, project: salvus.project.Project):
        ...

Project subclass handling all things related to waveforms.

SalvusProject refers to waveform data by data type (or namespace if you will) and name within that data type. Everything before the colon is the data type, everything after it the name, e.g. DATA_TYPE:NAME. The NAME part is a user defined string. If no data type/namespace is given it will default to SYNTHETIC_DATA.

SalvusProject distinguishes three data types:

  • SYNTHETIC_DATA: Synthetically computed waveforms. These are always computed within the project structure.
  • EXTERNAL_DATA: Observed or externally computed waveform data.
  • PROCESSED_DATA: Any processed data. The data can originate from synthetic, external or even other processed data but a function sits in between that processed the data in some fashion.

Examples include simulation_5Hz (or equivalently SYNTHETIC_DATA:simulation_5Hz), EXTERNAL_DATA:raw_observed, PROCESSED_DATA:observed_highpass_5Hz, and so on.

Processing fragments are furthermore available to easy application of simple and common processing techniques.

To for example bandpass and normalize some data observed raw data use "EXTERNAL_DATA:raw_data | bandpass(1.0, 2.0) | normalize" as the data name. We recommend to use this largely for exploratory purposes and turn them into a proper processing function for longer-term uses.

Available processing fragments:

  • time_shift({SHIFT})
  • normalize
  • scale({FACTOR})
  • flip
  • bandpass({FREQ_MIN}, {FREQ_MAX}[, zerophase][, corners={CORNERS}])
Parameters
  • project salvus.project.Project — The project to attach the waveform component to.
Methods
add_external()
def add_external(
    self,
    data_name: str,
    event: Union[salvus.flow.collections.event.Event, str],
    data_filename: pathlib.Path,
    add_receivers_to_project_event: bool = False,
    receiver_fields: Optional[List[str]] = None,
) -> None:
    ...

Add external waveform data to the project.

Parameters
  • data_name str — Name of the data set.
  • event Union[salvus.flow.collections.event.Event, str] — The event to add it to.
  • data_filename pathlib.Path — The path to the data.
  • add_receivers_to_project_event bool — If this is true, the receivers in the file will be added to the event in the project. This only works if the project does not yet have any receivers. If the event already has receivers
  • receiver_fields Optional[List[str]] — Receiver fields for the new receivers to be added.
Returns None
add_external_data_proxy()
def add_external_data_proxy(
    self,
    data_name: str,
    data_proxy: salvus.flow.collections.event_data_collection_proxy.EventDataCollectionProxy,
) -> None:
    ...

Add a data proxy object as external data.

Parameters
  • data_name str — Name of the data.
  • data_proxy salvus.flow.collections.event_data_collection_proxy.EventDataCollectionProxy — Data proxy object.
Returns None
get()
def get(
    self,
    data_name: str,
    events: Union[
        str,
        Sequence[str],
        salvus.flow.collections.event.Event,
        Sequence[salvus.flow.collections.event.Event],
        salvus.flow.collections.event_collection.EventCollection,
    ],
    data_selection_configuration: Optional[str] = None,
) -> salvus.flow.collections.event_data_collection.EventDataCollection:
    ...

Get waveform data.

Parameters
  • data_name str — Data source name.
  • events Union[str, Sequence[str], salvus.flow.collections.event.Event, Sequence[salvus.flow.collections.event.Event], salvus.flow.collections.event_collection.EventCollection] — One or more events.
  • data_selection_configuration Optional[str] — Name of the optionally to be applied data selection configuration. If given it will be applied to the data.
Returns salvus.flow.collections.event_data_collection.EventDataCollection
has_data()
def has_data(
    self,
    data_name: str,
    event: Union[str, salvus.flow.collections.event.Event],
) -> bool:
    ...

Figure out if an event has a certain piece of waveform data.

Parameters
  • data_name str — The waveform data name.
  • event Union[str, salvus.flow.collections.event.Event] — The event to check if it has data for.
Returns bool