No project description provided
Project description
Ground-Motion-Tools
The main functions of this programme include:
- reading and writing seismic waves in various formats
- seismic wave processing, such as the calculation of Fourier spectra, filtering, down-sampling, normalisation
- ground vibration response spectrum calculation
- ground shaking IM index calculation
Installation
pip install ground-motion-tools
Examples
Read
from ground_motion_tools import read_from_kik, read_from_single, read_from_peer
file_path = "your kik file path"
# read from kik
gm_data1, time_step1 = read_from_kik(file_path)
# read from peer
gm_data2, time_step2 = read_from_peer(file_path)
# read from single
gm_data3, time_step3 = read_from_single(file_path, 1, None, 0)
Write
from ground_motion_tools import read_from_peer, save_to_single
ori_file = "your origin ground motion file"
desc_file = "your target ground motion file"
gm_data, time_step = read_from_peer(file_path=ori_file)
save_to_single(desc_file, gm_data, time_step)
# The single file is like following.
"""
Time Step: 0.02
data1
data2
data3
...
"""
Process
from ground_motion_tools import *
from matplotlib import pyplot as plt
gm_data, time_step = read_from_kik("your acc file path")
# calculate vel, disp from acc
acc, vel, disp = gm_data_fill(gm_data, time_step, GMDataEnum.ACC)
# fourier_spectrum
gm_data, time_step = read_from_kik("your acc file path")
x, y1, y2 = fourier(gm_data, time_step)
plt.plot(x, y1)
plt.show()
# butter_worth_filter
filtered_gm_data = butter_worth_filter(gm_data, time_step, 4, 0.1, 25)
# downsample
down_sampled = down_sample(gm_data, time_step, 0.02)
# length_normalize
normalized_wave = length_normalize(gm_data, 1000)
Spectrum
from ground_motion_tools import *
import numpy as np
# one ground motion
gm_data, time_step = read_from_kik("your acc file path")
acc_spectrum, vel_spectrum, disp_spectrum, _, _ = get_spectrum(gm_data, time_step)
# The programme supports batch calculations
gm_data_many = np.zeros((100, gm_data.shape[0]))
for i in range(100):
gm_data_many[i, :] = gm_data
acc_spectrum, vel_spectrum, disp_spectrum, _, _ = get_spectrum(gm_data_many, time_step)
Intensity measures
from ground_motion_tools import *
import numpy as np
IM_WITHOUT_SPECTRUM = [GMIMEnum.PGA, GMIMEnum.PGV, GMIMEnum.PGD]
IM_SPECTRUM = [GMIMEnum.ASI, GMIMEnum.HI, GMIMEnum.VSI]
# one ground motion
gm_data, time_step = read_from_kik("your acc file path")
# Some IM metrics related to response spectra can consume a lot of time to calculate
im_without_spectrum = GMIntensityMeasures(gm_data, time_step).get_im(IM_WITHOUT_SPECTRUM)
im_with_spectrum = GMIntensityMeasures(gm_data, time_step).get_im(IM_WITHOUT_SPECTRUM + IM_SPECTRUM)
# The programme supports batch calculations.
batch_gm_data = np.zeros((1000, gm_data.shape[0]))
for i in range(1000):
batch_gm_data[i, :] = gm_data
im_without_spectrum_batch = GMIntensityMeasures(batch_gm_data, time_step).get_im(IM_WITHOUT_SPECTRUM)
im_with_spectrum_batch = GMIntensityMeasures(batch_gm_data, time_step).get_im(IM_WITHOUT_SPECTRUM + IM_SPECTRUM)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ground_motion_tools-0.2.3.tar.gz
(11.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ground_motion_tools-0.2.3.tar.gz.
File metadata
- Download URL: ground_motion_tools-0.2.3.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd0d5d2adc2f7dc66e186613ba2910f654c679b45e3eea642475ac9eb725c385
|
|
| MD5 |
b6a76dea3e3beec1942ebb7ff9673056
|
|
| BLAKE2b-256 |
0100e2b5f42d85b2ad0eb80796dd98445c9e71456213f50d9b81d03470d79c63
|
File details
Details for the file ground_motion_tools-0.2.3-py3-none-any.whl.
File metadata
- Download URL: ground_motion_tools-0.2.3-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.7 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47fe56249b04670c46f535db903d845970fd325c077ab7c2235aa9581d3dfc9e
|
|
| MD5 |
29f08d070dc0c9f32f7c54af4821296c
|
|
| BLAKE2b-256 |
27478582566d99e38797d64dfd5df4db47395b8d2d0080c499b022c60940a2b8
|