Skip to main content

Signal processing for field and experimental data for earthquake engineering

Project description

Testing Status PyPi version https://coveralls.io/repos/github/eng-tools/eqsig/badge.svg License ECP project

eqsig

A Python package for seismic signal processing.

Features

This package provides common functions for computing ground motion parameters and performing signal processing. The functions are implemented on either numpy arrays or on a signal object that uses caching to avoid expensive recalculation of widely used parameters.

  • Compute the acceleration response spectrum and elastic response time series using the fast Nigam and Jennings (1968) algorithm.

  • Compute the Fourier amplitude spectrum (using the scipy.signal.fft algorithm)

  • Compute the smooth Fourier amplitude spectrum according to Konno and Ohmachi (1998)

  • Compute velocity and displacement from acceleration time series

  • Compute peak ground motion quantities (PGA, PGV, PGD)

  • Compute common ground motion intensity measures (Arias intensity, CAV, CAV_dp5, significant duration, bracketed duration, dominant period)

  • Compute signal features (zero crossings, global peaks, local peaks)

  • Compute rotated ground motion or intensity measure from two ground motion components

  • Resampling of ground motion through interpolation or periodic resampling

  • Butterworth filter (using scipy), running average, polynomial fitting

  • Fast loading of, and saving of, plain text to and from Signal objects

How to Use

[Eqsig documentation](https://eqsig.readthedocs.io)

Examples

Generate response spectra

import numpy as np
import matplotlib.pyplot as plt
import eqsig.single

bf, sub_fig = plt.subplots()
a = np.loadtxt("<path-to-acceleration-time-series>")
dt = 0.005  # time step of acceleration time series
periods = np.linspace(0.2, 5, 100)  # compute the response for 100 periods between T=0.2s and 5.0s
record = eqsig.AccSignal(a * 9.8, dt)
record.generate_response_spectrum(response_times=periods)
times = record.response_times

sub_fig.plot(times, record.s_a, label="eqsig")
plt.show()

Useful material

Contributing

How do I get set up?

  1. Run pip install -r requirements.txt

Package conventions

  • A function that calculates a property the takes a signal as an input, should be named as calc_<property>, if the calculation has multiple different implementations, then include the citation as author and year as well calc_<property>_<author>_<year>

  • If the function takes a raw array then it should contain the word array (or values).

Testing

Tests are run with pytest

  • Locally run: pytest on the command line.

  • Tests are run on every push using travis, see the .travis.yml file

Deployment

To deploy the package to pypi.com you need to:

  1. Push to the pypi branch. This executes the tests on circleci.com

  2. Create a git tag and push to github, run: trigger_deploy.py or manually:

git tag 0.5.2 -m "version 0.5.2"
git push --tags origin pypi

Documentation

Built via Sphinx following: https://codeandchaos.wordpress.com/2012/07/30/sphinx-autodoc-tutorial-for-dummies/

For development mode

  1. cd to docs

  2. Run make html

Docstrings follow numpy convention (in progress): https://numpydoc.readthedocs.io/en/latest/format.html

To fix long_description in setup.py: pip install collective.checkdocs, python setup.py checkdocs

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

eqsig-0.6.4.tar.gz (23.9 kB view details)

Uploaded Source

File details

Details for the file eqsig-0.6.4.tar.gz.

File metadata

  • Download URL: eqsig-0.6.4.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for eqsig-0.6.4.tar.gz
Algorithm Hash digest
SHA256 487b13454d7e289d87b8dce1bd5e7168c8467434bc5303c69edbb8e122f00cac
MD5 cca0574d337868dd2a2f7924223ff33e
BLAKE2b-256 e1269120015b8c51e6e65df2aacd0145f4d18fa69f9aa5e2c56da600b51ced1c

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