EQTransformer.core.tester module¶
Created on Wed Apr 25 17:44:14 2018
@author: mostafamousavi last update: 05/27/2021
-
EQTransformer.core.tester.
tester
(input_hdf5=None, input_testset=None, input_model=None, output_name=None, detection_threshold=0.2, P_threshold=0.1, S_threshold=0.1, number_of_plots=100, estimate_uncertainty=True, number_of_sampling=5, loss_weights=[0.05, 0.4, 0.55], loss_types=['binary_crossentropy', 'binary_crossentropy', 'binary_crossentropy'], input_dimention=(6000, 3), normalization_mode='std', mode='generator', batch_size=500, gpuid=None, gpu_limit=None)[source]¶ Applies a trained model to a windowed waveform to perform both detection and picking at the same time.
Parameters: - input_hdf5 (str, default=None) – Path to an hdf5 file containing only one class of “data” with NumPy arrays containing 3 component waveforms each 1 min long.
- input_testset (npy, default=None) – Path to a NumPy file (automaticaly generated by the trainer) containing a list of trace names.
- input_model (str, default=None) – Path to a trained model.
- output_dir (str, default=None) – Output directory that will be generated.
- output_probabilities (bool, default=False) – If True, it will output probabilities and estimated uncertainties for each trace into an HDF file.
- detection_threshold (float, default=0.3) – A value in which the detection probabilities above it will be considered as an event.
- P_threshold (float, default=0.1) – A value which the P probabilities above it will be considered as P arrival.
- S_threshold (float, default=0.1) – A value which the S probabilities above it will be considered as S arrival.
- number_of_plots (float, default=10) – The number of plots for detected events outputed for each station data.
- estimate_uncertainty (bool, default=False) – If True uncertainties in the output probabilities will be estimated.
- number_of_sampling (int, default=5) – Number of sampling for the uncertainty estimation.
- loss_weights (list, default=[0.03, 0.40, 0.58]) – Loss weights for detection, P picking, and S picking respectively.
- loss_types (list, default=['binary_crossentropy', 'binary_crossentropy', 'binary_crossentropy']) – Loss types for detection, P picking, and S picking respectively.
- input_dimention (tuple, default=(6000, 3)) – Loss types for detection, P picking, and S picking respectively.
- normalization_mode (str, default='std') – Mode of normalization for data preprocessing, ‘max’, maximum amplitude among three components, ‘std’, standard deviation.
- mode (str, default='generator') – Mode of running. ‘pre_load_generator’ or ‘generator’.
- batch_size (int, default=500) – Batch size. This wont affect the speed much but can affect the performance. A value beteen 200 to 1000 is recommanded.
- gpuid (int, default=None) – Id of GPU used for the prediction. If using CPU set to None.
- gpu_limit (int, default=None) – Set the maximum percentage of memory usage for the GPU.
Returns: - ./output_name/X_test_results.csv (A table containing all the detection, and picking results. Duplicated events are already removed.)
- ./output_name/X_report.txt (A summary of the parameters used for prediction and performance.)
- ./output_name/figures (A folder containing plots detected events and picked arrival times.)
Notes
Estimating the uncertainties requires multiple predictions and will increase the computational time.