@@ -27,7 +27,7 @@ class Jerk(ClipDetection):
2727 See parent class.
2828 '''
2929
30- def __init__ (self , st , point_thresh = 25 , test_all = False ):
30+ def __init__ (self , st , point_thresh = 400 , test_all = False ):
3131 '''
3232 Constructs all neccessary attributes for the Max_Amp class.
3333
@@ -48,6 +48,24 @@ def __init__(self, st, point_thresh=25, test_all=False):
4848 self .num_outliers = None
4949 self ._get_results ()
5050
51+ def _clean_trace (self , tr ):
52+ '''
53+ Pre-processing steps.
54+
55+ Args:
56+ tr (StationTrace):
57+ A single trace in the record.
58+
59+ Returns:
60+ clean_tr (StationTrace):
61+ Cleaned trace.
62+ '''
63+ t_1 = tr .stats .starttime
64+ t_2 = t_1 + 180
65+ clean_tr = tr .copy ()
66+ clean_tr .trim (t_1 , t_2 )
67+ return clean_tr
68+
5169 def _detect (self , tr ):
5270 '''
5371 Check for jerk outliers. Based on method described by:
@@ -65,11 +83,10 @@ def _detect(self, tr):
6583 bool:
6684 Is the trace clipped?
6785 '''
68- temp_st = self .st
69- temp_st .differentiate ()
70- if tr .stats .channel [1 ] == 'H' :
71- temp_st .differentiate ()
72- abs_diff = np .abs (tr .data )
86+ temp_tr = tr .copy ()
87+ temp_tr .differentiate ()
88+ temp_tr .differentiate ()
89+ abs_diff = np .abs (temp_tr .data )
7390 median_x100 = 100 * np .median (abs_diff )
7491 i_jerk , = np .where (abs_diff >= median_x100 )
7592 num_outliers = len (i_jerk )
0 commit comments