HvsrTraditional
- class HvsrTraditional(frequency, amplitude, meta=None)
Class for creating and manipulating
HvsrTraditionalobjects.- Variables:
amplitude (ndarray) – Array of HVSR amplitudes. Each row represents an individual curve (e.g., from a time window or earthquake recording) and each column a frequency.
frequency (ndarray) – Vector of frequencies, one per amplitude column.
n_curves (int) – Number of HVSR curves in
HvsrTraditionalobject; one HVSR curve per time window or earthquake recording.valid_curve_boolean_mask (ndarray) – Boolean array indicating whether each HVSR curve is valid (
True) or invalid (False).valid_peak_boolean_mask (ndarray) – Boolean array indicating whether the peak of each HVSR curve is valid (
True) or invalid (False).
- __init__(frequency, amplitude, meta=None)
Create
HvsrTraditionalfrom amplitude and frequency.- Parameters:
frequency (ndarray) – Vector of frequencies, corresponding to each column of
amplitude.amplitude (ndarray) – Array of HVSR amplitudes. Each row represents an individual curve (e.g., from a time window or earthquake record) and each column a frequency.
meta (dict, optional) – Meta information about the object, default is
None.
- Returns:
HvsrTraditional – Initialized with
amplitudeandfrequency.
- cov_fn(distribution='lognormal')
Covariance of HVSR resonance across all valid HVSR curves.
- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of resonance, default is
"lognormal".- Returns:
ndarray – Tensor of shape
(2,2)that represents the covariance matrix of frequency and amplitude of HVSR resonance across all valid time windows.- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- classmethod from_hvsr_curves(hvsr_curves, meta=None)
Instantiate HvsrTraditional from iterable of
HvsrCurve.- Parameters:
amplitude (iterable of HvsrCurve) – Iterable of HvsrCurve objects one curve for each time window or earthquake record and common frequency sampling.
meta (dict, optional) – Meta information about the object, default is
None.
- Returns:
HvsrTraditional – Instantiated from
HvsrCurvedata.
- is_similar(other)
Determine if
otheris similar toself.
- mean_curve(distribution='lognormal')
Mean HVSR curve.
- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of mean curve, default is “lognormal”.
- Returns:
ndarray – Mean HVSR curve according to the distribution specified.
- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- mean_curve_peak(distribution='lognormal')
Frequency and amplitude of the peak of the mean HVSR curve.
- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of HVSR curve, default is
"lognormal".- Returns:
tuple – Frequency and amplitude associated with the peak of the mean HVSR curve of the form
(mean_curve_peak_frequency, mean_curve_peak_amplitude).
- mean_fn_amplitude(distribution='lognormal')
Mean amplitude of peaks associated with
fnfrom valid HVSR curves.- Parameters:
distribution ({“normal”, “lognormal”}) – Assumed distribution of
fn, default is"lognormal".- Returns:
float – Mean amplitude of
fnaccording to the distribution specified.- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- mean_fn_frequency(distribution='lognormal')
Mean frequency of peaks associated with
fnfrom valid HVSR curves.- Parameters:
distribution ({“normal”, “lognormal”}) – Assumed distribution of
fn, default is"lognormal".- Returns:
float – Mean value of
fnaccording to the distribution specified.- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- nth_std_curve(n, distribution='lognormal')
nth standard deviation curve.
- Parameters:
n (float) – Number of standard deviations away from the mean curve.
distribution ({“lognormal”, “normal”}, optional) – Assumed distribution of mean curve, default is
"lognormal".
- Returns:
ndarray – nth standard deviation curve.
- nth_std_fn_amplitude(n, distribution='lognormal')
Value n standard deviations from mean
fnamplitude.- Parameters:
n (float) – Number of standard deviations away from the mean amplitude of
fncomputed from valid HVSR curves.distribution ({“lognormal”, “normal”}, optional) – Assumed distribution of
fn, the default is"lognormal".
- Returns:
float – Value n standard deviations from mean
fnamplitude.
- nth_std_fn_frequency(n, distribution='lognormal')
Value n standard deviations from mean
fnfrequency.- Parameters:
n (float) – Number of standard deviations away from the mean frequency of
fncomputed from valid HVSR curves.distribution ({“lognormal”, “normal”}, optional) – Assumed distribution of
fn, the default is"lognormal".
- Returns:
float – Value n standard deviations from mean
fnfrequency.
- property peak_amplitudes
Valid peak amplitude vector, one per window or earthquake recording.
- property peak_frequencies
Valid peak frequency vector, one per window or earthquake recording.
- std_curve(distribution='lognormal')
Sample standard deviation of the HVSR curves.
- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of HVSR curve, default is
"lognormal".- Returns:
ndarray – Sample standard deviation of HVSR curve according to the distribution specified.
- Raises:
ValueError – If only single HVSR curve is defined.
NotImplementedError – If
distributiondoes not match the available options.
- std_fn_amplitude(distribution='lognormal')
Sample standard deviation of amplitude of peaks associated with
fnfrom valid HVSR curves.- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of
fn, default is"lognormal".- Returns:
float – Sample standard deviation of the amplitude of
fnconsidering only the valid HVSR curves.- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- std_fn_frequency(distribution='lognormal')
Sample standard deviation of frequency of peaks associated with
fnfrom valid HVSR curves.- Parameters:
distribution ({“normal”, “lognormal”}, optional) – Assumed distribution of
fn, default is"lognormal".- Returns:
float – Sample standard deviation of the frequency of
fnconsidering only the valid HVSR curves.- Raises:
NotImplementedError – If
distributiondoes not match the available options.
- update_peaks_bounded(search_range_in_hz=(None, None), find_peaks_kwargs=None)
Update peak associated with each 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
scipyfunction find_peaks seescipydocumentation for details.
- Returns:
None – Updates internal peak-related attributes.