phasenet 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.1
2
+ Name: PhaseNet
3
+ Version: 0.1.0
4
+ Summary: PhaseNet
5
+ Home-page: UNKNOWN
6
+ Author: Weiqiang Zhu
7
+ Author-email: wayne.weiqiang@gmail.com
8
+ License: GPL-3.0
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Description-Content-Type: text/markdown
20
+ Provides-Extra: test
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.1
2
+ Name: PhaseNet
3
+ Version: 0.1.0
4
+ Summary: PhaseNet
5
+ Home-page: UNKNOWN
6
+ Author: Weiqiang Zhu
7
+ Author-email: wayne.weiqiang@gmail.com
8
+ License: GPL-3.0
9
+ Description: UNKNOWN
10
+ Platform: UNKNOWN
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ Description-Content-Type: text/markdown
20
+ Provides-Extra: test
@@ -0,0 +1,14 @@
1
+ README.md
2
+ setup.py
3
+ PhaseNet.egg-info/PKG-INFO
4
+ PhaseNet.egg-info/SOURCES.txt
5
+ PhaseNet.egg-info/dependency_links.txt
6
+ PhaseNet.egg-info/requires.txt
7
+ PhaseNet.egg-info/top_level.txt
8
+ phasenet/__init__.py
9
+ phasenet/data_reader.py
10
+ phasenet/detect_peaks.py
11
+ phasenet/model.py
12
+ phasenet/predict.py
13
+ phasenet/train.py
14
+ phasenet/util.py
@@ -0,0 +1,9 @@
1
+ tensorflow==2.3
2
+ matplotlib
3
+ pandas
4
+ tqdm
5
+ scipy
6
+ obspy==1.2.2
7
+
8
+ [test]
9
+ pytest
@@ -0,0 +1 @@
1
+ phasenet
@@ -0,0 +1,124 @@
1
+
2
+
3
+ ## 1. Install
4
+
5
+ ### Using Anaconda (recommend)
6
+ ```bash
7
+ conda env create -f environment.yml
8
+ conda activate venv
9
+ ```
10
+
11
+ or
12
+
13
+ ```bash
14
+ conda create --name venv
15
+ conda activate venv
16
+ conda install tensorflow=2.3 matplotlib scipy pandas tqdm
17
+ conda install libiconv
18
+ conda install obspy -c conda-forge
19
+ ```
20
+
21
+ ### Using virtualenv
22
+ ```bash
23
+ pip install virtualenv
24
+ virtualenv .venv
25
+ source .venv/bin/activate
26
+ pip install -r requirements.txt
27
+ ```
28
+
29
+ ### 2.Demo Data
30
+
31
+ Numpy array data are stored in directory: **dataset**
32
+
33
+ Mseed data are stored in directory: **demo**
34
+
35
+ ### 3.Model
36
+ Located in directory: **model/190703-214543**
37
+
38
+ ### 4. Prediction
39
+
40
+ #### a) Data format -- mseed with obspy
41
+
42
+ Required a csv file and a directory of mseed files.
43
+
44
+ The csv file contains four column: "fname, E, N, Z"
45
+
46
+ The mseed file contains the continous data with ENZ channels.
47
+
48
+ Add **--input_mseed** to process mseed data:
49
+
50
+ ~~~bash
51
+ source .venv/bin/activate
52
+ python run.py --mode=pred --model_dir=model/190703-214543 --data_dir=demo/mseed --data_list=demo/fname.csv --output_dir=output --batch_size=20 --input_mseed
53
+ ~~~
54
+
55
+ Notes:
56
+ 1. The detected P&S phases are stored to file **picks.csv** inside **--output_dir**. The picks.csv has three columns: file name with the beginning sample index (fname_index), P-phase index (itp), P-phase probability (tp_prob), S-phase index (its), S-phase probability (ts_prob). The absolute phase index = fname_index + itp/its.
57
+ 2. The activation thresholds for P&S phases are set to 0.3 as default. Specify **--tp_prob** and **--ts_prob** to change the two thresholds.
58
+ 3. On default, the mseed file is processed twice with 50% overlap to avoid phases being cut in the middle. The second pass are appended to the end of first pass. For example, if the index of the input data is from 0-60000, the index of second pass is from 60000-120000. If the processing window is 3000, the fist 1500 samples of the second pass are the padded zeros.
59
+ 4. You can customze the preprocssing of mseed file, such as filtering and resampling, inside the function **read_mseed** in data_reader.py.
60
+ 5. **demo/demo-obspy.ipynb** has a simple example of downloading and preparing mseed data using obspy.
61
+
62
+ #### b) Data format -- numpy array
63
+ Required a csv file and a directory of npz files.
64
+
65
+ The csv file contains one column: "fname"
66
+
67
+ The npz file contains one variable: "data"
68
+
69
+ The shape of "data" variable has a shape of 3000 x 3
70
+
71
+ ~~~bash
72
+ source .venv/bin/activate
73
+ python run.py --mode=pred --model_dir=model/190703-214543 --data_dir=dataset/waveform_pred --data_list=dataset/waveform.csv --output_dir=output --plot_figure --save_result --batch_size=20
74
+ ~~~
75
+
76
+ Notes:
77
+ 1. For large dataset and GPUs, larger batch size can accelerate the prediction.
78
+ 2. Plotting figures and save resutls is very slow. Removing the argument of **--plot_figure, --save_result** can speed the prediction
79
+ 3. If using input data length other than 3000, specify argument **--input_length=**.
80
+
81
+ ### 5. Training on new dataset
82
+
83
+ #### Training data format
84
+ Required a csv file and a directory of npz files.
85
+
86
+ The csv file contains four columns: "fname", "itp", "its", "channels"
87
+
88
+ The npz file contains four variable: "data", "itp", "its", "channels"
89
+
90
+ The shape of "data" variables has a shape of 9001 x 3
91
+
92
+ The variables "itp" and "its" are the data points of first P&S arrivals picked by analysts.
93
+
94
+ - Training from scratch:
95
+
96
+ ~~~bash
97
+ source .venv/bin/activate
98
+ python run.py --mode=train --train_dir=dataset/waveform_train --train_list=dataset/waveform.csv --batch_size=20
99
+ ~~~
100
+
101
+ - Training from the pretrain model:
102
+
103
+ ~~~bash
104
+ source .venv/bin/activate
105
+ python run.py --mode=train --model_dir=model/190703-214543 --train_dir=dataset/waveform_train --train_list=dataset/waveform.csv --batch_size=20
106
+ ~~~
107
+
108
+
109
+ #### Validation and Testing
110
+ ~~~bash
111
+ source .venv/bin/activate
112
+ python run.py --mode=valid --model_dir=model/190703-214543 --data_dir=dataset/waveform_train --data_list=dataset/waveform.csv --plot_figure --save_result --batch_size=20
113
+ ~~~
114
+
115
+ Please let us know of any bugs found in the code.
116
+
117
+
118
+ ### Related papers:
119
+ - Zhu, W., & Beroza, G. C. (2018). PhaseNet: A Deep-Neural-Network-Based Seismic Arrival Time Picking Method. arXiv preprint arXiv:1803.03211.
120
+ - Liu, M., Zhang, M., Zhu, W., Ellsworth, W. L., & Li, H. Rapid Characterization of the July 2019 Ridgecrest, California Earthquake Sequence from Raw Seismic Data using Machine Learning Phase Picker. Geophysical Research Letters, e2019GL086189.
121
+ - Park, Y., Mousavi, S. M., Zhu, W., Ellsworth, W. L., & Beroza, G. C. (2020). Machine learning based analysis of the Guy-Greenbrier, Arkansas earthquakes: a tale of two sequences.
122
+ - Chai, C., Maceira, M., Santos‐Villalobos, H. J., Venkatakrishnan, S. V., Schoenball, M., Zhu, W., ... & EGS Collab Team. (2020). Using a Deep Neural Network and Transfer Learning to Bridge Scales for Seismic Phase Picking. Geophysical Research Letters, e2020GL088651.
123
+ -
124
+
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"