Window Rejection Algorithms

Window rejection algorithms provided in hvsrpy.

sta_lta_window_rejection(records, sta_seconds=1, lta_seconds=30, min_sta_lta_ratio=0.2, max_sta_lta_ratio=2.5, components=('ns', 'ew', 'vt'), hvsr=None)

Performs window rejection using STA - LTA ratio.

Parameters:
  • records (iterable of SeismicRecording3C) – Time-domain data in the form of an iterable object containing SeismicRecording3C objects. This data is assumed to have already been preprocessed using hvsrpy.preprocess.

  • sta_seconds (float, optional) – Length of time used to determine the short term average (STA) in seconds, default is 1 second.

  • lta_seconds (float, optional) – Length of time used to determine the long term average (LTA) in seconds, default is 30 seconds, should be roughly the window length.

  • min_sta_lta_ratio (float, optional) – Minimum allowable ratio of STA/LTA for a window; windows with an STA/LTA below this value will be rejected, default is 0.2.

  • max_sta_lta_ratio (float, optional) – Maximum allowable ratio of STA/LTA for a window; windows with an STA/LTA above this value will be rejected, default is 2.5.

  • components (iterable, optional) – Components on which the STA/LTA filter will be evaluated, default is all components, that is, ("ns", "ew", "vt").

  • hvsr (HvsrTraditional or HvsrAzimuthal, optional) – HVSR object to be updated using results of time-domain window rejection, default is None.

Returns:

list of SeismicRecordings3C – List of SeismicRecordings3C with those that violate the STA/LTA ratio limits removed. If HVSR object is provided. HVSR object will have updated internal state.

maximum_value_window_rejection(records, maximum_value_threshold=0.9, normalized=True, components=('ns', 'ew', 'vt'), hvsr=None)

Performs window rejection based on maximum value of time series.

Parameters:
  • records (iterable of SeismicRecording3C) – Time-domain data in the form of an iterable object containing SeismicRecording3C objects. This data is assumed to have already been preprocessed using hvsrpy.preprocess.

  • maximum_value_threshold (float) – Absolute value of timeseries, that if exceeded, the record will be rejected. Can be relative or absolute, see parameter normalized.

  • normalized (bool, optional) – Defines whether the maximum_value_threshold is absolute or relative to the maximum value observed across all records and all components, default is True indicating the maximum_value_threshold is relative to the maximum value observed.

  • components (iterable, optional) – Components on which the maximum value filter will be evaluated, default is all components, that is, ("ns", "ew", "vt").

  • hvsr (HvsrTraditional or HvsrAzimuthal, optional) – HVSR object to be updated using results of time-domain window rejection, default is None.

Returns:

list of SeismicRecordings3C – List of SeismicRecording3C objects with those that exceed the maximum value threshold removed. If HVSR object is provided. HVSR object will have updated internal state.

frequency_domain_window_rejection(hvsr, n=2, max_iterations=50, distribution_fn='lognormal', distribution_mc='lognormal', search_range_in_hz=(None, None), find_peaks_kwargs=None)

Frequency-domain window rejection algorithm by Cox et al., (2020).

Parameters:
  • hvsr (HvsrTraditional or HvsrAzimuthal) – HVSR object on which the window rejection algorithm will be applied.

  • n (float, optional) – Tuning parameter of the Cox et al., (2020) algorithm, indicates the number of standard deviations from the mean to be removed, default value is 2.

  • max_iterations (int, optional) – Maximum number of rejection iterations, default value is 50.

  • distribution_fn ({“lognormal”, “normal”}, optional) – Assumed distribution of fn from HVSR curves, the default is "lognormal".

  • distribution_mc ({“lognormal”, “normal”}, optional) – Assumed distribution of mean curve, the default is "lognormal".

  • search_range_in_hz (tuple, optional) – Frequency range to be searched for peaks. Half open ranges can be specified with None, default is (None, None) indicating the full frequency range will be searched.

  • find_peaks_kwargs (dict) – Keyword arguments for the scipy function find_peaks see scipy documentation for details, default is None indicating defaults will be used.

Returns:

int – Number of iterations required for convergence. Updates HVSR object’s internal state.

manual_window_rejection(hvsr, distribution_mc='lognormal', distribution_fn='lognormal', plot_mean_curve=True, plot_frequency_std=True, search_range_in_hz=(None, None), find_peaks_kwargs=None, y_limit=None, fig=None, ax=None)

Reject HVSR curves manually.

Parameters:
  • hvsr (HvsrTraditional or HvsrAzimuthal) – HVSR object on which the window rejection algorithm will be applied.

  • distribution_fn ({“lognormal”, “normal”}, optional) – Assumed distribution of fn from HVSR curves, the default is "lognormal".

  • distribution_mc ({“lognormal”, “normal”}, optional) – Assumed distribution of mean curve, the default is "lognormal".

  • plot_mean_curve (bool, optional) – Determines if mean curve should be plotted, default is True.

  • plot_frequency_std (bool, optional) – Determines if frequency standard deviation should be plotted, default is True.

  • search_range_in_hz (tuple, optional) – Frequency range to be searched for peaks. Half open ranges can be specified with None, default is (None, None) indicating the full frequency range will be searched.

  • find_peaks_kwargs (dict) – Keyword arguments for the scipy function find_peaks see scipy documentation for details, default is None indicating defaults will be used.

  • y_limit (float, optional) – Upper limit of plotted HVSR amplitude, default is None so default automatic scaling will be used.

  • fig (Figure, optional) – Matplotlib Figure object, on which manual window rejection will be performed, default is None so a Figure object will be created on the fly.

  • ax (Axes, optional) – Matplotlib Axes object, on which manual window rejection will be performed, default is None so a Axes object will be created on the fly.

Returns:

None – Updates HVSR object’s internal state.