3.6. Velocity and Displacement History
- imcalculator.get_vel_disp_history(highpass_hz=0.05)[source]
Computes velocity and displacement time histories with baseline drift correction.
A zero-phase fourth-order Butterworth high-pass filter is applied to the zero-padded acceleration record before trapezoidal integration (Boore, 2005); the pads are removed afterwards.
- Parameters:
highpass_hz (float or None, optional) – Corner frequency (Hz) of the high-pass filter. Default is 0.05 Hz. Use the record’s own usable-frequency limit when it is known (e.g. from a flatfile).
Noneintegrates the record without drift correction.- Returns:
vel (numpy.ndarray) – Velocity time history (m/s).
disp (numpy.ndarray) – Displacement time history (m).
Example
import numpy as np
from openquake.vmtk.imcalculator import imcalculator
acc = np.loadtxt("openquake/vmtk/tests/test_data/acceleration.txt")
im = imcalculator(acc, dt=0.005)
vel, disp = im.get_vel_disp_history()
pgv = max(abs(vel))
pgd = max(abs(disp))
print(f"PGV = {pgv:.4f} m/s, PGD = {pgd:.4f} m")