Skip to content

Commit

Permalink
fix a bug when picks are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuwq0 committed Nov 14, 2023
1 parent 280c4dd commit c3c4a27
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions phasenet/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import pandas as pd
import tensorflow as tf
from data_reader import DataReader_mseed_array, DataReader_pred
from model import ModelConfig, UNet
from postprocess import (
extract_amplitude,
extract_picks,
Expand All @@ -21,8 +22,6 @@
from tqdm import tqdm
from visulization import plot_waveform

from model import ModelConfig, UNet

tf.compat.v1.disable_eager_execution()
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)

Expand Down Expand Up @@ -146,7 +145,7 @@ 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:
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")):
Expand Down

0 comments on commit c3c4a27

Please sign in to comment.