doublef 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.
- doublef-0.1.0/PKG-INFO +188 -0
- doublef-0.1.0/README.md +167 -0
- doublef-0.1.0/pyproject.toml +38 -0
- doublef-0.1.0/setup.cfg +4 -0
- doublef-0.1.0/src/doublef/__init__.py +5 -0
- doublef-0.1.0/src/doublef/batch_cal_score.py +325 -0
- doublef-0.1.0/src/doublef/batch_weight.py +379 -0
- doublef-0.1.0/src/doublef/cal_score.py +295 -0
- doublef-0.1.0/src/doublef/cli.py +50 -0
- doublef-0.1.0/src/doublef/csv_tensor.py +105 -0
- doublef-0.1.0/src/doublef/get_tt.py +183 -0
- doublef-0.1.0/src/doublef/main.py +329 -0
- doublef-0.1.0/src/doublef/multiple_iteration.py +112 -0
- doublef-0.1.0/src/doublef/sampling.py +231 -0
- doublef-0.1.0/src/doublef/transfer_pick.py +58 -0
- doublef-0.1.0/src/doublef/visual.py +85 -0
- doublef-0.1.0/src/doublef/weight.py +407 -0
- doublef-0.1.0/src/doublef/write_results.py +480 -0
- doublef-0.1.0/src/doublef.egg-info/PKG-INFO +188 -0
- doublef-0.1.0/src/doublef.egg-info/SOURCES.txt +22 -0
- doublef-0.1.0/src/doublef.egg-info/dependency_links.txt +1 -0
- doublef-0.1.0/src/doublef.egg-info/entry_points.txt +2 -0
- doublef-0.1.0/src/doublef.egg-info/requires.txt +13 -0
- doublef-0.1.0/src/doublef.egg-info/top_level.txt +1 -0
doublef-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: doublef
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: DoubleF: A fast and flexible phase association and earthquake location method
|
|
5
|
+
Author-email: Longfei Duan <duanlongfei20@mails.ucas.ac.cn>
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: matplotlib==3.9.4
|
|
9
|
+
Requires-Dist: numpy==1.26.3
|
|
10
|
+
Requires-Dist: obspy==1.4.2
|
|
11
|
+
Requires-Dist: pandas==2.3.0
|
|
12
|
+
Requires-Dist: pyrocko==2025.1.21
|
|
13
|
+
Requires-Dist: scipy==1.13.1
|
|
14
|
+
Requires-Dist: sobol-seq==0.2.0
|
|
15
|
+
Requires-Dist: torch==2.3.1
|
|
16
|
+
Requires-Dist: torchaudio==2.3.1
|
|
17
|
+
Requires-Dist: torchvision==0.18.1
|
|
18
|
+
Requires-Dist: tqdm==4.67.1
|
|
19
|
+
Requires-Dist: natsort==8.4.0
|
|
20
|
+
Requires-Dist: pillow==10.4.0
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# DoubleF
|
|
24
|
+
|
|
25
|
+
**DoubleF** is a fast and flexible algorithm for seismic phase association and earthquake location. It uses an adaptive Sobol sampling strategy to efficiently search the source parameter space. The algorithm initializes a quasi-uniform sample set using a Sobol sequence. At each iteration, the objective function is evaluated, and the search region is refined based on the top-performing samples. This iterative narrowing continues until convergence. The highest-scoring sample is then selected, and associated phases within a residual threshold are included as the optimal event.
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
## Environment Setup and Installation
|
|
30
|
+
|
|
31
|
+
A dedicated Conda environment is recommended.
|
|
32
|
+
|
|
33
|
+
### Create a Conda environment
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
conda create -n doublef python=3.9
|
|
37
|
+
conda activate doublef
|
|
38
|
+
pip install doublef
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If you prefer to install from source inside the environment:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
conda create -n doublef python=3.9
|
|
45
|
+
conda activate doublef
|
|
46
|
+
git clone https://github.com/Lonngfei/DoubleF.git
|
|
47
|
+
cd DoubleF
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### GPU support
|
|
53
|
+
|
|
54
|
+
If you plan to run DoubleF on a GPU, make sure that your **PyTorch** version matches your **CUDA** version.
|
|
55
|
+
|
|
56
|
+
Please refer to the official PyTorch installation guide: [https://pytorch.org/get-started/previous-versions](https://pytorch.org/get-started/previous-versions).
|
|
57
|
+
|
|
58
|
+
### Confirm CUDA availability
|
|
59
|
+
|
|
60
|
+
Run the following in Python:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
import torch
|
|
64
|
+
print(torch.cuda.is_available())
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
* `True`: CUDA is available and PyTorch can use your GPU.
|
|
68
|
+
* `False`: Check the NVIDIA driver and CUDA-PyTorch compatibility.
|
|
69
|
+
|
|
70
|
+
### Show program information
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
doublef
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This prints the program name, version, and basic usage information.
|
|
77
|
+
|
|
78
|
+
## Input Files
|
|
79
|
+
|
|
80
|
+
Before running DoubleF, make sure the required input files are correctly prepared.
|
|
81
|
+
|
|
82
|
+
Typical inputs include:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
Picks/YYYYMMDD.csv # Daily pick files
|
|
86
|
+
TravelTime/mymodel.nd # Velocity model used for travel-time calculation
|
|
87
|
+
example.config # Configuration file
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The exact directory structure can be adjusted in the configuration file.
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
DoubleF is controlled through a configuration file such as `example.config`.
|
|
95
|
+
|
|
96
|
+
Most parameters do not need frequent modification. In most cases, only a few settings require special attention.
|
|
97
|
+
|
|
98
|
+
### 1. Velocity model and travel-time table
|
|
99
|
+
|
|
100
|
+
Set `cal_tt = True` when using a new velocity model.
|
|
101
|
+
|
|
102
|
+
This is usually required only once to generate the travel-time tables.
|
|
103
|
+
|
|
104
|
+
After the tables have been generated, set: `cal_tt = False`, so that the program loads the existing tables and skips recalculation.
|
|
105
|
+
|
|
106
|
+
### 2. Sampling parameters
|
|
107
|
+
|
|
108
|
+
In most applications, the default sampling settings are sufficient.
|
|
109
|
+
|
|
110
|
+
If the nearest-station distance is larger than **0.6°**, increasing the number of samples may improve the results.
|
|
111
|
+
|
|
112
|
+
### 3. Score calculation
|
|
113
|
+
|
|
114
|
+
DoubleF provides several alternative objective functions.
|
|
115
|
+
|
|
116
|
+
In most cases, the choice among these objective functions does not significantly affect the final results.
|
|
117
|
+
|
|
118
|
+
Users who are familiar with the method may further customize the scoring strategy if needed.
|
|
119
|
+
|
|
120
|
+
A custom objective function can be implemented by modifying: ``weight.py``, ``batch_weight.py`` in the source code.
|
|
121
|
+
|
|
122
|
+
### 4. Output settings
|
|
123
|
+
|
|
124
|
+
Set the output directory and related options according to your needs.
|
|
125
|
+
|
|
126
|
+
DoubleF automatically writes:
|
|
127
|
+
|
|
128
|
+
* logs
|
|
129
|
+
* configuration records
|
|
130
|
+
* phase association results
|
|
131
|
+
|
|
132
|
+
to the specified output path.
|
|
133
|
+
|
|
134
|
+
### 5. Memory and speed
|
|
135
|
+
|
|
136
|
+
#### `max_batch_size`
|
|
137
|
+
|
|
138
|
+
This parameter only affects computational efficiency and does **not** affect the final results.
|
|
139
|
+
|
|
140
|
+
In general, a larger value may improve speed, but this is not always the case.
|
|
141
|
+
|
|
142
|
+
Once the computation reaches saturation, further increasing `max_batch_size` may provide little or no additional speedup, while leading to higher memory usage.
|
|
143
|
+
|
|
144
|
+
### 6. Visualization
|
|
145
|
+
|
|
146
|
+
Visualization is usually recommended to be turned off during normal runs.
|
|
147
|
+
|
|
148
|
+
It should only be enabled when intermediate inspection, debugging, or result checking is needed.
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## Running the Program
|
|
152
|
+
|
|
153
|
+
Once the input files and configuration file are ready, run:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
doublef example.config
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
If the installation and configuration are correct, DoubleF will start processing and write logs and results to the output directory.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## Output Phase File Format
|
|
163
|
+
|
|
164
|
+
A typical output phase file has the following format:
|
|
165
|
+
|
|
166
|
+
```text
|
|
167
|
+
# Year Month Day Hour Minute Second Latitude Longitude Depth Magnitude ErrHorizontal ErrVertical ErrTime RMS NumP NumS NumBoth NumSum ID
|
|
168
|
+
NET Station Distance PhaseTime Probability PhaseType Residual ML Mag Amplitude
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Notes
|
|
172
|
+
|
|
173
|
+
* `ErrHorizontal`, `ErrVertical`, and `ErrTime` do not necessarily represent the true location uncertainty.
|
|
174
|
+
* These values describe the spatial dispersion of candidate solutions that are associated with the same nearby location. Specifically, they quantify the statistical deviation (e.g., mean or standard deviation) of these candidate locations relative to the final solution.
|
|
175
|
+
* If only a single candidate solution exists, the dispersion cannot be computed and the value is reported as **NaN**.
|
|
176
|
+
* When these values are unusually large or reported as NaN, the corresponding results should be interpreted with caution.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
## Recommended Citation
|
|
180
|
+
|
|
181
|
+
If you use DoubleF in your research, please cite the related paper(s).
|
|
182
|
+
|
|
183
|
+
## Contact
|
|
184
|
+
|
|
185
|
+
For questions, suggestions, or bug reports, please open an issue on GitHub or contact:
|
|
186
|
+
|
|
187
|
+
**Longfei Duan**
|
|
188
|
+
Email: [duanlongfei20@mails.ucas.ac.cn](mailto:duanlongfei20@mails.ucas.ac.cn)
|
doublef-0.1.0/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
|
|
2
|
+
# DoubleF
|
|
3
|
+
|
|
4
|
+
**DoubleF** is a fast and flexible algorithm for seismic phase association and earthquake location. It uses an adaptive Sobol sampling strategy to efficiently search the source parameter space. The algorithm initializes a quasi-uniform sample set using a Sobol sequence. At each iteration, the objective function is evaluated, and the search region is refined based on the top-performing samples. This iterative narrowing continues until convergence. The highest-scoring sample is then selected, and associated phases within a residual threshold are included as the optimal event.
|
|
5
|
+
|
|
6
|
+

|
|
7
|
+
|
|
8
|
+
## Environment Setup and Installation
|
|
9
|
+
|
|
10
|
+
A dedicated Conda environment is recommended.
|
|
11
|
+
|
|
12
|
+
### Create a Conda environment
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
conda create -n doublef python=3.9
|
|
16
|
+
conda activate doublef
|
|
17
|
+
pip install doublef
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If you prefer to install from source inside the environment:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
conda create -n doublef python=3.9
|
|
24
|
+
conda activate doublef
|
|
25
|
+
git clone https://github.com/Lonngfei/DoubleF.git
|
|
26
|
+
cd DoubleF
|
|
27
|
+
pip install .
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### GPU support
|
|
32
|
+
|
|
33
|
+
If you plan to run DoubleF on a GPU, make sure that your **PyTorch** version matches your **CUDA** version.
|
|
34
|
+
|
|
35
|
+
Please refer to the official PyTorch installation guide: [https://pytorch.org/get-started/previous-versions](https://pytorch.org/get-started/previous-versions).
|
|
36
|
+
|
|
37
|
+
### Confirm CUDA availability
|
|
38
|
+
|
|
39
|
+
Run the following in Python:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import torch
|
|
43
|
+
print(torch.cuda.is_available())
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
* `True`: CUDA is available and PyTorch can use your GPU.
|
|
47
|
+
* `False`: Check the NVIDIA driver and CUDA-PyTorch compatibility.
|
|
48
|
+
|
|
49
|
+
### Show program information
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
doublef
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This prints the program name, version, and basic usage information.
|
|
56
|
+
|
|
57
|
+
## Input Files
|
|
58
|
+
|
|
59
|
+
Before running DoubleF, make sure the required input files are correctly prepared.
|
|
60
|
+
|
|
61
|
+
Typical inputs include:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Picks/YYYYMMDD.csv # Daily pick files
|
|
65
|
+
TravelTime/mymodel.nd # Velocity model used for travel-time calculation
|
|
66
|
+
example.config # Configuration file
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The exact directory structure can be adjusted in the configuration file.
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
DoubleF is controlled through a configuration file such as `example.config`.
|
|
74
|
+
|
|
75
|
+
Most parameters do not need frequent modification. In most cases, only a few settings require special attention.
|
|
76
|
+
|
|
77
|
+
### 1. Velocity model and travel-time table
|
|
78
|
+
|
|
79
|
+
Set `cal_tt = True` when using a new velocity model.
|
|
80
|
+
|
|
81
|
+
This is usually required only once to generate the travel-time tables.
|
|
82
|
+
|
|
83
|
+
After the tables have been generated, set: `cal_tt = False`, so that the program loads the existing tables and skips recalculation.
|
|
84
|
+
|
|
85
|
+
### 2. Sampling parameters
|
|
86
|
+
|
|
87
|
+
In most applications, the default sampling settings are sufficient.
|
|
88
|
+
|
|
89
|
+
If the nearest-station distance is larger than **0.6°**, increasing the number of samples may improve the results.
|
|
90
|
+
|
|
91
|
+
### 3. Score calculation
|
|
92
|
+
|
|
93
|
+
DoubleF provides several alternative objective functions.
|
|
94
|
+
|
|
95
|
+
In most cases, the choice among these objective functions does not significantly affect the final results.
|
|
96
|
+
|
|
97
|
+
Users who are familiar with the method may further customize the scoring strategy if needed.
|
|
98
|
+
|
|
99
|
+
A custom objective function can be implemented by modifying: ``weight.py``, ``batch_weight.py`` in the source code.
|
|
100
|
+
|
|
101
|
+
### 4. Output settings
|
|
102
|
+
|
|
103
|
+
Set the output directory and related options according to your needs.
|
|
104
|
+
|
|
105
|
+
DoubleF automatically writes:
|
|
106
|
+
|
|
107
|
+
* logs
|
|
108
|
+
* configuration records
|
|
109
|
+
* phase association results
|
|
110
|
+
|
|
111
|
+
to the specified output path.
|
|
112
|
+
|
|
113
|
+
### 5. Memory and speed
|
|
114
|
+
|
|
115
|
+
#### `max_batch_size`
|
|
116
|
+
|
|
117
|
+
This parameter only affects computational efficiency and does **not** affect the final results.
|
|
118
|
+
|
|
119
|
+
In general, a larger value may improve speed, but this is not always the case.
|
|
120
|
+
|
|
121
|
+
Once the computation reaches saturation, further increasing `max_batch_size` may provide little or no additional speedup, while leading to higher memory usage.
|
|
122
|
+
|
|
123
|
+
### 6. Visualization
|
|
124
|
+
|
|
125
|
+
Visualization is usually recommended to be turned off during normal runs.
|
|
126
|
+
|
|
127
|
+
It should only be enabled when intermediate inspection, debugging, or result checking is needed.
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## Running the Program
|
|
131
|
+
|
|
132
|
+
Once the input files and configuration file are ready, run:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
doublef example.config
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If the installation and configuration are correct, DoubleF will start processing and write logs and results to the output directory.
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
## Output Phase File Format
|
|
142
|
+
|
|
143
|
+
A typical output phase file has the following format:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
# Year Month Day Hour Minute Second Latitude Longitude Depth Magnitude ErrHorizontal ErrVertical ErrTime RMS NumP NumS NumBoth NumSum ID
|
|
147
|
+
NET Station Distance PhaseTime Probability PhaseType Residual ML Mag Amplitude
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Notes
|
|
151
|
+
|
|
152
|
+
* `ErrHorizontal`, `ErrVertical`, and `ErrTime` do not necessarily represent the true location uncertainty.
|
|
153
|
+
* These values describe the spatial dispersion of candidate solutions that are associated with the same nearby location. Specifically, they quantify the statistical deviation (e.g., mean or standard deviation) of these candidate locations relative to the final solution.
|
|
154
|
+
* If only a single candidate solution exists, the dispersion cannot be computed and the value is reported as **NaN**.
|
|
155
|
+
* When these values are unusually large or reported as NaN, the corresponding results should be interpreted with caution.
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Recommended Citation
|
|
159
|
+
|
|
160
|
+
If you use DoubleF in your research, please cite the related paper(s).
|
|
161
|
+
|
|
162
|
+
## Contact
|
|
163
|
+
|
|
164
|
+
For questions, suggestions, or bug reports, please open an issue on GitHub or contact:
|
|
165
|
+
|
|
166
|
+
**Longfei Duan**
|
|
167
|
+
Email: [duanlongfei20@mails.ucas.ac.cn](mailto:duanlongfei20@mails.ucas.ac.cn)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "doublef"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "DoubleF: A fast and flexible phase association and earthquake location method"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Longfei Duan", email = "duanlongfei20@mails.ucas.ac.cn" }
|
|
13
|
+
]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"matplotlib==3.9.4",
|
|
16
|
+
"numpy==1.26.3",
|
|
17
|
+
"obspy==1.4.2",
|
|
18
|
+
"pandas==2.3.0",
|
|
19
|
+
"pyrocko==2025.1.21",
|
|
20
|
+
"scipy==1.13.1",
|
|
21
|
+
"sobol-seq==0.2.0",
|
|
22
|
+
"torch==2.3.1",
|
|
23
|
+
"torchaudio==2.3.1",
|
|
24
|
+
"torchvision==0.18.1",
|
|
25
|
+
"tqdm==4.67.1",
|
|
26
|
+
"natsort==8.4.0",
|
|
27
|
+
"pillow==10.4.0",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
doublef = "doublef.cli:main"
|
|
32
|
+
|
|
33
|
+
[tool.setuptools]
|
|
34
|
+
package-dir = {"" = "src"}
|
|
35
|
+
include-package-data = true
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
doublef-0.1.0/setup.cfg
ADDED