Exemple #1
0
 def test_plot_rf(self):
     stream = minimal_example_rf()
     streamQ = stream.select(component='Q')
     streamQ.plot_rf()
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         stream.plot_rf()
     # test plotting with different number of samples
     streamQ[0].data = streamQ[0].data[:-10]
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         streamQ.plot_rf()
Exemple #2
0
 def test_profile(self):
     dx = np.linspace(-50, 50, 41)
     boxes = get_profile_boxes((-21, -69.5), 85, dx, width=300)
     stream = minimal_example_rf()
     stream.extend(stream[:3])  # to actually stack something
     profile = stream.select(component='Q').profile(boxes)
     self.assertEqual(len(profile), 3)
     str_ = ('Prf profile (Q) | -10.0s - 80.0s | 5.0 Hz, 451 samples | '
             'pos:-6.25km slow:6.40 (Ps moveout)')
     self.assertEqual(str(profile[0]), str_)
     test_io_header(self, profile[:1])
     self.assertIn('profile(', ' '.join(profile[0].stats.processing))
     # test plots
     profile.plot_profile(top='hist')
     from rf.imaging import plot_profile_map
     plot_profile_map(boxes)
Exemple #3
0
 def test_profile(self):
     dx = np.linspace(-50, 50, 41)
     boxes = get_profile_boxes((-21, -69.5), 85, dx, width=300)
     stream = minimal_example_rf()
     stream.extend(stream[:3])  # to actually stack something
     profile = stream.select(component='Q').profile(boxes)
     self.assertEqual(len(profile), 3)
     str_ = ('Prf profile (Q) | -10.0s - 80.0s | 5.0 Hz, 451 samples | '
             'pos:-6.25km slow:6.40 (Ps moveout)')
     self.assertEqual(str(profile[0]), str_)
     test_io_header(self, profile[:1])
     self.assertIn('profile(', ' '.join(profile[0].stats.processing))
     # test plots
     profile.plot_profile(top='hist')
     from rf.imaging import plot_profile_map
     plot_profile_map(boxes)
Exemple #4
0
 def test_minimal_example_rf(self):
     stream = minimal_example_rf()
     #        stream.select(component='L').plot_rf()
     #        stream.select(component='Q').plot_rf()
     #        stream.select(component='T').plot_rf()
     #        import matplotlib.pyplot as plt
     #        plt.show()
     stack = stream.stack()
     L = stack.select(component='L')
     Q = stack.select(component='Q')
     # check that maximum in L component is at 0s (at P onset)
     onset = L[0].stats.onset - L[0].stats.starttime
     dt = L[0].stats.delta
     self.assertAlmostEqual(L[0].data.argmax() * dt - onset, 0, delta=0.01)
     # check that maximum in Q component is at 8.6s
     # (subducting slab, Northern Chile)
     Q.trim2(5, 50, 'onset')
     onset = Q[0].stats.onset - Q[0].stats.starttime
     self.assertAlmostEqual(Q[0].data.argmax() * dt - onset, 8.6, delta=0.1)
Exemple #5
0
    def test_minimal_example_rf(self):
        stream = minimal_example_rf()
#        stream.select(component='L').plot_rf()
#        stream.select(component='Q').plot_rf()
#        stream.select(component='T').plot_rf()
#        import matplotlib.pyplot as plt
#        plt.show()
        stack = stream.stack()
        L = stack.select(component='L')
        Q = stack.select(component='Q')
        # check that maximum in L component is at 0s (at P onset)
        onset = L[0].stats.onset - L[0].stats.starttime
        dt = L[0].stats.delta
        self.assertAlmostEqual(L[0].data.argmax() * dt - onset, 0, delta=0.01)
        # check that maximum in Q component is at 8.6s
        # (subducting slab, Northern Chile)
        Q.trim2(5, 50, 'onset')
        onset = Q[0].stats.onset - Q[0].stats.starttime
        self.assertAlmostEqual(Q[0].data.argmax() * dt - onset, 8.6, delta=0.1)
Exemple #6
0
 def test_add_processing(self):
     stream = minimal_example_rf()
     proc = ' '.join(stream[0].stats.processing)
     self.assertIn('deconvolve(', proc)
     self.assertIn('rf(', proc)
Exemple #7
0
 def test_str(self):
     s = ('Prf CX.PB01..BHT | -10.0s - 80.0s onset:'
          '2011-02-25T13:15:38.169539Z | 5.0 Hz, 451 samples | '
          'mag:6.0 dist:46.1 baz:325.0 slow:6.40 (Ps moveout)')
     stream = minimal_example_rf()
     self.assertEqual(str(stream[0]), s)
Exemple #8
0
 def test_io_header_rf(self):
     stream = minimal_example_rf()[:1]
     #        for tr in stream:
     #            tr.stats.pop('sac')
     test_io_header(self, stream)
Exemple #9
0
 def test_plot_ppoints(self):
     from rf.imaging import plot_ppoints
     stream = minimal_example_rf()
     plot_ppoints(stream.ppoints(50), inventory=stream)
Exemple #10
0
 def test_plot_rf(self):
     stream = minimal_example_rf()
     stream.select(component='Q').plot_rf()
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         stream.plot_rf()
Exemple #11
0
 def test_plot_ppoints(self):
     from rf.imaging import plot_ppoints
     stream = minimal_example_rf()
     plot_ppoints(stream.ppoints(50), inventory=stream)
Exemple #12
0
 def test_plot_rf(self):
     stream = minimal_example_rf()
     stream.select(component='Q').plot_rf()
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         stream.plot_rf()
Exemple #13
0
    def test_io_header_rf(self):
        stream = minimal_example_rf()[:1]
#        for tr in stream:
#            tr.stats.pop('sac')
        test_io_header(self, stream)
Exemple #14
0
 def test_add_processing(self):
     stream = minimal_example_rf()
     proc = ' '.join(stream[0].stats.processing)
     self.assertIn('deconvolve(', proc)
     self.assertIn('rf(', proc)
Exemple #15
0
 def test_str(self):
     s = ('Prf CX.PB01..BHT | -10.0s - 80.0s onset:'
          '2011-02-25T13:15:38.169539Z | 5.0 Hz, 451 samples | '
          'mag:6.0 dist:46.1 baz:325.0 slow:6.40 (Ps moveout)')
     stream = minimal_example_rf()
     self.assertEqual(str(stream[0]), s)