DASPy-toolbox 1.1.0__tar.gz → 1.1.2__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.
Files changed (56) hide show
  1. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/DASPy_toolbox.egg-info/PKG-INFO +32 -17
  2. daspy_toolbox-1.1.2/DASPy_toolbox.egg-info/SOURCES.txt +28 -0
  3. daspy_toolbox-1.1.2/LICENSE +21 -0
  4. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/PKG-INFO +32 -17
  5. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/README.md +15 -11
  6. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/channel.py +152 -8
  7. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/decomposition.py +1 -1
  8. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/denoising.py +1 -1
  9. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/basic_tools/preprocessing.py +19 -11
  10. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/basic_tools/visualization.py +26 -17
  11. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/collection.py +76 -42
  12. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/dasdatetime.py +31 -1
  13. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/read.py +41 -16
  14. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/section.py +58 -29
  15. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/write.py +17 -4
  16. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/setup.py +1 -1
  17. DASPy-toolbox-1.1.0/DASPy_toolbox.egg-info/SOURCES.txt +0 -52
  18. DASPy-toolbox-1.1.0/LICENSE.txt +0 -1
  19. DASPy-toolbox-1.1.0/daspy/core/make_example.py +0 -32
  20. DASPy-toolbox-1.1.0/daspy/seismic_detection/__init__.py +0 -1
  21. DASPy-toolbox-1.1.0/daspy/seismic_detection/calc_travel_time.py +0 -23
  22. DASPy-toolbox-1.1.0/daspy/seismic_detection/core.py +0 -119
  23. DASPy-toolbox-1.1.0/daspy/seismic_detection/detection.py +0 -12
  24. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/__init__.py +0 -13
  25. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/_base.py +0 -549
  26. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/_bayesian_mixture.py +0 -875
  27. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/_gaussian_mixture.py +0 -866
  28. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/app.py +0 -192
  29. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/seismic_ops.py +0 -478
  30. DASPy-toolbox-1.1.0/daspy/seismic_detection/gamma/utils.py +0 -512
  31. DASPy-toolbox-1.1.0/daspy/seismic_detection/location.py +0 -266
  32. DASPy-toolbox-1.1.0/daspy/seismic_detection/magnitude.py +0 -43
  33. DASPy-toolbox-1.1.0/daspy/seismic_detection/phase_picking.py +0 -67
  34. DASPy-toolbox-1.1.0/daspy/structure_imaging/__init__.py +0 -0
  35. DASPy-toolbox-1.1.0/daspy/structure_imaging/ambient_noise.py +0 -4
  36. DASPy-toolbox-1.1.0/daspy/structure_imaging/dispersion.py +0 -27
  37. DASPy-toolbox-1.1.0/daspy/structure_imaging/fault_zone.py +0 -59
  38. DASPy-toolbox-1.1.0/daspy/structure_imaging/inversion.py +0 -6
  39. DASPy-toolbox-1.1.0/daspy/traffic_monitoring/JamDetection.py +0 -6
  40. DASPy-toolbox-1.1.0/daspy/traffic_monitoring/SpeedMeasurement.py +0 -6
  41. DASPy-toolbox-1.1.0/daspy/traffic_monitoring/VehicleDetection.py +0 -6
  42. DASPy-toolbox-1.1.0/daspy/traffic_monitoring/__init__.py +0 -0
  43. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/DASPy_toolbox.egg-info/dependency_links.txt +0 -0
  44. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/DASPy_toolbox.egg-info/entry_points.txt +0 -0
  45. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/DASPy_toolbox.egg-info/requires.txt +0 -0
  46. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/DASPy_toolbox.egg-info/top_level.txt +0 -0
  47. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/__init__.py +0 -0
  48. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/__init__.py +0 -0
  49. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/fdct.py +0 -0
  50. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/advanced_tools/strain2vel.py +0 -0
  51. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/basic_tools/__init__.py +0 -0
  52. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/basic_tools/filter.py +0 -0
  53. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/basic_tools/freqattributes.py +0 -0
  54. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/__init__.py +0 -0
  55. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/daspy/core/example.pkl +0 -0
  56. {DASPy-toolbox-1.1.0 → daspy_toolbox-1.1.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: DASPy-toolbox
3
- Version: 1.1.0
3
+ Version: 1.1.2
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.txt
15
+ License-File: LICENSE
16
16
  Requires-Dist: numpy
17
17
  Requires-Dist: scipy>=1.13
18
18
  Requires-Dist: matplotlib
@@ -22,11 +22,27 @@ Requires-Dist: h5py
22
22
  Requires-Dist: segyio
23
23
  Requires-Dist: nptdms
24
24
  Requires-Dist: tqdm
25
-
26
- <img src="./website/USTC.svg" height="170" />&emsp;<img src="./website/DAMS.png" height="150" />
27
-
28
-
29
- ## DASPy
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: maintainer
32
+ Dynamic: maintainer-email
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ <img src="https://raw.github.com/hmz-03/daspy/main/website/logo.png" height="200" />
38
+
39
+ [![Supported Python versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12-blue)](https://pypi.org/project/DASPy-toolbox/)
40
+ [![License](https://img.shields.io/pypi/l/daspy-toolbox.svg)](https://opensource.org/license/mit)
41
+ [![PyPI Version](https://img.shields.io/pypi/v/daspy-toolbox.svg)](https://pypi.org/project/DASPy-toolbox/)
42
+
43
+ [![DOI](https://img.shields.io/badge/DOI-10.1785/0220240124-blue.svg)](https://doi.org/10.1785/0220240124)
44
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/daspy-toolbox.svg?label=pypi)](https://pypi.org/project/DASPy-toolbox/)
45
+ [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/daspy-toolbox?label=conda)](https://anaconda.org/conda-forge/daspy-toolbox)
30
46
 
31
47
  DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
32
48
 
@@ -34,15 +50,14 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
34
50
  * Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
35
51
  * Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
36
52
 
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 [the DASPy paper](document/srl-2024124.1.pdf) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
53
+ 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
54
 
39
55
  ## Installation
40
- DASPy is currently running on Linux, Windows and Mac OS.
41
- DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
56
+ DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
42
57
 
43
- ### Pip (recommanded)
58
+ ### Pip
44
59
  ```
45
- pip install DASPy-toolbox
60
+ pip install daspy-toolbox
46
61
  ```
47
62
 
48
63
  Install the latest version from GitHub:
@@ -51,16 +66,16 @@ Install the latest version from GitHub:
51
66
  pip install git+https://github.com/HMZ-03/DASPy.git
52
67
  ```
53
68
 
54
-
55
69
  ### Conda
70
+
56
71
  ```
57
- conda install -c hmz-03 daspy
72
+ conda install daspy-toolbox
58
73
  ```
59
74
 
60
- If an error is reported, please try updating conda:
75
+ or
61
76
 
62
77
  ```
63
- conda update -n base -c conda-forge conda
78
+ conda install conda-forge::daspy-toolbox
64
79
  ```
65
80
 
66
81
  ### Manual installation
@@ -0,0 +1,28 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ DASPy_toolbox.egg-info/PKG-INFO
5
+ DASPy_toolbox.egg-info/SOURCES.txt
6
+ DASPy_toolbox.egg-info/dependency_links.txt
7
+ DASPy_toolbox.egg-info/entry_points.txt
8
+ DASPy_toolbox.egg-info/requires.txt
9
+ DASPy_toolbox.egg-info/top_level.txt
10
+ daspy/__init__.py
11
+ daspy/advanced_tools/__init__.py
12
+ daspy/advanced_tools/channel.py
13
+ daspy/advanced_tools/decomposition.py
14
+ daspy/advanced_tools/denoising.py
15
+ daspy/advanced_tools/fdct.py
16
+ daspy/advanced_tools/strain2vel.py
17
+ daspy/basic_tools/__init__.py
18
+ daspy/basic_tools/filter.py
19
+ daspy/basic_tools/freqattributes.py
20
+ daspy/basic_tools/preprocessing.py
21
+ daspy/basic_tools/visualization.py
22
+ daspy/core/__init__.py
23
+ daspy/core/collection.py
24
+ daspy/core/dasdatetime.py
25
+ daspy/core/example.pkl
26
+ daspy/core/read.py
27
+ daspy/core/section.py
28
+ daspy/core/write.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
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: DASPy-toolbox
3
- Version: 1.1.0
3
+ Version: 1.1.2
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.txt
15
+ License-File: LICENSE
16
16
  Requires-Dist: numpy
17
17
  Requires-Dist: scipy>=1.13
18
18
  Requires-Dist: matplotlib
@@ -22,11 +22,27 @@ Requires-Dist: h5py
22
22
  Requires-Dist: segyio
23
23
  Requires-Dist: nptdms
24
24
  Requires-Dist: tqdm
25
-
26
- <img src="./website/USTC.svg" height="170" />&emsp;<img src="./website/DAMS.png" height="150" />
27
-
28
-
29
- ## DASPy
25
+ Dynamic: author
26
+ Dynamic: author-email
27
+ Dynamic: classifier
28
+ Dynamic: description
29
+ Dynamic: home-page
30
+ Dynamic: license
31
+ Dynamic: maintainer
32
+ Dynamic: maintainer-email
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ <img src="https://raw.github.com/hmz-03/daspy/main/website/logo.png" height="200" />
38
+
39
+ [![Supported Python versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12-blue)](https://pypi.org/project/DASPy-toolbox/)
40
+ [![License](https://img.shields.io/pypi/l/daspy-toolbox.svg)](https://opensource.org/license/mit)
41
+ [![PyPI Version](https://img.shields.io/pypi/v/daspy-toolbox.svg)](https://pypi.org/project/DASPy-toolbox/)
42
+
43
+ [![DOI](https://img.shields.io/badge/DOI-10.1785/0220240124-blue.svg)](https://doi.org/10.1785/0220240124)
44
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/daspy-toolbox.svg?label=pypi)](https://pypi.org/project/DASPy-toolbox/)
45
+ [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/daspy-toolbox?label=conda)](https://anaconda.org/conda-forge/daspy-toolbox)
30
46
 
31
47
  DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
32
48
 
@@ -34,15 +50,14 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
34
50
  * Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
35
51
  * Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
36
52
 
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 [the DASPy paper](document/srl-2024124.1.pdf) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
53
+ 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
54
 
39
55
  ## Installation
40
- DASPy is currently running on Linux, Windows and Mac OS.
41
- DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
56
+ DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
42
57
 
43
- ### Pip (recommanded)
58
+ ### Pip
44
59
  ```
45
- pip install DASPy-toolbox
60
+ pip install daspy-toolbox
46
61
  ```
47
62
 
48
63
  Install the latest version from GitHub:
@@ -51,16 +66,16 @@ Install the latest version from GitHub:
51
66
  pip install git+https://github.com/HMZ-03/DASPy.git
52
67
  ```
53
68
 
54
-
55
69
  ### Conda
70
+
56
71
  ```
57
- conda install -c hmz-03 daspy
72
+ conda install daspy-toolbox
58
73
  ```
59
74
 
60
- If an error is reported, please try updating conda:
75
+ or
61
76
 
62
77
  ```
63
- conda update -n base -c conda-forge conda
78
+ conda install conda-forge::daspy-toolbox
64
79
  ```
65
80
 
66
81
  ### Manual installation
@@ -1,7 +1,12 @@
1
- <img src="./website/USTC.svg" height="170" />&emsp;<img src="./website/DAMS.png" height="150" />
1
+ <img src="https://raw.github.com/hmz-03/daspy/main/website/logo.png" height="200" />
2
2
 
3
+ [![Supported Python versions](https://img.shields.io/badge/python-3.9%20|%203.10%20|%203.11%20|%203.12-blue)](https://pypi.org/project/DASPy-toolbox/)
4
+ [![License](https://img.shields.io/pypi/l/daspy-toolbox.svg)](https://opensource.org/license/mit)
5
+ [![PyPI Version](https://img.shields.io/pypi/v/daspy-toolbox.svg)](https://pypi.org/project/DASPy-toolbox/)
3
6
 
4
- ## DASPy
7
+ [![DOI](https://img.shields.io/badge/DOI-10.1785/0220240124-blue.svg)](https://doi.org/10.1785/0220240124)
8
+ [![PyPI Downloads](https://img.shields.io/pypi/dm/daspy-toolbox.svg?label=pypi)](https://pypi.org/project/DASPy-toolbox/)
9
+ [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/daspy-toolbox?label=conda)](https://anaconda.org/conda-forge/daspy-toolbox)
5
10
 
6
11
  DASPy is an open-source project dedicated to provide a python package for DAS (Distributed Acoustic Sensing) data processing.
7
12
 
@@ -9,15 +14,14 @@ The goal of the DASPy project is to lower the bar of DAS data processing. DASPy
9
14
  * Classic seismic data processing techniques, including preprocessing, filter, spectrum analysis, and visualization
10
15
  * Specialized algorithms for DAS applications, including denoising, waveform decomposition, channel attribute analysis, and strain-velocity conversion.
11
16
 
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 [the DASPy paper](document/srl-2024124.1.pdf) is available. If you have any questions, please contact me via <hmz2018@mail.ustc.edu.cn>.
17
+ 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
18
 
14
19
  ## Installation
15
- DASPy is currently running on Linux, Windows and Mac OS.
16
- DASPy runs on Python 3.9 and up. We recommend you use the latest version of python 3 if possible.
20
+ DASPy runs on Linux, Windows and Mac OS and on Python 3.9 and up.
17
21
 
18
- ### Pip (recommanded)
22
+ ### Pip
19
23
  ```
20
- pip install DASPy-toolbox
24
+ pip install daspy-toolbox
21
25
  ```
22
26
 
23
27
  Install the latest version from GitHub:
@@ -26,16 +30,16 @@ Install the latest version from GitHub:
26
30
  pip install git+https://github.com/HMZ-03/DASPy.git
27
31
  ```
28
32
 
29
-
30
33
  ### Conda
34
+
31
35
  ```
32
- conda install -c hmz-03 daspy
36
+ conda install daspy-toolbox
33
37
  ```
34
38
 
35
- If an error is reported, please try updating conda:
39
+ or
36
40
 
37
41
  ```
38
- conda update -n base -c conda-forge conda
42
+ conda install conda-forge::daspy-toolbox
39
43
  ```
40
44
 
41
45
  ### 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.10.11
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 is
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)
@@ -83,7 +84,7 @@ def channel_checking(data, deg=10, thresh=5, continuity=True, adjacent=2,
83
84
  bad_chn = np.argwhere(deviation < -thresh * mad).ravel().tolist()
84
85
  elif mode == 'high':
85
86
  bad_chn = np.argwhere(deviation > thresh * mad).ravel().tolist()
86
- elif mode == 'high':
87
+ elif mode == 'both':
87
88
  bad_chn = np.argwhere(deviation < -thresh * mad).ravel().tolist() + \
88
89
  np.argwhere(deviation > thresh * mad).ravel().tolist()
89
90
  good_chn = list(set(range(nch)) - set(bad_chn))
@@ -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
- if abs(chn - tn[idx_kp[0]]) < 1e-6:
120
- interp_ch.append([*track[idx_kp[0]], chn])
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 cooherent noise.
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 = False):
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 len(data.shape) == 1:
113
- return data * tukey(len(data), p)
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
- p = (0, p)
118
-
119
- win *= np.tile(tukey(nch, p[0]), (nt, 1)).T
120
- win *= np.tile(tukey(nt, p[1]), (nch, 1))
121
- return data * win
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):