Skip to content

Commit

Permalink
fix highpass_filt None to 0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 committed Sep 6, 2024
1 parent 99c513c commit 11bd2e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ PhaseNet for Distributed Acoustic Sensing (DAS) data.
python predict.py --model phasenet --add_polarity --add_event --format mseed --data_path /kuafu/jxli/Data/SeismicEventData/mammoth_south/data/ --data_list mammoth_south.txt --batch_size 1 --result_path mammoth_south
```
```
torchrun --standalone --nproc_per_node 8 predict.py --model phasenet --data_path /atomic-data/zhuwq/Hawaii_Loa --format mseed --batch_size=1 --result_path Hawaii_Loa --response_xml /atomic-data/zhuwq/response_hawaii_loa.xml --min_prob 0.3 --highpass_filter --add_polarity --add_event
torchrun --standalone --nproc_per_node 8 predict.py --model phasenet --data_path /atomic-data/zhuwq/Hawaii_Loa --format mseed --batch_size=1 --result_path Hawaii_Loa --response_xml /atomic-data/zhuwq/response_hawaii_loa.xml --min_prob 0.3 --highpass_filter 1.0 --add_polarity --add_event
```
```
torchrun --standalone --nproc_per_node 4 predict.py --model phasenet --batch_size=32 --hdf5-file datasets/NCEDC/ncedc_event_dataset.h5 --result_path results_ncedc_event_dataset_0.1 --add_polarity --add_event --dataset=seismic_trace --min_prob 0.1
Expand Down
6 changes: 3 additions & 3 deletions eqnet/data/seismic_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def __init__(
sampling_rate=100,
response_path=None,
response_xml=None,
highpass_filter=False,
highpass_filter=0.0,
rank=0,
world_size=1,
cut_patch=False,
Expand Down Expand Up @@ -768,7 +768,7 @@ def read_mseed(self, fname, response_path=None, response_xml=None, highpass_filt
# trace = trace.detrend("demean")

## highpass filtering > 1Hz
if highpass_filter is not None:
if highpass_filter > 0.0:
# trace = trace.filter("highpass", freq=1.0)
trace = trace.filter("highpass", freq=highpass_filter)

Expand Down Expand Up @@ -819,7 +819,7 @@ def read_mseed(self, fname, response_path=None, response_xml=None, highpass_filt
"dt_s": 1 / sampling_rate,
}

def read_segy(self, fname, highpass_filter=False, sampling_rate=2000, channels=[2, 1, 0]):
def read_segy(self, fname, highpass_filter=0.0, sampling_rate=2000, channels=[2, 1, 0]):
try:
stream = obspy.read(fname, format="SEGY")
except Exception as e:
Expand Down
4 changes: 2 additions & 2 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
import torch
import torch.multiprocessing as mp
import torch.utils.data
import wandb
from tqdm import tqdm

import eqnet
import utils
import wandb
from eqnet.data import DASIterableDataset, SeismicTraceIterableDataset
from eqnet.models.unet import moving_normalize
from eqnet.utils import (
Expand Down Expand Up @@ -498,7 +498,7 @@ def get_args_parser(add_help=True):
parser.add_argument("--add_polarity", action="store_true", help="If use polarity information")
parser.add_argument("--add_event", action="store_true", help="If use event information")
parser.add_argument("--sampling_rate", type=float, default=100.0, help="sampling rate; default 100.0 Hz")
parser.add_argument("--highpass_filter", type=float, default=None, help="highpass filter; default 0.0 is no filter")
parser.add_argument("--highpass_filter", type=float, default=0.0, help="highpass filter; default 0.0 is no filter")
parser.add_argument("--response_path", default=None, type=str, help="response path")
parser.add_argument("--response_xml", default=None, type=str, help="response xml file")
parser.add_argument("--subdir_level", default=0, type=int, help="folder depth for data list")
Expand Down

0 comments on commit 11bd2e6

Please sign in to comment.