Version:

salvus.flow.collections.event_window_and_weight_set

salvus.flow.collections.event_window_and_weight_set salvus flow collections event_window_and_weight_set
Per-event window and weight sets.

Classes

EventWindowAndWeightSet

Event specific window and weight set.
*In most cases this class will be used indirectly through SalvusProject.
Functionally it can store an arbitrary amount of windows per receiver and component. In addition it stores weights at the receiver, the component, and the level of individual windows.
Any receiver component that does not explicitly have a window assigned will be assumed to have no picked windows and will thus be ignored in any misfit and adjoint source computation.
It can store interval windows that have a start as well as an end time. In addition it can optionally store an absolute UTC reference time and if that is given, all window times are assumed to be relative to it. Convenience methods to directly operate with absolute times are provided.
When being applied to data this class will on-the-fly convert the windows to temporal weights with a taper being applied. Thus the weights will be zero outside the windows and taper to one from the window boundaries to window_taper_width_in_seconds distance from the window boundaries.
SIGNATURE
class EventWindowAndWeightSet(builtins.object):
    def __init__(
        self,
        event: Event,
        filename: pathlib.Path,
        receiver_field: str | None = None,
        window_taper_width_in_seconds: float | None = None,
        taper_type: str | None = None,
    ): ...
ARGUMENTS
Required
event
Type:Event
Description:
The corresponding event object for this window and weight set. Needs to be passed every time as it is not serialized alongside the windows and weights.
Required
filename
Type:pathlib.Path
Description:
Path of the JSON file where it will be stored.
Optional
receiver_field
Type:str | None
Default value:None
Description:
The receiver field for which this window and weight set is valid. Only has to be specified if filename does not yet exist.
Optional
window_taper_width_in_seconds
Type:float | None
Default value:None
Description:
Taper width in seconds when the windows will be applied to the data. The taper width will never be larger than half a window length.
Optional
taper_type
Type:str | None
Default value:None
Description:
The type of taper to use. Currently only "hanning" is supported which will use the classical cosine bell Hann/Hanning window. Will default to "hanning" if not given.

Methods

EventWindowAndWeightSet.add_interval_window()
Add an interval window to the window and weight set.
SIGNATURE
def add_interval_window(
    self,
    receiver_name: str,
    component: str,
    window_start_time_in_seconds: float,
    window_end_time_in_seconds: float,
    window_weight: float = 1.0,
) -> None: ...
ARGUMENTS
Required
receiver_name
Type:str
Description:
Full name of the receiver.
Required
component
Type:str
Description:
The receiver component.
Required
window_start_time_in_seconds
Type:float
Description:
The start time of the window in seconds relative to time zero of the event.
Required
window_end_time_in_seconds
Type:float
Description:
The end time of the window in seconds relative to time zero of the event.
Optional
window_weight
Type:float
Default value:1.0
Description:
Weight for the window. Should not be more than one.
EventWindowAndWeightSet.add_interval_window_utc_datetime()
Add a UTCDateTime interval window to the window and weight set.
This only works if the event of the window and weight set has a set reference time.
SIGNATURE
def add_interval_window_utc_datetime(
    self,
    receiver_name: str,
    component: str,
    window_start_time: obspy.UTCDateTime,
    window_end_time: obspy.UTCDateTime,
    window_weight: float = 1.0,
) -> None: ...
ARGUMENTS
Required
receiver_name
Type:str
Description:
Full name of the receiver.
Required
component
Type:str
Description:
The receiver component.
Required
window_start_time
Type:obspy.UTCDateTime
Description:
The start time of the window in seconds relative to time zero of the event.
Required
window_end_time
Type:obspy.UTCDateTime
Description:
The end time of the window in seconds relative to time zero of the event.
Optional
window_weight
Type:float
Default value:1.0
Description:
Weight for the window. Should not be more than one.
EventWindowAndWeightSet.clear()
Remove all windows and set all weights to 1.
SIGNATURE
def clear(self) -> None: ...
EventWindowAndWeightSet.get_interval_window_statistics()
Return a dictionary of statistics about the interval windows.
SIGNATURE
def get_interval_window_statistics(self) -> _InternalWindowStatistics: ...
EventWindowAndWeightSet.get_latest_end_time()
Returns the latest end time in seconds.
If a reference time is set this is defined relative to it.
SIGNATURE
def get_latest_end_time(self) -> float: ...
EventWindowAndWeightSet.get_latest_utc_end_time()
Returns the latest end time in seconds.
If a reference time is set this is defined relative to it.
SIGNATURE
def get_latest_utc_end_time(self) -> obspy.UTCDateTime: ...
EventWindowAndWeightSet.get_utc_datetime_windows_and_weights_for_receiver_component()
Get the windows and weights for a specific receiver and component.
SIGNATURE
def get_utc_datetime_windows_and_weights_for_receiver_component(
    self, receiver_name: str, component: str
) -> dict[str, typing.Any]: ...
ARGUMENTS
Required
receiver_name
Type:str
Description:
The name of the receiver.
Required
component
Type:str
Description:
The component.
EventWindowAndWeightSet.get_windows_and_weights_for_receiver_component()
Get the windows and weights for a specific receiver and component.
SIGNATURE
def get_windows_and_weights_for_receiver_component(
    self, receiver_name: str, component: str
) -> dict[str, typing.Any]: ...
ARGUMENTS
Required
receiver_name
Type:str
Description:
The name of the receiver.
Required
component
Type:str
Description:
The component.
EventWindowAndWeightSet.temporal_weights_function()
The temporal weights function for the window set.
This can be directly passed to an EventData object which will apply it.
SIGNATURE
def temporal_weights_function(
    self,
    st: obspy.Stream,
    receiver: simple_config.receiver._Base,
    sources: list[simple_config.source._Base],
) -> dict[
    str, dict[str, dict[str, typing.Any]] | list[dict[str, typing.Any]]
]: ...
ARGUMENTS
Required
st
Type:obspy.Stream
Description:
An obspy.Stream object with the data.
Required
receiver
Type:simple_config.receiver._Base
Description:
The receiver object for the receiver.
Required
sources
Type:list[simple_config.source._Base]
Description:
All sources for the event.
EventWindowAndWeightSet.write()
Serializes the currently collected windows to disc.
SIGNATURE
def write(self, overwrite: bool = False) -> None: ...
ARGUMENTS
Optional
overwrite
Type:bool
Default value:False
Description:
Overwite an existing file if this is True.
PAGE CONTENTS