Metadata-Version: 2.1
Name: p-wave-detection
Version: 0.2.1
Summary: Automatic detector of the first arrival time of the P wave
Author-email: Hubert Siejkowski <h.siejkowski@cyfronet.pl>
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: ==3.9.*
Requires-Dist: mlflow
Requires-Dist: obspy
Requires-Dist: tensorflow==2.8.*
Description-Content-Type: text/markdown

# P Wave Detection Tool

This is a tool to automatically measure the arrival time of P wave within a time window of 4 seconds.

-----

## Requirements

To install this model a recent installation of [Miniconda](https://docs.conda.io/en/latest/miniconda.html) is required.

## Installation

To install this model please run:

```
git clone https://git.plgrid.pl/scm/eai/p-phase-picker.git
cd p-phase-picker
conda env create -f environment.yml
conda activate ross-2018
```

#### Running

To measure the arrival time please run:
```
p_wave_detection [-m MODEL] SEISMOGRAM DATE
```

e.g.:

```
p_wave_detection PL.BRDW..EHZ.D.2016.068 "2016/03/08 00:19:57.515"
```

## Important Notes

Any seismogram readable by [ObsPy](https://docs.obspy.org/) can be provided. The minimal sample is **400 points**, and the sampling rate must be **100 Hz**.

The `DATE` selects a centre of a 4 seconds window within the seismogram. The `DATE` should be formatted according to the [ISO8601:2004](https://en.wikipedia.org/wiki/ISO_8601) for examples see the [ObsPy documentation](https://docs.obspy.org/packages/autogen/obspy.core.utcdatetime.UTCDateTime.html), especially the 2nd point in the Examples section.

The model returns a arrival time with a respect to the given `DATE`. An exemplary output is:
```
Prediction: -0.024044 s
```
which means that the predicted P wave arrival time is 0.024044 seconds before the given `DATE`.

## Credits

The model is based on work by [Ross, Meier and Hauksson (2018)](https://doi.org/10.1029/2017JB015251) 
