You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree, that would indeed be a good helper function. Maybe it could go into seisbench.util? There could also be a weighting factor between phase types because different phases tend to have different confidences.
Hi, @yetinam
Sorry for the delayed response.
Here I provide a function to achieve "removing too close picks". Hope it useful and can be adopted in the seisbench.util.
defremove_too_close_detections(detections, charfct, win=100):
# parameter description:# detections: An ndarry of indices of P picks or S picks. Do NOT use both the P and S picks.# charfct: Probability vector of the corresponding phase (i.e., model output). It is also an ndarry object.# win: the minimal separation between consecutive picks# return:# uniqs: a subset of the detections, with close picks removed and highest picks saved# deleted_pool: a list of the removed picksdeleted_pool= []
uniqs=set()
fori,win_sinenumerate(detections[:-1]):
# if the current pick (win_s) is in the list of deleted_pool (see below for how the pool is defined), skip the loopifwin_sindeleted_pool: continuewin_e=win_s+win# the window following the current pick with a length of windensedetections=detections[i+1:][detections[i+1:]<win_e] # find picks in the window [win_s+1: win_s+win]iflen(densedetections):
# if there exist more than one pick in the window, only save the pick with the highest probability and delete the othersall=np.insert(densedetections, 0, win_s)
deleted_pool.extend(all)
highestpeak=all[np.argmax(charfct[all])]
uniqs.add(highestpeak)
deleted_pool.remove(highestpeak)
else:
# otherwise, if no pick in the window, save the current pick uniqs.add(win_s)
deleted_pool=list(set(deleted_pool))
uniqs=np.sort(np.array(list(uniqs)))
returnuniqs,deleted_pool
Similar to PhaseNet, a minimal separation could be set to filter those picks too-close to each other and only save the most significant one.
More details are in lines 26-28 from https://github.com/AI4EPS/PhaseNet/blob/master/phasenet/detect_peaks.py
The text was updated successfully, but these errors were encountered: