Skip to main content

No project description provided

Project description

Ground-Motion-Tools

The main functions of this programme include:

  1. reading and writing seismic waves in various formats
  2. seismic wave processing, such as the calculation of Fourier spectra, filtering, down-sampling, normalisation
  3. ground vibration response spectrum calculation
  4. 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


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.5.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ground_motion_tools-0.2.5-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file ground_motion_tools-0.2.5.tar.gz.

File metadata

  • Download URL: ground_motion_tools-0.2.5.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

Hashes for ground_motion_tools-0.2.5.tar.gz
Algorithm Hash digest
SHA256 4c2973c5f3de9225f4c8f1fb4ce96dad9b34f9a2828975900a2ba77c4d30390a
MD5 795e5399753f9ddeecf45542126cd3ff
BLAKE2b-256 a4b7695a2b436c90bbd1afc08a18ca189625e6b3374e20393c850ae40a0bc121

See more details on using hashes here.

File details

Details for the file ground_motion_tools-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for ground_motion_tools-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9c7f8387184ad0542fc13016b745d7d84394a2be48900f93df485a5aae5dcacc
MD5 cbdcb684d720cdd87e0d8e93d65f3ed5
BLAKE2b-256 95a866b082da842a63f7a54b12c3e9b8db695057a018b63363733c2b67ca8f89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page