Skip to content

Commit

Permalink
Merge pull request #2157 from obspy/fix_ar_picker
Browse files Browse the repository at this point in the history
fix a bug in AR picker
  • Loading branch information
megies committed May 24, 2018
2 parents a124222 + 5a3c893 commit 58a3cd2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.txt
Expand Up @@ -33,6 +33,8 @@ master:
objects to shapefile (see #2012)
- obspy.io
* added read support for receiver gather format v. 1.6 (see #2070)
- obspy.signal.trigger:
* fix a bug in AR picker (see #2157)
- obspy.signal.PPSD:
* Fixed exact trace cutting for PSD segments (see #2040).
* Timestamp representations internally and in npz I/O were changed to use
Expand Down
6 changes: 3 additions & 3 deletions obspy/signal/src/arpicker.c
Expand Up @@ -358,10 +358,10 @@ int ar_picker(float *tr, float *tr_1, float *tr_2, int ndat, float sample_rate,
memset(buf_lta,0,ndat*sizeof(float));
for(i=(ndat-nlta-1);i>nlta;i--){
for(j=(i+nsta-1);j>=(i);j--){
buf_sta[i] += fabsf(buff4[j])/(float)nsta;
buf_sta[i] += fabsf(buff4_s[j])/(float)nsta;
}
for(j=(i+nlta-1);j>=(i);j--){
buf_lta[i] += fabsf(buff4[j])/(float)nlta;
buf_lta[i] += fabsf(buff4_s[j])/(float)nlta;
}
}
lta_max = 0.;
Expand All @@ -384,7 +384,7 @@ int ar_picker(float *tr, float *tr_1, float *tr_2, int ndat, float sample_rate,
}
//flip the trace in time
for(i=0;i<n65;i++){
buff2[n65-i-1] = buff1[i];
buff2[n65-i-1] = buff1_s[i];
}

errcode = spr_coef_paz(buff1_s-1,nl_s,m1_s,&pm,ar_f-1);
Expand Down
4 changes: 2 additions & 2 deletions obspy/signal/tests/test_trigger.py
Expand Up @@ -95,8 +95,8 @@ def test_ar_pick(self):
lta_p, sta_p, lta_s, sta_s, m_p, m_s, l_p, l_s)
self.assertAlmostEqual(ptime, 30.6350002289)
# seems to be strongly machine dependent, go for int for 64 bit
# self.assertAlmostEqual(stime, 31.2800006866)
self.assertEqual(int(stime + 0.5), 31)
# self.assertEqual(int(stime + 0.5), 31)
self.assertAlmostEqual(stime, 31.165, delta=0.05)

def test_trigger_onset(self):
"""
Expand Down

0 comments on commit 58a3cd2

Please sign in to comment.