Skip to content

Commit

Permalink
remove saving picks per file
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 committed Nov 14, 2023
1 parent c3c4a27 commit 8741f84
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions phasenet/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,30 +144,30 @@ def pred_fn(args, data_reader, figure_dir=None, prob_dir=None, log_dir=None):

picks.extend(picks_)

## save pick per file
if (len(fname_batch) == 1) & (len(picks_) > 0):
df = pd.DataFrame(picks_)
df = df[df["phase_index"] > 10]
if not os.path.exists(os.path.join(args.result_dir, "picks")):
os.makedirs(os.path.join(args.result_dir, "picks"))
df = df[
[
"station_id",
"begin_time",
"phase_index",
"phase_time",
"phase_score",
"phase_type",
"phase_amplitude",
"dt",
]
]
df.to_csv(
os.path.join(
args.result_dir, "picks", fname_batch[0].decode().split("/")[-1].rstrip(".mseed") + ".csv"
),
index=False,
)
# ## save pick per file
# if (len(fname_batch) == 1) & (len(picks_) > 0):
# df = pd.DataFrame(picks_)
# df = df[df["phase_index"] > 10]
# if not os.path.exists(os.path.join(args.result_dir, "picks")):
# os.makedirs(os.path.join(args.result_dir, "picks"))
# df = df[
# [
# "station_id",
# "begin_time",
# "phase_index",
# "phase_time",
# "phase_score",
# "phase_type",
# "phase_amplitude",
# "dt",
# ]
# ]
# df.to_csv(
# os.path.join(
# args.result_dir, "picks", fname_batch[0].decode().split("/")[-1].rstrip(".mseed") + ".csv"
# ),
# index=False,
# )

if args.plot_figure:
if not (isinstance(fname_batch, np.ndarray) or isinstance(fname_batch, list)):
Expand Down

0 comments on commit 8741f84

Please sign in to comment.