eqcctpro 0.4__tar.gz → 0.4.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.

Potentially problematic release.


This version of eqcctpro might be problematic. Click here for more details.

@@ -0,0 +1,366 @@
1
+ Metadata-Version: 2.2
2
+ Name: eqcctpro
3
+ Version: 0.4.2
4
+ Description-Content-Type: text/markdown
5
+ Requires-Dist: numpy==1.26.4
6
+ Requires-Dist: pandas==2.2.3
7
+ Requires-Dist: matplotlib==3.10.0
8
+ Requires-Dist: obspy==1.4.1
9
+ Requires-Dist: progress==1.6
10
+ Requires-Dist: psutil==6.1.1
11
+ Requires-Dist: ray==2.42.1
12
+ Requires-Dist: schedule==1.2.2
13
+ Requires-Dist: sdnotify==0.3.2
14
+ Requires-Dist: tensorflow<2.19,>=2.15
15
+ Requires-Dist: tensorflow-estimator<2.19,>=2.15
16
+ Requires-Dist: tensorflow-io-gcs-filesystem==0.37.1
17
+ Requires-Dist: tensorboard==2.15.2
18
+ Requires-Dist: tensorboard-data-server==0.7.2
19
+ Requires-Dist: silence-tensorflow==1.2.3
20
+ Requires-Dist: scipy==1.15.1
21
+ Requires-Dist: protobuf==4.25.6
22
+ Requires-Dist: grpcio==1.70.0
23
+ Requires-Dist: absl-py==2.1.0
24
+ Requires-Dist: h5py==3.12.1
25
+ Requires-Dist: pynvml==12.0.0
26
+ Dynamic: description
27
+ Dynamic: description-content-type
28
+ Dynamic: requires-dist
29
+
30
+ # EQCCTPro: powerful seismic event detection toolkit
31
+
32
+ EQCCTPro is a high-performace seismic event detection and processing framework that leverages EQCCT to process seismic data efficiently. It enables users to fully leverage the computational ability of their computing resources for maximum performance for simultaneous seismic waveform processing, achieving real-time performance by identifying and utilizing the optimal computational configurations for their hardware. More information about the development, capabilities, and real-world applications about EQCCTPro can be read about in our research publication here.
33
+
34
+ ## Features
35
+ - Supports both CPU and GPU execution
36
+ - Configurable parallelism execution for optimized performance
37
+ - Includes tools for evaluating system performance for optimal usecase configurations
38
+ - Automatic selection of best-usecase configurations
39
+ - Efficient handling of large-scale seismic data
40
+
41
+ ## Installation
42
+ To install `EQCCTPro`, there are two installation approaches:
43
+ 1. Install **EQCCTPro** out the box with no sample waveform data to test the application with
44
+ 2. Install **EQCCTPro** with the sample waveform data as provided from the Github folder
45
+
46
+ It is **highly** recommended you pull the `EQCCTPro` folder to gain access to the sample waveform data to help you get acquainted with **EQCCTPro** and its capabilites.
47
+
48
+ If you wish to install **only the EQCCTPro Python package and use it out of the box (method 1)**, run **`pip install eqcctpro`**. **You must have at least Python verison 3.10.14 for the application to run**.
49
+ You can install Python 3.10.14 using either traditional methods or do the following commands:
50
+
51
+ ```sh
52
+ [skevofilaxc] conda create --name yourname python=3.10.14 -y
53
+ [skevofilaxc] conda activate yourname
54
+ [skevofilaxc] python3 --version
55
+ Python 3.10.14 (it should return)
56
+ [skevofilaxc] pip install eqcctpro
57
+ ```
58
+ You will have access to **EQCCTPro** and its capabilities, however, it is **highly** recommended you pull the `EQCCTPro` folder to gain access to the sample waveform data and to get acquainted with **EQCCTPro**.
59
+ You can pull the `EQCCTPro` folder by running the following commands:
60
+
61
+ ```sh
62
+ [skevofilaxc] mkdir my_work_directory
63
+ [skevofilaxc] cd my_work_directory
64
+ [skevofilaxc] git clone --depth 1 --filter=tree:0 https://github.com/ut-beg-texnet/eqcct.git --sparse
65
+ [skevofilaxc] cd eqcct
66
+ [skevofilaxc] git sparse-checkout set eqcctpro
67
+ ```
68
+
69
+
70
+ If you wish to install **EQCCTPro** with the sample waveform data as originally intended, and or are having trouble installing Python 3.10.14, there has been a precreated conda environment under the `EQCCTPro` folder that will install the necessary packages
71
+ and dependencies needed for **EQCCTPro** to run (method 2).
72
+ You can pull the `EQCCTPro` folder, create the precreated conda environment, and activate it using the following commands:
73
+
74
+ ```sh
75
+ [skevofilaxc] mkdir my_work_directory
76
+ [skevofilaxc] cd my_work_directory
77
+ [skevofilaxc] git clone --depth 1 --filter=tree:0 https://github.com/ut-beg-texnet/eqcct.git --sparse
78
+ [skevofilaxc] cd eqcct
79
+ [skevofilaxc] git sparse-checkout set eqcctpro
80
+ [skevofilaxc] conda env create -f environment.yml
81
+ [skevofilaxc] conda activate eqcctpro
82
+ ```
83
+
84
+ After creating and activating the conda environment, install the **EQCCTPro Python package** using the following command:
85
+ ```sh
86
+ [skevofilaxc] pip install eqcctpro
87
+ ```
88
+ The pip package will install the remaining packages needed for **EQCCTPro** to work. More information on the package can be found at our PyPi project link [EQCCTPro](https://pypi.org/project/eqcctpro/).
89
+
90
+ ## Creating a Test Workspace Environment
91
+ It's highly suggested to create a workspace environment to first understand how eqcctpro works.
92
+ Sample seismic waveform data from 50 TexNet stations have provided in the eqcctpro repository under the `sample_1_minute_data.zip` file.
93
+
94
+ After downloading the .zip file, either individually or through the git pull methods, run the following command to unzip it:
95
+ ```sh
96
+ [skevofilaxc] unzip sample_1_minute_data.zip
97
+ ```
98
+ It's contents will look like:
99
+ ```sh
100
+ [skevofilaxc sample_1_minute_data]$ ls
101
+ AT01 CF01 DG05 EF54 EF76 HBVL MB09 MB21 MID02 ODSA PB16 PB25 PB35 PB52 PH02 SM03 WB11
102
+ BB01 CT02 DG09 EF63 FOAK4 HNDO MB13 MB25 MID03 PB04 PB17 PB26 PB39 PB54 PL01 SMWD WB12
103
+ BP01 DB02 EF02 EF75 FW13 MB06 MB19 MID01 MO01 PB11 PB18 PB34 PB42 PECS SM02 WB06
104
+ ```
105
+ Where each subdirectory is named after station code, and is made up of mSEED files of different poses:
106
+ ```sh
107
+ [skevofilaxc PB35]$ ls
108
+ TX.PB35.00.HH1__20241215T115800Z__20241215T120100Z.mseed TX.PB35.00.HHZ__20241215T115800Z__20241215T120100Z.mseed
109
+ TX.PB35.00.HH2__20241215T115800Z__20241215T120100Z.mseed
110
+ ```
111
+ EQCCT only needs one pose for the detection to occur, however more poses allow for better detection of the direction of the P and S waves.
112
+
113
+ You are now set up for testing.
114
+ ## Usage
115
+ There are three main capabilities of EQCCTPro:
116
+ 1. Process mSEED data from singular or multiple seismic stations using either CPUs or GPUs
117
+ 2. Evaluate your system to identify the optimal parallelization configurations needed to get the minimum runtime performance out of your system
118
+ 3. Identify and return back the optimal parallelization configurations for both specific and general-use usecases for both CPU (a) and GPU applications (b)
119
+
120
+ These capabilities are achieved by the following functions in order respect to the above descriptions:
121
+ **EQCCTMSeedRunner (1)**, **EvaluateSystem (2)**, **OptimalCPUConfigurationFinder (3a)**, **OptimalGPUConfigurationFinder (3b)**.
122
+
123
+ ### Processing mSEED data using EQCCTPro (EQCCTMSeedRunner)
124
+ To use EQCCTPro to process mSEED from various seismic stations, use the **EQCCTMSeedRunner** class.
125
+ **EQCCTMSeedRunner** enables users to process multiple mSEED from a given input directory. The input directory is made up of station directories such as:
126
+
127
+ ```sh
128
+ [skevofilaxc sample_1_minute_data]$ ls
129
+ AT01 CF01 DG05 EF54 EF76 HBVL MB09 MB21 MID02 ODSA PB16 PB25 PB35 PB52 PH02 SM03 WB11
130
+ BB01 CT02 DG09 EF63 FOAK4 HNDO MB13 MB25 MID03 PB04 PB17 PB26 PB39 PB54 PL01 SMWD WB12
131
+ BP01 DB02 EF02 EF75 FW13 MB06 MB19 MID01 MO01 PB11 PB18 PB34 PB42 PECS SM02 WB06
132
+ ```
133
+ Where each subdirectory is named after station code. If you wish to use create your own input directory with custom information, **please follow the above naming convention.** Otherwise, EQCCTPro will **not** work.
134
+
135
+ Within each subdirectory, such as PB35, it is made up of mSEED files of different poses (EX. N, E, Z):
136
+ ```sh
137
+ [skevofilaxc PB35]$ ls
138
+ TX.PB35.00.HH1__20241215T115800Z__20241215T120100Z.mseed TX.PB35.00.HHZ__20241215T115800Z__20241215T120100Z.mseed
139
+ TX.PB35.00.HH2__20241215T115800Z__20241215T120100Z.mseed
140
+ ```
141
+ EQCCT only needs one pose for the detection to occur, however more poses allow for better detection of the direction of the P and S waves.
142
+
143
+ After setting up or utilizing the provided sample waveform directory, and install eqcctpro, import **EQCCTMseedRunner** as show below:
144
+
145
+ ```python
146
+ from eqcctpro import EQCCTMSeedRunner
147
+
148
+ eqcct_runner = EQCCTMSeedRunner(
149
+ use_gpu=False,
150
+ intra_threads=1,
151
+ inter_threads=1,
152
+ cpu_id_list=[0,1,2,3,4],
153
+ input_dir='/path/to/mseed',
154
+ output_dir='/path/to/outputs',
155
+ log_filepath='/path/to/outputs/eqcctpro.log',
156
+ P_threshold=0.001,
157
+ S_threshold=0.02,
158
+ p_model_filepath='/path/to/model_p.h5',
159
+ s_model_filepath='/path/to/model_s.h5',
160
+ number_of_concurrent_predictions=5,
161
+ best_usecase_config=True,
162
+ csv_dir='/path/to/csv',
163
+ selected_gpus=[0],
164
+ set_vram_mb=24750,
165
+ specific_stations='AT01, BP01, DG05'
166
+ )
167
+ eqcct_runner.run_eqcctpro()
168
+ ```
169
+
170
+ **EQCCTMseedRunner** has multiple input paramters that need to be configured and are defined below:
171
+
172
+ - **`use_gpu (bool)`: True or False**
173
+ - Tells Ray to use either the GPU(s) (True) or CPUs (False) on your computer to process the waveforms in the entire workflow
174
+ - Further specification of which GPU(s) and CPU(s) are provided in the parameters below
175
+ - **`intra_threads (int)`: default = 1**
176
+ - Controls how many intra-parallelism threads Tensorflow can use
177
+ - **`inter_threads (int)`: default = 1**
178
+ - Controls how many inter-parallelism threads Tensorflow can use
179
+ - **`cpu_id_list (list)`: default = [1]**
180
+ - List that defines which specific CPU cores that sched_setaffinity will allocate for executing the current EQCCTPro process.
181
+ - Allows for specific allocation and limitation of CPUs for a given EQCCTPro process
182
+ - "I want this program to run only on these specific cores."
183
+ - **`input_dir (str)`**
184
+ - Directory path to the the mSEED directory
185
+ - EX. `/home/skevofilaxc/my_work_directory/eqcct/eqcctpro/sample_1_minute_data`
186
+ - **`output_dir (str)`**
187
+ - Directory path to where the output picks and logs will be sent
188
+ - Doesn't need to exist, will be created if doesn't exist
189
+ - Recommended to be in the same working directory as the input directory for convience
190
+ - **`log_filepath (str)`**
191
+ - Filepath to where the EQCCTPro log will be written to and stored
192
+ - Doesn't need to exist, will be created if doesn't exist
193
+ - Recommended to be **in** the **output directory** and called **eqcctpro.log**, however the name can be changed for your own purposes
194
+ - **`P_threshold (float)`: default = 0.001**
195
+ - Threshold in which the P probabilities above it will be considered as P arrival
196
+ - **`S_threshold (float)`: default = 0.02**
197
+ - Threshold in which the S probabilities above it will be considered as S arrival
198
+ - **`p_model_filepath (str)`**
199
+ - Filepath to where the P EQCCT detection model is stored
200
+ - **`s_model_filepath (str)`**
201
+ - Filepath to where the S EQCCT detection model is stored
202
+ - **`number_of_concurrent_predictions (int)`**
203
+ - The number of concurrent EQCCT detection tasks that can happen simultaneously on a given number of resources
204
+ - EX. if number_of_concurrent_predictions = 5, there will be up to 5 EQCCT instances analyzing 5 different waveforms at the sametime
205
+ - Best to use the optimal amount for your hardware, which can be identified using **EvaluateSystem** (below)
206
+ - **`best_usecase_config (bool)`: default = False**
207
+ - If True, will override inputted cpu_id_list, number_of_concurrent_predictions, intra_threads, inter_threads values for the best overall usecase configurations
208
+ - Best overall usecase configurations are defined as the best overall input configurations that minimize runtime while doing the most amount of processing with your available hardware
209
+ - Can only be used if EvaluateSystem has been run
210
+ - **`csv_dir (str)`**
211
+ - Directory path containing the CSV's outputted by EvaluateSystem that contain the trial data that will be used to find the best_usecase_config
212
+ - Script will look for specific files, will only exist if EvaluateSystem has been run
213
+ - **`selected_gpus (list)`: default = None**
214
+ - List of GPU IDs on your computer you want to use if `use_gpu = True`
215
+ - None existing GPU IDs will cause the code to exit
216
+ - **`set_vram_mb (float)`**
217
+ - Value of the maximum amount of VRAM EQCCTPro can use
218
+ - Must be a real value that is based on your hardware's physical memory space, if it exceeds the space the code will break due to **OutOfMemoryError**
219
+ - **`specific_stations (str)`: default = None**
220
+ - String that contains the "list" of stations you want to only analyze
221
+ - EX. Out of the 50 sample stations in `sample_1_minute_data`, if I only want to analyze AT01, BP01, DG05, then specific_stations='AT01, BP01, DG05'.
222
+ - Removes the need to move station directories around to be used as input, can contain all stations in one directory for access
223
+ - **`cpu_id_list (list)`: default = [1]**
224
+ - List that defines which specific CPU cores that sched_setaffinity will allocate for executing the current EQCCTPro process.
225
+ - Allows for specific allocation and limitation of CPUs for a given EQCCTPro process
226
+ - "I want this program to run only on these specific cores."
227
+ ### Evaluating Your Systems Runtime Performance Capabilites
228
+ To evaluate your system’s runtime performance capabilites for both your CPU(s) and GPU(s), the **EvaluateSystem** class allows you to autonomously evaluate your system:
229
+
230
+ ```python
231
+ from eqcctpro import EvaluateSystem
232
+
233
+ eval_gpu = EvaluateSystem(
234
+ mode='gpu',
235
+ intra_threads=1,
236
+ inter_threads=1,
237
+ input_dir='/path/to/mseed',
238
+ output_dir='/path/to/outputs',
239
+ log_filepath='/path/to/outputs/eqcctpro.log',
240
+ csv_dir='/path/to/csv',
241
+ P_threshold=0.001,
242
+ S_threshold=0.02,
243
+ p_model_filepath='/path/to/model_p.h5',
244
+ s_model_filepath='/path/to/model_s.h5',
245
+ stations2use=2,
246
+ cpu_id_list=[0,1],
247
+ set_vram_mb=24750,
248
+ selected_gpus=[0]
249
+ )
250
+ eval_gpu.evaluate()
251
+ ```
252
+ **EvaluateSystem** will iterate through different combinations of CPU(s), Concurrent Predictions, and Workloads (stations), as well as GPU(s), and the amount of VRAM (MB) each Concurrent Prediction can use.
253
+ **EvaluateSystem** will take time, depending on the number of CPU/GPUs, the amount of VRAM available, and the total workload that needs to be tested. However, after doing the testing once for most if not all usecases,
254
+ the trial data will be available and can be used to identify the optimal input parallelization configurations for **EQCCTMSeedRunner** to use to get the maximum amount of processing out of your system in the shortest amonut of time.
255
+
256
+ The following input parameters need to be configurated for **EvaluateSystem** to evaluate your system based on your desired utilization of EQCCTPro:
257
+
258
+ - **`mode (str)`**
259
+ - Can be either `cpu` or `gpu`
260
+ - Tells `EvaluateSystem` which configuration trials should it iterate through
261
+ - **`intra_threads (int)`: default = 1**
262
+ - Controls how many intra-parallelism threads Tensorflow can use
263
+ - **`inter_threads (int)`: default = 1**
264
+ - Controls how many inter-parallelism threads Tensorflow can use
265
+ - **`input_dir (str)`**
266
+ - Directory path to the the mSEED directory
267
+ - EX. /home/skevofilaxc/my_work_directory/eqcct/eqcctpro/sample_1_minute_data
268
+ - **`output_dir (str)`**
269
+ - Directory path to where the output picks and logs will be sent
270
+ - Doesn't need to exist, will be created if doesn't exist
271
+ - Recommended to be in the same working directory as the input directory for convience
272
+ - **`log_filepath (str)`**
273
+ - Filepath to where the EQCCTPro log will be written to and stored
274
+ - Doesn't need to exist, will be created if doesn't exist
275
+ - Recommended to be **in** the **output directory** and called **eqcctpro.log**, however the name can be changed for your own purposes
276
+ - **`csv_dir (str)`**
277
+ - Directory path where the CSV's outputted by EvaluateSystem will be saved
278
+ - Doesn't need to exist, will be created if doesn't exist
279
+ - **`P_threshold (float)`: default = 0.001**
280
+ - Threshold in which the P probabilities above it will be considered as P arrival
281
+ - **`S_threshold (float)`: default = 0.02**
282
+ - Threshold in which the S probabilities above it will be considered as S arrival
283
+ - **`p_model_filepath (str)`**
284
+ - Filepath to where the P EQCCT detection model is stored
285
+ - **`s_model_filepath (str)`**
286
+ - Filepath to where the S EQCCT detection model is stored
287
+ - **`stations2use (int)`: default = None**
288
+ - Controls the maximum amount of stations EvaluateSystem can use in its trial iterations
289
+ - Sample data has been provided so that the maximum is 50, however, if using custom data, configure for your specific usecase
290
+ - **`cpu_id_list (list)`: default = [1]**
291
+ - List that defines which specific CPU cores that sched_setaffinity will allocate for executing the current EQCCTPro process and **is the maximum amount of cores EvaluteSystem can use in its trial iterations**
292
+ - Allows for specific allocation and limitation of CPUs for a given EQCCTPro process
293
+ - "I want this program to run only on these specific cores."
294
+ - Must be at least 1 CPU if using GPUs (Ray needs CPUs to manage the Raylets (concurrent tasks), however the processing of the waveform is done on the GPU)
295
+ - **`set_vram_mb (float)`**
296
+ - Value of the maximum amount of VRAM EQCCTPro can use
297
+ - Must be a real value that is based on your hardware's physical memory space, if it exceeds the space the code will break due to OutOfMemoryError
298
+ - **`selected_gpus (list)`: default = None**
299
+ - List of GPU IDs on your computer you want to use if `mode = 'gpu'`
300
+ - Non-existing GPU IDs will cause the code to exit
301
+
302
+ ### Finding Optimal CPU/GPU Configurations
303
+ After running **EvalutateSystem**, you can use either the **OptimalCPUConfigurationFinder** or the **OptimalGPUConfigurationFinder** determine the best CPU or GPU configurations (respectively) for your specific usecase:
304
+
305
+ ```python
306
+ from eqcctpro import OptimalCPUConfigurationFinder, OptimalGPUConfigurationFinder
307
+
308
+ csv_filepath = '/path/to/csv'
309
+
310
+ cpu_finder = OptimalCPUConfigurationFinder(csv_filepath)
311
+ best_cpu_config = cpu_finder.find_best_overall_usecase()
312
+ print(best_cpu_config)
313
+
314
+ optimal_cpu_config = cpu_finder.find_optimal_for(cpu=3, station_count=2)
315
+ print(optimal_cpu_config)
316
+
317
+ gpu_finder = OptimalGPUConfigurationFinder(csv_filepath)
318
+ best_gpu_config = gpu_finder.find_best_overall_usecase()
319
+ print(best_gpu_config)
320
+
321
+ optimal_gpu_config = gpu_finder.find_optimal_for(num_cpus=1, gpu_list=[0], station_count=1)
322
+ print(optimal_gpu_config)
323
+ ```
324
+ Both **OptimalCPUConfigurationFinder** and **OptimalGPUConfigurationFinder** each have two usecases:
325
+
326
+ 1. **`find_best_overall_usecase`**
327
+ - Returns the best overall usecase configuration
328
+ - Uses middle 50% of CPUs for moderate, balanced CPU usage, with the maximum amount of stations processed with the minimum runtime
329
+ 2. **`find_optimal_for`**
330
+ - Return the paralleliztion configurations (EX. concurrent predictions, intra/inter thread counts, vram, etc.) for a given number of CPU(s)/GPU(s) and stations
331
+ - Enables users to quickly identify which input parameters should be used for the given amount of resources and workload they have for the minimum runtime possible on their computer
332
+
333
+ A input CSV directory path must be passed for the classes to use as a reference point:
334
+ - **`csv_filepath (str)`**
335
+ - Directory path where the CSV's outputted by EvaluateSystem are
336
+
337
+ Using **OptimalCPUConfigurationFinder.find_best_overall_usecase()**, no input parameters are needed. It will return back the best usecase parameters.
338
+
339
+ For **OptimalCPUConfigurationFinder.find_optimal_for()**, the function requires two input parameters:
340
+ - **`cpu (int)`**
341
+ - The number of CPU(s) you want to use in your application
342
+ - **`station_count (int)`**
343
+ - The number of station(s) you want to use in your application
344
+
345
+ **OptimalCPUConfigurationFinder.find_optimal_for()** will return back a trial data point containing the mimimum runtime based on your input paramters
346
+
347
+ Similar to **OptimalCPUConfigurationFinder.find_best_overall_usecase()**, **OptimalGPUConfigurationFinder.find_best_overall_usecase()** will return back the best usecase parameters and no input parameters are needed.
348
+
349
+ For **OptimalGPUConfigurationFinder.find_optimal_for()**, the function requires three input parameters:
350
+ - **`cpu (int)`**
351
+ - The number of CPU(s) you want to use in your application
352
+ - **`gpu_list (list)`**
353
+ - The specific GPU ID(s) you want to use in your application
354
+ - Useful if you have multiple GPUs available and want to use/dedicate a specific one to using EQCCTPro
355
+ - **`station_count (int)`**
356
+ - The number of station(s) you want to use in your application
357
+
358
+ ## Configuration
359
+ The `environment.yml` file specifies the dependencies required to run EQCCTPro. Ensure you have the correct versions installed by using the provided conda environment setup.
360
+
361
+ ## License
362
+ EQCCTPro is provided under an open-source license. See LICENSE for details.
363
+
364
+ ## Contact
365
+ For inquiries or issues, please contact constantinos.skevofilax@austin.utexas.edu or victor.salles@beg.utexas.edu.
366
+