@@ -206,17 +206,27 @@ def _freq_string(freq):
206
206
207
207
def _plot_trace (config , trace , ntraces , tmax ,
208
208
ax , ax_text , trans , trans3 , path_effects ):
209
+ # Origin and height to draw vertical patches for noise and signal windows
210
+ rectangle_patch_origin = 0
211
+ rectangle_patch_height = 1
209
212
orientation = trace .stats .channel [- 1 ]
210
213
if orientation in config .vertical_channel_codes :
211
214
color = 'purple'
215
+ if ntraces > 1 :
216
+ rectangle_patch_origin = 1. / 3
217
+ rectangle_patch_height = 1. / 3
212
218
if orientation in config .horizontal_channel_codes_1 :
213
219
color = 'green'
214
220
if ntraces > 1 :
215
221
trace .data = (trace .data / tmax - 1 ) * tmax
222
+ rectangle_patch_origin = 0
223
+ rectangle_patch_height = 1. / 3
216
224
if orientation in config .horizontal_channel_codes_2 :
217
225
color = 'blue'
218
226
if ntraces > 1 :
219
227
trace .data = (trace .data / tmax + 1 ) * tmax
228
+ rectangle_patch_origin = 2. / 3
229
+ rectangle_patch_height = 1. / 3
220
230
# dim out ignored traces
221
231
if trace .stats .ignore :
222
232
alpha = 0.3
@@ -249,9 +259,11 @@ def _plot_trace(config, trace, ntraces, tmax,
249
259
try :
250
260
N1 = trace .stats .arrivals ['N1' ][1 ] - trace .stats .starttime
251
261
N2 = trace .stats .arrivals ['N2' ][1 ] - trace .stats .starttime
252
- rect = patches .Rectangle ((N1 , 0 ), width = N2 - N1 , height = 1 ,
253
- transform = trans , color = '#eeeeee' ,
254
- zorder = - 1 )
262
+ rect = patches .Rectangle (
263
+ (N1 , rectangle_patch_origin ),
264
+ width = N2 - N1 , height = rectangle_patch_height ,
265
+ transform = trans , color = '#eeeeee' ,
266
+ zorder = - 1 )
255
267
ax .add_patch (rect )
256
268
except KeyError :
257
269
pass
@@ -262,9 +274,11 @@ def _plot_trace(config, trace, ntraces, tmax,
262
274
elif config .wave_type [0 ] == 'P' :
263
275
t1 = trace .stats .arrivals ['P1' ][1 ] - trace .stats .starttime
264
276
t2 = trace .stats .arrivals ['P2' ][1 ] - trace .stats .starttime
265
- rect = patches .Rectangle ((t1 , 0 ), width = t2 - t1 , height = 1 ,
266
- transform = trans , color = 'yellow' ,
267
- alpha = 0.5 , zorder = - 1 )
277
+ rect = patches .Rectangle (
278
+ (t1 , rectangle_patch_origin ),
279
+ width = t2 - t1 , height = rectangle_patch_height ,
280
+ transform = trans , color = 'yellow' ,
281
+ alpha = 0.5 , zorder = - 1 )
268
282
ax .add_patch (rect )
269
283
if not ax_text :
270
284
text_y = 0.01
@@ -308,7 +322,7 @@ def _trim_traces(config, st):
308
322
for trace in st :
309
323
t1 = (trace .stats .arrivals ['P' ][1 ] - config .noise_pre_time )
310
324
t2 = (trace .stats .arrivals ['S' ][1 ] + 3 * config .win_length )
311
- trace .trim (starttime = t1 , endtime = t2 , pad = True , fill_value = 0 )
325
+ trace .trim (starttime = t1 , endtime = t2 )
312
326
313
327
314
328
def plot_traces (config , st , ncols = None , block = True ):
0 commit comments