HvsrCurve

class HvsrCurve(frequency, amplitude, meta=None)

Class for creating and manipulating HvsrCurve objects.

Variables:
  • frequency (ndarray) – Vector of frequencies, must be same length as amplitude.

  • amplitude (ndarray) – Vector of HVSR amplitude values, one value per frequency.

  • peak_frequency (float) – Frequency of highest amplitude peak of HVSR curve.

  • peak_amplitude (float) – Amplitude of highest amplitude peak of HVSR curve.

__init__(frequency, amplitude, meta=None)

Create HvsrCurve from iterables of frequency and amplitude.

Parameters:
  • frequency (ndarray) – Vector of frequencies, one per amplitude.

  • amplitude (ndarray) – Vector of HVSR amplitudes, one per frequency.

  • meta (dict, optional) – Meta information about the object, default is None.

Returns:

HvsrCurve – Initialized with amplitude and frequency.

static _check_input(value, name)

Check input values.

Warning

Private methods are subject to change without warning.

Specifically:
  1. value must be castable to ndarray of doubles.

  2. value must be real; no np.nan.

  3. value must be >= 0.

Parameters:
  • value (iterable) – Value to be checked.

  • name (str) – Name of value to be checked, used for meaningful error messages.

Returns:

ndarrayvalues as ndarray of doubles.

Raises:
  • TypeError – If value is not castable to an ndarray of doubles.

  • ValueError – If value contains nan or a value less than or equal to zero.

static _find_peak_bounded(frequency, amplitude, search_range_in_hz=(None, None), find_peaks_kwargs=None)

Finds frequency and amplitude associated with highest peak over a bounded range.

Warning

Private methods are subject to change without warning.

static _search_range_to_index_range(frequency, search_range_in_hz)

Convert search range values in Hz to index range values.

Warning

Private methods are subject to change without warning.

is_similar(other, atol=1e-09, rtol=0.0)

Check if other is similar to self.

update_peaks_bounded(search_range_in_hz=(None, None), find_peaks_kwargs=None)

Update peak associated with HVSR curve, can be over bounded range.

Parameters:
  • 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.

Returns:

None – Updates internal peak-related attributes.