@@ -105,24 +105,19 @@ def genTS(net,st,ch,loc,ptime,stime):
105105 stime = UTCDateTime (* (stimeint + [smsec ]))
106106 #get a waveform to train against
107107 wf = genTS (net ,st ,chan ,loc ,ptime ,stime )
108- if not (wf is None ) and len (wf )> 100 :#discard bad or short waveforms extracted from the database
108+ if not (wf is None ) and len (wf )> 100 :#discard bad or short waveforms extracted from the database
109109 wfctr += 1
110110 #resample the waveforms to 1000 points, detrend and normalise. The extra 0.01 ensures that the resulting trace
111111 #does in fact have 1000 points
112112 wf .resample (1000.01 / wf .stats .npts * wf .stats .sampling_rate )
113113 wf .detrend ()
114114 wf .normalize ()
115- #generate the pick distributions and normalise them
116- pdist = np .exp (- np .power (wf .times ()- (ptime - wf .times ("utcdatetime" )[0 ]),2 )/ (0.02 ))#sigma is 0.1
117- sdist = np .exp (- np .power (wf .times ()- (stime - wf .times ("utcdatetime" )[0 ]),2 )/ (0.02 ))
118- pdist = pdist / np .sum (pdist )
119- sdist = sdist / np .sum (sdist )
120- #plot the resulting final waveform to a file
121- outfname = 'wftestplot/' + '_' .join ((net ,st ,chan ,loc ,ptime .ctime (),stime .ctime ()))+ '.png'
122- wf .plot (outfile = outfname )
123- #pickle the data and save it to a file
124-
125-
126-
127-
128-
115+ #generate the pick distributions and normalise them
116+ pdist = np .exp (- np .power (wf .times ()- (ptime - wf .times ("utcdatetime" )[0 ]),2 )/ (0.02 ))#sigma is 0.1
117+ sdist = np .exp (- np .power (wf .times ()- (stime - wf .times ("utcdatetime" )[0 ]),2 )/ (0.02 ))
118+ pdist = pdist / np .sum (pdist )
119+ sdist = sdist / np .sum (sdist )
120+ #plot the resulting final waveform to a file
121+ outfname = 'wftestplot/' + '_' .join ((net ,st ,chan ,loc ,ptime .ctime (),stime .ctime ()))+ '.png'
122+ wf .plot (outfile = outfname )
123+ #pickle the data and save it to a file
0 commit comments