salvus.project.components.waveform_component
Classes
WaveformComponent
WaveformComponentclass 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})normalizescale({FACTOR})flipbandpass({FREQ_MIN}, {FREQ_MAX}[, zerophase][, corners={CORNERS}])
projectsalvus.project.Project — The project to attach the waveform component to.
add_external()
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.
data_namestr — Name of the data set.eventUnion[salvus.flow.collections.event.Event, str] — The event to add it to.data_filenamepathlib.Path — The path to the data.add_receivers_to_project_eventbool — 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 receiversreceiver_fieldsOptional[List[str]] — Receiver fields for the new receivers to be added.
add_external_data_proxy()
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.
data_namestr — Name of the data.data_proxysalvus.flow.collections.event_data_collection_proxy.EventDataCollectionProxy — Data proxy object.
get()
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.
data_namestr — Data source name.eventsUnion[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_configurationOptional[str] — Name of the optionally to be applied data selection configuration. If given it will be applied to the data.
has_data()
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.
data_namestr — The waveform data name.eventUnion[str, salvus.flow.collections.event.Event] — The event to check if it has data for.