@@ -397,8 +397,8 @@ def fig_comply(f, day_comps, day_list, sta_comps, sta_list, sta, f_0):
397
397
compliance = np .abs (day_comps [i ][key ][0 ])
398
398
ax .plot (f , compliance , 'gray' , alpha = 0.3 , lw = 0.5 )
399
399
ax .set_xlim (f_0 , f_c )
400
- ytop = np .max (compliance [(f > f_0 ) & (f < f_c )])
401
- ybot = np .min (compliance [(f > f_0 ) & (f < f_c )])
400
+ ytop = np .max (compliance [(f > f_0 ) & (f < f_c )])
401
+ ybot = np .min (compliance [(f > f_0 ) & (f < f_c )])
402
402
ax .set_ylim (ybot , ytop )
403
403
404
404
if sta_list [key ]:
@@ -473,36 +473,41 @@ def fig_event_raw(evstream, fmin, fmax):
473
473
sr = evstream .sth [0 ].stats .sampling_rate
474
474
taxis = np .arange (0. , 7200. , 1. / sr )
475
475
476
- plt .figure (figsize = (6 , 6 ))
477
-
478
- plt .subplot (411 )
479
- plt .plot (taxis , evstream .sth [0 ].data , 'k' , lw = 0.5 )
480
- plt .title (evstream .key + ' ' + evstream .tstamp +
481
- ': H1' , fontdict = {'fontsize' : 8 })
482
- plt .gca ().ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
483
- scilimits = (- 3 , 3 ))
484
- plt .xlim ((0. , 7200. ))
485
-
486
- plt .subplot (412 )
487
- plt .plot (taxis , evstream .sth [1 ].data , 'k' , lw = 0.5 )
488
- plt .xlim ((0. , 7200. ))
489
- plt .title (evstream .tstamp + ': H2' , fontdict = {'fontsize' : 8 })
490
- plt .gca ().ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
491
- scilimits = (- 3 , 3 ))
492
-
493
- plt .subplot (413 )
494
- plt .plot (taxis , evstream .sth [2 ].data , 'k' , lw = 0.5 )
495
- plt .xlim ((0. , 7200. ))
496
- plt .title (evstream .tstamp + ': Z' , fontdict = {'fontsize' : 8 })
497
- plt .gca ().ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
498
- scilimits = (- 3 , 3 ))
499
-
500
- plt .subplot (414 )
501
- plt .plot (taxis , evstream .stp [0 ].data , 'k' , lw = 0.5 )
502
- plt .gca ().ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
503
- scilimits = (- 3 , 3 ))
504
- plt .xlim ((0. , 7200. ))
505
- plt .title (evstream .tstamp + ': P' , fontdict = {'fontsize' : 8 })
476
+ fig = plt .figure (figsize = (6 , 6 ))
477
+
478
+ ax = fig .add_subplot (4 , 1 , 1 )
479
+ ax .plot (taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'k' , lw = 0.5 )
480
+ ax .set_title (evstream .key + ' ' + evstream .tstamp +
481
+ ': Z' , fontdict = {'fontsize' : 8 })
482
+ ax .ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
483
+ scilimits = (- 3 , 3 ))
484
+ ax .set_xlim ((0. , 7200. ))
485
+
486
+ if len (evstream .sth ) > 1 :
487
+ ax = fig .add_subplot (4 , 1 , 2 )
488
+ ax .plot (taxis , evstream .sth .select (component = '1' )[0 ].data , 'k' , lw = 0.5 )
489
+ ax .set_xlim ((0. , 7200. ))
490
+ ax .set_title (evstream .tstamp + ': 1' , fontdict = {'fontsize' : 8 })
491
+ ax .ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
492
+ scilimits = (- 3 , 3 ))
493
+
494
+ ax = fig .add_subplot (4 , 1 , 3 )
495
+ ax .plot (taxis , evstream .sth .select (component = '2' )[0 ].data , 'k' , lw = 0.5 )
496
+ ax .set_xlim ((0. , 7200. ))
497
+ ax .set_title (evstream .tstamp + ': 2' , fontdict = {'fontsize' : 8 })
498
+ ax .ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
499
+ scilimits = (- 3 , 3 ))
500
+
501
+ if evstream .stp :
502
+ if len (evstream .sth ) > 1 :
503
+ ax = fig .add_subplot (4 , 1 , 4 )
504
+ else :
505
+ ax = fig .add_subplot (4 , 1 , 2 )
506
+ ax .plot (taxis , evstream .stp [0 ].data , 'k' , lw = 0.5 )
507
+ ax .ticklabel_format (axis = 'y' , style = 'sci' , useOffset = True ,
508
+ scilimits = (- 3 , 3 ))
509
+ ax .set_xlim ((0. , 7200. ))
510
+ ax .set_title (evstream .tstamp + ': P' , fontdict = {'fontsize' : 8 })
506
511
507
512
plt .xlabel ('Time since earthquake (sec)' )
508
513
plt .tight_layout ()
@@ -535,7 +540,8 @@ def fig_event_corrected(evstream, TF_list):
535
540
plt .figure (figsize = (8 , 8 ))
536
541
537
542
plt .subplot (611 )
538
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
543
+ plt .plot (
544
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
539
545
if TF_list ['Z1' ]:
540
546
plt .plot (taxis , evstream .correct ['Z1' ], 'k' , lw = 0.5 )
541
547
plt .title (evstream .key + ' ' + evstream .tstamp +
@@ -545,7 +551,8 @@ def fig_event_corrected(evstream, TF_list):
545
551
plt .xlim ((0. , 7200. ))
546
552
547
553
plt .subplot (612 )
548
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
554
+ plt .plot (
555
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
549
556
if TF_list ['Z2-1' ]:
550
557
plt .plot (taxis , evstream .correct ['Z2-1' ], 'k' , lw = 0.5 )
551
558
plt .title (evstream .tstamp + ': Z2-1' , fontdict = {'fontsize' : 8 })
@@ -554,7 +561,8 @@ def fig_event_corrected(evstream, TF_list):
554
561
plt .xlim ((0. , 7200. ))
555
562
556
563
plt .subplot (613 )
557
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
564
+ plt .plot (
565
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
558
566
if TF_list ['ZP-21' ]:
559
567
plt .plot (taxis , evstream .correct ['ZP-21' ], 'k' , lw = 0.5 )
560
568
plt .title (evstream .tstamp + ': ZP-21' , fontdict = {'fontsize' : 8 })
@@ -563,7 +571,8 @@ def fig_event_corrected(evstream, TF_list):
563
571
plt .xlim ((0. , 7200. ))
564
572
565
573
plt .subplot (614 )
566
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
574
+ plt .plot (
575
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
567
576
if TF_list ['ZH' ]:
568
577
plt .plot (taxis , evstream .correct ['ZH' ], 'k' , lw = 0.5 )
569
578
plt .title (evstream .tstamp + ': ZH' , fontdict = {'fontsize' : 8 })
@@ -572,7 +581,8 @@ def fig_event_corrected(evstream, TF_list):
572
581
plt .xlim ((0. , 7200. ))
573
582
574
583
plt .subplot (615 )
575
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
584
+ plt .plot (
585
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
576
586
if TF_list ['ZP-H' ]:
577
587
plt .plot (taxis , evstream .correct ['ZP-H' ], 'k' , lw = 0.5 )
578
588
plt .title (evstream .tstamp + ': ZP-H' , fontdict = {'fontsize' : 8 })
@@ -581,7 +591,8 @@ def fig_event_corrected(evstream, TF_list):
581
591
plt .xlim ((0. , 7200. ))
582
592
583
593
plt .subplot (616 )
584
- plt .plot (taxis , evstream .sth [2 ].data , 'lightgray' , lw = 0.5 )
594
+ plt .plot (
595
+ taxis , evstream .sth .select (component = 'Z' )[0 ].data , 'lightgray' , lw = 0.5 )
585
596
if TF_list ['ZP' ]:
586
597
plt .plot (taxis , evstream .correct ['ZP' ], 'k' , lw = 0.5 )
587
598
plt .title (evstream .tstamp + ': ZP' , fontdict = {'fontsize' : 8 })
0 commit comments