DASPy-toolbox 1.0.0__tar.gz → 1.1.1__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.
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/PKG-INFO +19 -13
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/SOURCES.txt +2 -1
- DASPy-toolbox-1.1.1/LICENSE +21 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/PKG-INFO +19 -13
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/README.md +17 -11
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/channel.py +151 -7
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/decomposition.py +1 -1
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/denoising.py +1 -1
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/basic_tools/preprocessing.py +19 -11
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/basic_tools/visualization.py +10 -7
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/collection.py +62 -42
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/dasdatetime.py +9 -1
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/read.py +41 -16
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/section.py +47 -25
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/write.py +17 -4
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/core.py +82 -15
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/location.py +1 -1
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/magnitude.py +3 -3
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/phase_picking.py +24 -4
- DASPy-toolbox-1.1.1/daspy/structure_imaging/core.py +39 -0
- DASPy-toolbox-1.1.1/daspy/structure_imaging/fault_zone.py +90 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/setup.py +1 -1
- DASPy-toolbox-1.0.0/LICENSE.txt +0 -1
- DASPy-toolbox-1.0.0/daspy/structure_imaging/fault_zone.py +0 -59
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/dependency_links.txt +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/entry_points.txt +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/requires.txt +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/DASPy_toolbox.egg-info/top_level.txt +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/fdct.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/advanced_tools/strain2vel.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/basic_tools/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/basic_tools/filter.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/basic_tools/freqattributes.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/example.pkl +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/core/make_example.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/calc_travel_time.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/detection.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/_base.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/_bayesian_mixture.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/_gaussian_mixture.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/app.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/seismic_ops.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/seismic_detection/gamma/utils.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/structure_imaging/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/structure_imaging/ambient_noise.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/structure_imaging/dispersion.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/structure_imaging/inversion.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/traffic_monitoring/JamDetection.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/traffic_monitoring/SpeedMeasurement.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/traffic_monitoring/VehicleDetection.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/daspy/traffic_monitoring/__init__.py +0 -0
- {DASPy-toolbox-1.0.0 → DASPy-toolbox-1.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DASPy-toolbox
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing, which comprises classic seismic data processing techniques and Specialized algorithms for DAS applications.
|
|
5
5
|
Home-page: https://github.com/HMZ-03/DASPy
|
|
6
6
|
Author: Minzhe Hu, Zefeng Li
|
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Requires-Python: >=3.9
|
|
15
|
-
License-File: LICENSE
|
|
15
|
+
License-File: LICENSE
|
|
16
16
|
Requires-Dist: numpy
|
|
17
17
|
Requires-Dist: scipy>=1.13
|
|
18
18
|
Requires-Dist: matplotlib
|
|
@@ -25,8 +25,14 @@ Requires-Dist: tqdm
|
|
|
25
25
|
|
|
26
26
|
<img src="./website/USTC.svg" height="170" /> <img src="./website/DAMS.png" height="150" />
|
|
27
27
|
|
|
28
|
+
# DASPy
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
31
|
+
[](https://opensource.org/license/mit)
|
|
32
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
33
|
+
[](https://doi.org/10.1785/0220240124)
|
|
34
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
35
|
+
[](https://anaconda.org/conda-forge/daspy-toolbox)
|
|
30
36
|
|
|
31
37
|
DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
|
|
32
38
|
|
|
@@ -34,32 +40,32 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
|
|
|
34
40
|
* Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
|
|
35
41
|
* Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
|
|
36
42
|
|
|
37
|
-
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [
|
|
43
|
+
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [an example of Jupyter notebook](document/example.ipynb) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
|
|
38
44
|
|
|
39
45
|
## Installation
|
|
40
|
-
DASPy
|
|
41
|
-
DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
|
|
46
|
+
DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
|
|
42
47
|
|
|
43
|
-
### Pip
|
|
48
|
+
### Pip
|
|
44
49
|
```
|
|
45
|
-
pip install
|
|
50
|
+
pip install daspy-toolbox
|
|
46
51
|
```
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
Install the latest version from GitHub:
|
|
49
54
|
|
|
50
55
|
```
|
|
51
|
-
pip install
|
|
56
|
+
pip install git+https://github.com/HMZ-03/DASPy.git
|
|
52
57
|
```
|
|
53
58
|
|
|
54
59
|
### Conda
|
|
60
|
+
|
|
55
61
|
```
|
|
56
|
-
conda install -
|
|
62
|
+
conda install daspy-toolbox
|
|
57
63
|
```
|
|
58
64
|
|
|
59
|
-
|
|
65
|
+
or
|
|
60
66
|
|
|
61
67
|
```
|
|
62
|
-
conda
|
|
68
|
+
conda install conda-forge::daspy-toolbox
|
|
63
69
|
```
|
|
64
70
|
|
|
65
71
|
### Manual installation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
LICENSE
|
|
1
|
+
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
setup.py
|
|
4
4
|
DASPy_toolbox.egg-info/PKG-INFO
|
|
@@ -43,6 +43,7 @@ daspy/seismic_detection/gamma/seismic_ops.py
|
|
|
43
43
|
daspy/seismic_detection/gamma/utils.py
|
|
44
44
|
daspy/structure_imaging/__init__.py
|
|
45
45
|
daspy/structure_imaging/ambient_noise.py
|
|
46
|
+
daspy/structure_imaging/core.py
|
|
46
47
|
daspy/structure_imaging/dispersion.py
|
|
47
48
|
daspy/structure_imaging/fault_zone.py
|
|
48
49
|
daspy/structure_imaging/inversion.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 University of Science and Technology of China
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: DASPy-toolbox
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.1
|
|
4
4
|
Summary: DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing, which comprises classic seismic data processing techniques and Specialized algorithms for DAS applications.
|
|
5
5
|
Home-page: https://github.com/HMZ-03/DASPy
|
|
6
6
|
Author: Minzhe Hu, Zefeng Li
|
|
@@ -12,7 +12,7 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Requires-Python: >=3.9
|
|
15
|
-
License-File: LICENSE
|
|
15
|
+
License-File: LICENSE
|
|
16
16
|
Requires-Dist: numpy
|
|
17
17
|
Requires-Dist: scipy>=1.13
|
|
18
18
|
Requires-Dist: matplotlib
|
|
@@ -25,8 +25,14 @@ Requires-Dist: tqdm
|
|
|
25
25
|
|
|
26
26
|
<img src="./website/USTC.svg" height="170" /> <img src="./website/DAMS.png" height="150" />
|
|
27
27
|
|
|
28
|
+
# DASPy
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
31
|
+
[](https://opensource.org/license/mit)
|
|
32
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
33
|
+
[](https://doi.org/10.1785/0220240124)
|
|
34
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
35
|
+
[](https://anaconda.org/conda-forge/daspy-toolbox)
|
|
30
36
|
|
|
31
37
|
DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
|
|
32
38
|
|
|
@@ -34,32 +40,32 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
|
|
|
34
40
|
* Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
|
|
35
41
|
* Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
|
|
36
42
|
|
|
37
|
-
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [
|
|
43
|
+
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [an example of Jupyter notebook](document/example.ipynb) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
|
|
38
44
|
|
|
39
45
|
## Installation
|
|
40
|
-
DASPy
|
|
41
|
-
DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
|
|
46
|
+
DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
|
|
42
47
|
|
|
43
|
-
### Pip
|
|
48
|
+
### Pip
|
|
44
49
|
```
|
|
45
|
-
pip install
|
|
50
|
+
pip install daspy-toolbox
|
|
46
51
|
```
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
Install the latest version from GitHub:
|
|
49
54
|
|
|
50
55
|
```
|
|
51
|
-
pip install
|
|
56
|
+
pip install git+https://github.com/HMZ-03/DASPy.git
|
|
52
57
|
```
|
|
53
58
|
|
|
54
59
|
### Conda
|
|
60
|
+
|
|
55
61
|
```
|
|
56
|
-
conda install -
|
|
62
|
+
conda install daspy-toolbox
|
|
57
63
|
```
|
|
58
64
|
|
|
59
|
-
|
|
65
|
+
or
|
|
60
66
|
|
|
61
67
|
```
|
|
62
|
-
conda
|
|
68
|
+
conda install conda-forge::daspy-toolbox
|
|
63
69
|
```
|
|
64
70
|
|
|
65
71
|
### Manual installation
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
<img src="./website/USTC.svg" height="170" /> <img src="./website/DAMS.png" height="150" />
|
|
2
2
|
|
|
3
|
+
# DASPy
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
6
|
+
[](https://opensource.org/license/mit)
|
|
7
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
8
|
+
[](https://doi.org/10.1785/0220240124)
|
|
9
|
+
[](https://pypi.org/project/DASPy-toolbox/)
|
|
10
|
+
[](https://anaconda.org/conda-forge/daspy-toolbox)
|
|
5
11
|
|
|
6
12
|
DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
|
|
7
13
|
|
|
@@ -9,32 +15,32 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
|
|
|
9
15
|
* Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
|
|
10
16
|
* Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
|
|
11
17
|
|
|
12
|
-
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [
|
|
18
|
+
DASPy is licensed under the MIT License. [An English version of DASPy tutorial](https://daspy-tutorial.readthedocs.io/en/latest/), [a Chinese version of DASPy tutorial](https://daspy-tutorial-cn.readthedocs.io/zh-cn/latest/) and [an example of Jupyter notebook](document/example.ipynb) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
|
|
13
19
|
|
|
14
20
|
## Installation
|
|
15
|
-
DASPy
|
|
16
|
-
DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
|
|
21
|
+
DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
|
|
17
22
|
|
|
18
|
-
### Pip
|
|
23
|
+
### Pip
|
|
19
24
|
```
|
|
20
|
-
pip install
|
|
25
|
+
pip install daspy-toolbox
|
|
21
26
|
```
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
Install the latest version from GitHub:
|
|
24
29
|
|
|
25
30
|
```
|
|
26
|
-
pip install
|
|
31
|
+
pip install git+https://github.com/HMZ-03/DASPy.git
|
|
27
32
|
```
|
|
28
33
|
|
|
29
34
|
### Conda
|
|
35
|
+
|
|
30
36
|
```
|
|
31
|
-
conda install -
|
|
37
|
+
conda install daspy-toolbox
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
|
|
40
|
+
or
|
|
35
41
|
|
|
36
42
|
```
|
|
37
|
-
conda
|
|
43
|
+
conda install conda-forge::daspy-toolbox
|
|
38
44
|
```
|
|
39
45
|
|
|
40
46
|
### Manual installation
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Purpose: Several functions for analysis data quality and geometry of channels
|
|
2
2
|
# Author: Minzhe Hu, Zefeng Li
|
|
3
|
-
# Date: 2024.
|
|
3
|
+
# Date: 2024.11.18
|
|
4
4
|
# Email: hmz2018@mail.ustc.edu.cn
|
|
5
5
|
import numpy as np
|
|
6
6
|
from copy import deepcopy
|
|
@@ -55,8 +55,8 @@ def channel_checking(data, deg=10, thresh=5, continuity=True, adjacent=2,
|
|
|
55
55
|
"""
|
|
56
56
|
Use the energy of each channel to determine which channels are bad.
|
|
57
57
|
|
|
58
|
-
:param data: 2-dimensional np.ndarray. Axis 0 is channel number and axis 1
|
|
59
|
-
time series
|
|
58
|
+
:param data: 2-dimensional np.ndarray. Axis 0 is channel number and axis 1
|
|
59
|
+
is time series.
|
|
60
60
|
:param deg: int. Degree of the fitting polynomial
|
|
61
61
|
:param thresh: int or float. The MAD multiple of bad channel energy lower
|
|
62
62
|
than good channels.
|
|
@@ -72,6 +72,7 @@ def channel_checking(data, deg=10, thresh=5, continuity=True, adjacent=2,
|
|
|
72
72
|
"""
|
|
73
73
|
nch = len(data)
|
|
74
74
|
energy = np.log10(np.sum(data**2, axis=1))
|
|
75
|
+
energy[energy == -np.inf] = -308
|
|
75
76
|
|
|
76
77
|
# Remove abnormal value by robust polynomial fitting.
|
|
77
78
|
fitted_energy, weights = robust_polyfit(energy, deg, thresh)
|
|
@@ -115,9 +116,10 @@ def _channel_location(track_pt):
|
|
|
115
116
|
idx_kp = np.where(tn >= 0)[0]
|
|
116
117
|
|
|
117
118
|
interp_ch = []
|
|
118
|
-
chn = np.floor(tn[idx_kp[0]])
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
chn = np.floor(tn[idx_kp[0]]).astype(int)
|
|
120
|
+
interp_ch.append([*track[idx_kp[0]], chn])
|
|
121
|
+
if abs(chn - tn[idx_kp[0]]) > 1e-6:
|
|
122
|
+
chn += 1
|
|
121
123
|
|
|
122
124
|
seg_interval = []
|
|
123
125
|
for i in range(1, len(idx_kp)):
|
|
@@ -130,12 +132,17 @@ def _channel_location(track_pt):
|
|
|
130
132
|
l_res = 0 # remaining fiber length before counting the next segment
|
|
131
133
|
# consider if the given channelnumber is not an integer
|
|
132
134
|
chn_res = tn[istart] - int(tn[istart])
|
|
135
|
+
if d_interp == 0:
|
|
136
|
+
while chn < int(tn[iend]):
|
|
137
|
+
chn += 1
|
|
138
|
+
interp_ch.append([*track[istart, :], chn])
|
|
139
|
+
continue
|
|
133
140
|
for j in range(istart, iend):
|
|
134
141
|
l_start = l_track[j] + l_res
|
|
135
142
|
|
|
136
143
|
# if tp segment length is large for more than one interval, get the
|
|
137
144
|
# channel loc
|
|
138
|
-
if l_start >= d_interp * (1 - chn_res):
|
|
145
|
+
if l_start >= d_interp * (1 - chn_res - 1e-6):
|
|
139
146
|
# floor int, num of channel available
|
|
140
147
|
n_chn_tp = int(l_start / d_interp + chn_res)
|
|
141
148
|
l_new = (np.arange(n_chn_tp) + 1 - chn_res) * d_interp - \
|
|
@@ -167,6 +174,10 @@ def _channel_location(track_pt):
|
|
|
167
174
|
elif l_start < d_interp:
|
|
168
175
|
l_res = l_start
|
|
169
176
|
|
|
177
|
+
if abs(tn[iend] - int(tn[iend])) > 1e-6:
|
|
178
|
+
chn += 1
|
|
179
|
+
interp_ch.append([*track[iend, :], chn])
|
|
180
|
+
|
|
170
181
|
return np.array(seg_interval), np.array(interp_ch)
|
|
171
182
|
|
|
172
183
|
|
|
@@ -352,3 +363,136 @@ def turning_points(data, data_type='coordinate', thresh=5, depth_info=False,
|
|
|
352
363
|
|
|
353
364
|
else:
|
|
354
365
|
raise ValueError('Data_type should be \'coordinate\' or \'waveform\'.')
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def _equally_spacing(channels, dist, dx):
|
|
369
|
+
if len(channels) > 20:
|
|
370
|
+
return _equally_spacing_2(channels, dist, dx)
|
|
371
|
+
else:
|
|
372
|
+
return _equally_spacing_1(channels, dist, dx)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def _equally_spacing_1(channels, dist, dx):
|
|
376
|
+
nch = len(channels)
|
|
377
|
+
residual = np.inf
|
|
378
|
+
for i in range(2 ** (nch - 2)):
|
|
379
|
+
state = bin(i)[2:].rjust(nch - 2, '0')
|
|
380
|
+
dist_new = [dist[0]]
|
|
381
|
+
channels_new = [channels[0]]
|
|
382
|
+
idx = 0
|
|
383
|
+
for j, s in enumerate(state):
|
|
384
|
+
if s == '0':
|
|
385
|
+
dist_new[idx] += dist[j+1]
|
|
386
|
+
else:
|
|
387
|
+
dist_new.append(dist[j+1])
|
|
388
|
+
channels_new.append(channels[j+1])
|
|
389
|
+
idx += 1
|
|
390
|
+
res = sum([abs(d - dx) for d in dist_new])
|
|
391
|
+
if res < residual:
|
|
392
|
+
residual = res
|
|
393
|
+
dist_equal = dist_new
|
|
394
|
+
channels_equal = channels_new
|
|
395
|
+
channels_equal.append(channels[-1])
|
|
396
|
+
return channels_equal, dist_equal
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
def _equally_spacing_2(channels, dist, dx):
|
|
400
|
+
channels_equal = [channels[0]]
|
|
401
|
+
dist_equal = []
|
|
402
|
+
i = 0
|
|
403
|
+
while i < len(dist):
|
|
404
|
+
d = dist[i]
|
|
405
|
+
if d < dx and i < len(dist) - 1:
|
|
406
|
+
d1 = d + dist[i + 1]
|
|
407
|
+
while d1 < dx and i < len(dist) - 2:
|
|
408
|
+
d = d1
|
|
409
|
+
i += 1
|
|
410
|
+
d1 += dist[i + 1]
|
|
411
|
+
if abs(d - dx) <= abs(d1 - dx):
|
|
412
|
+
channels_equal.append(channels[i + 1])
|
|
413
|
+
dist_equal.append(d)
|
|
414
|
+
else:
|
|
415
|
+
i += 1
|
|
416
|
+
channels_equal.append(channels[i + 1])
|
|
417
|
+
dist_equal.append(d1)
|
|
418
|
+
else:
|
|
419
|
+
channels_equal.append(channels[i + 1])
|
|
420
|
+
dist_equal.append(d)
|
|
421
|
+
i += 1
|
|
422
|
+
|
|
423
|
+
return channels_equal, dist_equal
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def equally_spaced_channels(geometry, dx, depth_info=False, verbose=False):
|
|
427
|
+
"""
|
|
428
|
+
Find equally spaced channel numbers based on known DAS latitude and
|
|
429
|
+
longitude.
|
|
430
|
+
|
|
431
|
+
:param geometry: numpy.ndarray. DAS geometry used to filter equally spaced
|
|
432
|
+
channels. It needs to consist of longitude, latitude (and depth) or
|
|
433
|
+
channel number, longitude, latitude (and depth).
|
|
434
|
+
:param dx: Channel interval.
|
|
435
|
+
:param depth_info: bool. Whether depth (in meters) is included in the
|
|
436
|
+
geometry and needed to be used.
|
|
437
|
+
:param verbose: bool. If True, return channel numbers for equally spaced
|
|
438
|
+
channels and channel intervals.
|
|
439
|
+
:return: Channel numbers for equally spaced channels if verbose is False.
|
|
440
|
+
"""
|
|
441
|
+
nch = len(geometry)
|
|
442
|
+
if geometry.shape[1] == 2 + int(depth_info):
|
|
443
|
+
channels = np.arange(nch).astype(int)
|
|
444
|
+
else:
|
|
445
|
+
geometry = geometry[geometry[:, 0].argsort()]
|
|
446
|
+
channels = geometry[:, 0].astype(int)
|
|
447
|
+
geometry = geometry[:, 1:]
|
|
448
|
+
|
|
449
|
+
dist = np.zeros(nch - 1)
|
|
450
|
+
for i in range(nch - 1):
|
|
451
|
+
lon0, lat0 = geometry[i, :2]
|
|
452
|
+
lon1, lat1 = geometry[i+1, :2]
|
|
453
|
+
d = Geodesic.WGS84.Inverse(lat0, lon0, lat1, lon1)['s12']
|
|
454
|
+
if depth_info:
|
|
455
|
+
dist[i] = np.sqrt(d**2 + (geometry[i+1, 2] - geometry[i, 2]) ** 2)
|
|
456
|
+
else:
|
|
457
|
+
dist[i] = d
|
|
458
|
+
|
|
459
|
+
channels_equal = [channels[0]]
|
|
460
|
+
dist_equal = []
|
|
461
|
+
channels_seg = []
|
|
462
|
+
dist_seg = []
|
|
463
|
+
flag = False
|
|
464
|
+
for i in range(1, nch-1):
|
|
465
|
+
if dist[i-1] + dist[i] <= dx * 1.5:
|
|
466
|
+
channels_seg.append(channels[i-1])
|
|
467
|
+
dist_seg.append(dist[i-1])
|
|
468
|
+
else:
|
|
469
|
+
if len(channels_seg):
|
|
470
|
+
channels_seg.extend(channels[i-1:i+1])
|
|
471
|
+
dist_seg.append(dist[i-1])
|
|
472
|
+
channels_seg, dist_seg = _equally_spacing(channels_seg,
|
|
473
|
+
dist_seg, dx)
|
|
474
|
+
dist_equal.extend(dist_seg)
|
|
475
|
+
channels_equal.extend(channels_seg[1:])
|
|
476
|
+
channels_seg = []
|
|
477
|
+
dist_seg = []
|
|
478
|
+
flag = False
|
|
479
|
+
else:
|
|
480
|
+
if flag:
|
|
481
|
+
channels_equal.append(channels[i-1])
|
|
482
|
+
dist_equal.append(dist[i-1])
|
|
483
|
+
else:
|
|
484
|
+
flag = True
|
|
485
|
+
|
|
486
|
+
if len(channels_seg):
|
|
487
|
+
channels_seg.extend(channels[i:i+2])
|
|
488
|
+
dist_seg.append(dist[i])
|
|
489
|
+
channels_seg, dist_seg = _equally_spacing(channels_seg, dist_seg, dx)
|
|
490
|
+
dist_equal.extend(dist_seg)
|
|
491
|
+
channels_equal.extend(channels_seg[1:])
|
|
492
|
+
else:
|
|
493
|
+
channels_equal.extend(channels[-2:])
|
|
494
|
+
dist_equal.extend(dist[-2:])
|
|
495
|
+
|
|
496
|
+
if verbose:
|
|
497
|
+
return channels_equal, dist_equal
|
|
498
|
+
return channels_equal
|
|
@@ -59,7 +59,7 @@ def fk_fan_mask(f, k, fmin=None, fmax=None, kmin=None, kmax=None, vmin=None,
|
|
|
59
59
|
return mask
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
def fk_filter(data, dx, fs, taper=(0.02, 0.05), pad='default', mode='decompose',
|
|
62
|
+
def fk_filter(data, dx, fs, taper=(0.02, 0.05), pad='default', mode='decompose',
|
|
63
63
|
fmin=None, fmax=None, kmin=None, kmax=None, vmin=None, vmax=None,
|
|
64
64
|
edge=0.1, flag=None, verbose=False):
|
|
65
65
|
"""
|
|
@@ -172,7 +172,7 @@ def curvelet_denoising(data, choice=0, pad=0.3, noise=None, noise_perc=95,
|
|
|
172
172
|
flag=0, dx=None, fs=None, mode='remove',
|
|
173
173
|
scale_begin=3, nbscales=None, nbangles=16, finest=2):
|
|
174
174
|
"""
|
|
175
|
-
Use curevelet transform to filter stochastic or/and
|
|
175
|
+
Use curevelet transform to filter stochastic or/and coherent noise.
|
|
176
176
|
Modified from
|
|
177
177
|
https://github.com/atterholt/curvelet-denoising/blob/main/CurveletDenoising.m
|
|
178
178
|
{Atterholt et al., 2022 , Geophys. J. Int.}
|
|
@@ -23,7 +23,7 @@ def phase2strain(data, lam, e, n, gl):
|
|
|
23
23
|
return data * (lam * 1e-9) / (e * 4 * np.pi * n * gl)
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
def normalization(data, method='z-score'):
|
|
26
|
+
def normalization(data, method='z-score', **kwargs):
|
|
27
27
|
"""
|
|
28
28
|
Normalize for each individual channel using Z-score method.
|
|
29
29
|
|
|
@@ -46,6 +46,9 @@ def normalization(data, method='z-score'):
|
|
|
46
46
|
mean = np.mean(data, axis=1, keepdims=True)
|
|
47
47
|
std = np.std(data, axis=1, keepdims=True)
|
|
48
48
|
std[std == 0] = std[std > 0].min()
|
|
49
|
+
if 'p' in kwargs.keys():
|
|
50
|
+
thresh = np.percentile(std, kwargs['p'])
|
|
51
|
+
std[std > thresh] = thresh
|
|
49
52
|
return (data - mean) / std
|
|
50
53
|
|
|
51
54
|
if method == 'one-bit':
|
|
@@ -72,7 +75,7 @@ def detrending(data):
|
|
|
72
75
|
return detrend(data, type='linear')
|
|
73
76
|
|
|
74
77
|
|
|
75
|
-
def stacking(data: np.ndarray, N: int, step: int = None, average: bool =
|
|
78
|
+
def stacking(data: np.ndarray, N: int, step: int = None, average: bool = True):
|
|
76
79
|
"""
|
|
77
80
|
Stack several channels to increase the signal-noise ratio(SNR).
|
|
78
81
|
|
|
@@ -98,7 +101,7 @@ def stacking(data: np.ndarray, N: int, step: int = None, average: bool = False):
|
|
|
98
101
|
return data_stacked
|
|
99
102
|
|
|
100
103
|
|
|
101
|
-
def cosine_taper(data, p=0.1):
|
|
104
|
+
def cosine_taper(data, p=0.1, side='both'):
|
|
102
105
|
"""
|
|
103
106
|
Taper using Tukey window.
|
|
104
107
|
|
|
@@ -107,18 +110,23 @@ def cosine_taper(data, p=0.1):
|
|
|
107
110
|
of Tukey taper for corresponding dimension (ranging from 0 to 1).
|
|
108
111
|
Default is 0.1 which tapers 5% from the beginning and 5% from the end.
|
|
109
112
|
If only one float is given, it only do for time dimension.
|
|
113
|
+
:param side: str. 'both', 'left', or 'right'.
|
|
110
114
|
:return: Tapered data.
|
|
111
115
|
"""
|
|
112
|
-
if
|
|
113
|
-
|
|
116
|
+
if data.ndim == 1:
|
|
117
|
+
data = data.reshape(1, -1)
|
|
114
118
|
nch, nt = data.shape
|
|
115
|
-
win = np.ones_like(data)
|
|
116
119
|
if not isinstance(p, (tuple, list, np.ndarray)):
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
win = tukey(nt, p)
|
|
121
|
+
if side == 'left':
|
|
122
|
+
win[round(nch/2):] = 1
|
|
123
|
+
elif side == 'right':
|
|
124
|
+
win[:round(len(win)/2)] = 1
|
|
125
|
+
return data * np.tile(win, (nch, 1))
|
|
126
|
+
else:
|
|
127
|
+
if p[0] > 0:
|
|
128
|
+
data = data * np.tile(tukey(nch, p[0]), (nt, 1)).T
|
|
129
|
+
return cosine_taper(data, p[1], side=side)
|
|
122
130
|
|
|
123
131
|
|
|
124
132
|
def downsampling(data, xint=None, tint=None, stack=True, lowpass_filter=True):
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Purpose: Plot data
|
|
2
2
|
# Author: Minzhe Hu
|
|
3
|
-
# Date: 2024.
|
|
3
|
+
# Date: 2024.11.8
|
|
4
4
|
# Email: hmz2018@mail.ustc.edu.cn
|
|
5
5
|
import numpy as np
|
|
6
6
|
import matplotlib.pyplot as plt
|
|
7
|
-
from copy import deepcopy
|
|
8
7
|
from collections.abc import Sequence
|
|
9
8
|
|
|
10
9
|
|
|
11
10
|
def plot(data: np.ndarray, dx=None, fs=None, ax=None, obj='waveform', dpi=150,
|
|
12
11
|
title=None, transpose=False, t0=0, x0=0, pick=None, f=None, k=None,
|
|
13
|
-
t=None, c=None, cmap=None, vmin=None, vmax=None,
|
|
14
|
-
tmode='time', xlim=None, ylim=None, xlog=False,
|
|
15
|
-
yinv=False, xlabel=True, ylabel=True,
|
|
16
|
-
yticklabels=True, colorbar=True, colorbar_label=None,
|
|
12
|
+
t=None, c=None, cmap=None, vmin=None, vmax=None, dB=False,
|
|
13
|
+
xmode='distance', tmode='time', xlim=None, ylim=None, xlog=False,
|
|
14
|
+
ylog=False, xinv=False, yinv=False, xlabel=True, ylabel=True,
|
|
15
|
+
xticklabels=True, yticklabels=True, colorbar=True, colorbar_label=None,
|
|
16
|
+
savefig=None):
|
|
17
17
|
"""
|
|
18
18
|
Plot several types of 2-D seismological data.
|
|
19
19
|
|
|
@@ -38,6 +38,7 @@ def plot(data: np.ndarray, dx=None, fs=None, ax=None, obj='waveform', dpi=150,
|
|
|
38
38
|
:param cmap: str or Colormap. The Colormap instance or registered colormap
|
|
39
39
|
name used to map scalar data to colors.
|
|
40
40
|
:param vmin, vmax: Define the data range that the colormap covers.
|
|
41
|
+
:param dB: bool. Transfer data unit to dB and take 1 as the reference value.
|
|
41
42
|
:param xmode: str. 'distance' or 'channel'.
|
|
42
43
|
:param tmode: str. 'time' or 'sampling'.
|
|
43
44
|
:param xlim, ylim: Set the x-axis and y-axis view limits.
|
|
@@ -93,6 +94,8 @@ def plot(data: np.ndarray, dx=None, fs=None, ax=None, obj='waveform', dpi=150,
|
|
|
93
94
|
elif obj in ['spectrum', 'spectrogram', 'fk', 'dispersion']:
|
|
94
95
|
if isinstance(data[0,0], (complex, np.complex64)):
|
|
95
96
|
data = abs(data)
|
|
97
|
+
if dB:
|
|
98
|
+
data = 20 * np.log10(data)
|
|
96
99
|
cmap = 'jet' if cmap is None else cmap
|
|
97
100
|
vmax = np.percentile(abs(data), 80) if vmax is None else vmax
|
|
98
101
|
vmin = np.percentile(abs(data), 20) if vmin is None else vmin
|
|
@@ -120,7 +123,7 @@ def plot(data: np.ndarray, dx=None, fs=None, ax=None, obj='waveform', dpi=150,
|
|
|
120
123
|
data = data.T
|
|
121
124
|
origin = 'lower'
|
|
122
125
|
xlabel_default = 'Frequency (Hz)'
|
|
123
|
-
ylabel_default = '
|
|
126
|
+
ylabel_default = 'Velocity (m/s)'
|
|
124
127
|
extent = [min(f), max(f), min(c), max(c)]
|
|
125
128
|
|
|
126
129
|
if transpose:
|