pyrvt.motions¶
Random vibration theory (RVT) based motions.
The module attribute DEFAULT_CALC is used to control the default peak factor calculator is one is not provided when a class is initialized.
- pyrvt.motions.sort_increasing(*args)[source]
Sort arrays such that they are increasing.
Check if the first array is is increasing, if not reverse the order. Same operation is applied to additional arrays.
- Parameters:
*args (array_like) – arrays to be re-ordered.
- Returns:
tuple containing sorted
numpy.ndarray’s.- Return type:
- Raises:
NotImplementedError – If first array is not monotonic.
- pyrvt.motions.log_spaced_values(lower, upper, per_decade=512)[source]
Generate values with constant log-spacing.
- Parameters:
- Returns:
values – Log-spaced values.
- Return type:
- pyrvt.motions.calc_sdof_tf(freqs, osc_freq, osc_damping)[source]
Single-degree-of-freedom transfer function.
When applied on the acceleration Fourier amplitude spectrum, it provides the pseudo-spectral acceleration.
- Parameters:
- Returns:
Complex valued transfer function.
- Return type:
- class pyrvt.motions.RvtMotion(freqs=None, fourier_amps=None, duration=None, peak_calculator=None, calc_kwds=None)[source]
Bases:
objectRandom vibration theory motion.
- Parameters:
freqs (array_like, optional) – Frequency array (Hz).
fourier_amps (array_like, optional) – Absolute value of acceleration Fourier amplitudes.
duration (float, optional) – Ground motion duration (sec).
peak_calculator (Calculator, optional) – Peak calculator to use. If None, then the default peak calculator is used. The peak calculator may either be specified by a [pyrvt.peak_calculators.Calculator][] instance, or created by the abbreviation of the calculator using [pyrvt.peak_calculators.get_peak_calculator][].
calc_kwds (dict, optional) – Keywords to be passed during the creation the peak calculator. These keywords are only required for some peak calculators.
- __init__(freqs=None, fourier_amps=None, duration=None, peak_calculator=None, calc_kwds=None)[source]
Initialize the class.
- property freqs: ndarray
Frequency values (Hz).
- property fourier_amps: ndarray
Acceleration Fourier amplitude values (g-sec).
- property duration: float
Duration of the ground motion for RVT analysis.
- classmethod from_fas(fas, peak_calculator=None, calc_kwds=None)[source]
Build an
RvtMotionfrom any object exposing a Fourier-spectrum shape.- Parameters:
fas (object) – Any object exposing
freqs[Hz],fourier_amps[g-sec], andduration[sec] attributes (e.g. an instance of apygmm.fourier_spectrummodel, or apygmm.contracts.FourierSpectrumdataclass).peak_calculator (str | Calculator | None) – Forwarded to
RvtMotion.calc_kwds (dict | None) – Forwarded to
RvtMotion.
- Return type:
RvtMotion
- calc_osc_accels(osc_freqs, osc_damping=0.05, trans_func=None)[source]
Pseudo-acceleration spectral response of an oscillator.
- Parameters:
- Returns:
spec_accels – Peak pseudo-spectral acceleration of the oscillator
- Return type:
numpy.ndarray
- property angular_freqs: ndarray
Angular frequency values (rad/sec).
- property pgv: float
Peak ground velocity (cm/sec).
- property pga: float
Peak ground acceleration (g).
- property arias_intensity: float
Arias intensity (m/s).
- property cav: float
Cumulative absolute velocity (m/s).
- calc_pgv(tf=None)[source]
Compute the peak ground velocity.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
pgv – Peak ground velocity (cm/sec).
- Return type:
- calc_pga(tf=None)[source]
Compute the peak ground acceleration.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
pga – Peak ground acceleration (g).
- Return type:
- calc_arias_intensity(tf=None)[source]
Compute the Arias intensity.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
arias_intensity – Arias intensity (m/s).
- Return type:
- calc_cav(tf=None)[source]
Compute the cumulative absolute velocity (CAV).
Uses an empirical regression on Arias intensity and duration based on observed ground motions.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
cav – Cumulative absolute velocity (m/s).
- Return type:
- calc_peak(transfer_func=None, **kwds)[source]
Compute the peak response.
- Parameters:
transfer_func (array_like, optional) – Transfer function to apply to the motion. If None, then no transfer function is applied.
- Returns:
peak – Calculated peak
- Return type:
- calc_attenuation(min_freq, max_freq=None)[source]
Compute the site attenuation (κ) based on a log-linear fit.
- Parameters:
- Returns:
atten (float) – attenuation parameter.
r_sqr (float) – squared correlation coefficient of the fit (R²). See scipy.stats.linregress.
freqs (array_like) – selected frequencies
fitted (array_like) – fitted values
- Return type:
Notes
This function computes the site attenuation defined by Anderson & Hough (1984) [@anderson84] as:
$$ a(f) = A_0 exp(-pi kappa f) text( for ) f > f_E $$
for a single Fourier amplitude spectrum
- class pyrvt.motions.CompatibleRvtMotion(osc_freqs, osc_accels_target, duration, osc_damping=0.05, window_len=None, peak_calculator=None, calc_kwds=None)[source]
Bases:
RvtMotionResponse spectrum compatible RVT motion.
A [CompatibleRvtMotion][pyrvt.motions.CompatibleRvtMotion] object is used to compute a Fourier amplitude spectrum that is compatible with a target response spectrum.
- Parameters:
- property angular_freqs: ndarray
Angular frequency values (rad/sec).
- property arias_intensity: float
Arias intensity (m/s).
- calc_arias_intensity(tf=None)
Compute the Arias intensity.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
arias_intensity – Arias intensity (m/s).
- Return type:
- calc_attenuation(min_freq, max_freq=None)
Compute the site attenuation (κ) based on a log-linear fit.
- Parameters:
- Returns:
atten (float) – attenuation parameter.
r_sqr (float) – squared correlation coefficient of the fit (R²). See scipy.stats.linregress.
freqs (array_like) – selected frequencies
fitted (array_like) – fitted values
- Return type:
Notes
This function computes the site attenuation defined by Anderson & Hough (1984) [@anderson84] as:
$$ a(f) = A_0 exp(-pi kappa f) text( for ) f > f_E $$
for a single Fourier amplitude spectrum
- calc_cav(tf=None)
Compute the cumulative absolute velocity (CAV).
Uses an empirical regression on Arias intensity and duration based on observed ground motions.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
cav – Cumulative absolute velocity (m/s).
- Return type:
- calc_osc_accels(osc_freqs, osc_damping=0.05, trans_func=None)
Pseudo-acceleration spectral response of an oscillator.
- Parameters:
- Returns:
spec_accels – Peak pseudo-spectral acceleration of the oscillator
- Return type:
numpy.ndarray
- calc_peak(transfer_func=None, **kwds)
Compute the peak response.
- Parameters:
transfer_func (array_like, optional) – Transfer function to apply to the motion. If None, then no transfer function is applied.
- Returns:
peak – Calculated peak
- Return type:
- calc_pga(tf=None)
Compute the peak ground acceleration.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
pga – Peak ground acceleration (g).
- Return type:
- calc_pgv(tf=None)
Compute the peak ground velocity.
- Parameters:
tf (array_like, optional) – Transfer function to apply to the motion. If
None, no transfer function is applied.- Returns:
pgv – Peak ground velocity (cm/sec).
- Return type:
- property cav: float
Cumulative absolute velocity (m/s).
- property duration: float
Duration of the ground motion for RVT analysis.
- property fourier_amps: ndarray
Acceleration Fourier amplitude values (g-sec).
- property freqs: ndarray
Frequency values (Hz).
- classmethod from_fas(fas, peak_calculator=None, calc_kwds=None)
Build an
RvtMotionfrom any object exposing a Fourier-spectrum shape.- Parameters:
fas (object) – Any object exposing
freqs[Hz],fourier_amps[g-sec], andduration[sec] attributes (e.g. an instance of apygmm.fourier_spectrummodel, or apygmm.contracts.FourierSpectrumdataclass).peak_calculator (str | Calculator | None) – Forwarded to
RvtMotion.calc_kwds (dict | None) – Forwarded to
RvtMotion.
- Return type:
RvtMotion
- property pga: float
Peak ground acceleration (g).
- property pgv: float
Peak ground velocity (cm/sec).
- __init__(osc_freqs, osc_accels_target, duration, osc_damping=0.05, window_len=None, peak_calculator=None, calc_kwds=None)[source]
Initialize the motion.
- Parameters:
osc_freqs (array_like) – Frequencies of the oscillator response (Hz).
osc_accels_target (array_like) – Spectral acceleration of the oscillator at the specified frequencies (g).
duration (float) – Duration of the ground motion (sec).
osc_damping (float, optional) – Fractional damping of the oscillator (dec). Default value is 0.05 for a damping ratio of 5%.
window_len (int, optional) – Window length used for smoothing the computed Fourier amplitude spectrum. If None, then no smoothing is applied. The smoothing is applied as a moving average with a width of window_len.
peak_calculator (Calculator, optional) – Peak calculator to use. If None, then the default peak calculator is used. The peak calculator may either be specified by a [pyrvt.peak_calculators.Calculator][] object, or by the initials of the calculator using [pyrvt.peak_calculators.get_peak_calculator][].
calc_kwds (dict, optional) – Keywords to be passed during the creation the peak calculator. These keywords are only required for some peak calculators.
- Return type:
None
- classmethod from_response_spectrum(rs, duration, **kw)[source]
Create from any object with .periods, .spec_accels, .damping.
Duck-typed: accepts
pygmm.contracts.ResponseSpectrumor any object with the same attributes.- Parameters:
rs – Response spectrum with
.periods[s],.spec_accels[g], and.damping[decimal].duration (float) – Ground-motion duration [s].
**kw – Forwarded to
CompatibleRvtMotion(e.g.peak_calculator).
- Return type:
CompatibleRvtMotion