Example #1
0
    def test_process_vbp(self):
        with self.assertRaises(TypeError):
            process.process([self.data], vbp=3)

        self.data.vertical_band_pass = MagicMock()
        self.assertTrue(process.process([self.data], vbp=(3, 4)))
        self.data.vertical_band_pass.assert_called_with(3, 4)
Example #2
0
    def test_process_restack(self):
        self.data.restack = MagicMock()
        self.assertTrue(process.process([self.data], restack=3))
        self.data.restack.assert_called_with(3)

        self.data.restack = MagicMock()
        self.assertTrue(process.process([self.data], restack=[4., 'dummy']))
        self.data.restack.assert_called_with(4)
Example #3
0
 def test_process_Reverse(self):
     data_unrev = self.data.data.copy()
     process.process([self.data], rev=True)
     self.assertTrue(np.allclose(self.data.data, np.fliplr(data_unrev)))
     self.assertTrue(np.allclose(self.data.x_coord, np.arange(39, -1, -1)))
     process.process([self.data], rev=True)
     self.assertTrue(np.allclose(self.data.data, data_unrev))
     self.assertTrue(np.allclose(self.data.x_coord, np.arange(40)))
Example #4
0
 def test_process_hcrop(self):
     with self.assertRaises(TypeError):
         process.process([self.data], hcrop=True)
     with self.assertRaises(ValueError):
         process.process([self.data], hcrop=('ugachacka', 'left', 'tnum'))
     self.data.hcrop = MagicMock()
     self.assertTrue(
         process.process([self.data], hcrop=(17, 'left', 'tnum')))
     self.data.hcrop.assert_called_with(17, 'left', 'tnum')
Example #5
0
 def test_process_Crop(self):
     with self.assertRaises(TypeError):
         process.process([self.data], crop=True)
     with self.assertRaises(ValueError):
         process.process([self.data], crop=('ugachacka', 'top', 'snum'))
     self.data.crop = MagicMock()
     self.assertTrue(
         process.process([self.data], crop=(17, 'bottom', 'snum')))
     self.data.crop.assert_called_with(17, 'bottom', 'snum')
Example #6
0
    def test_process_NMO(self):
        self.data.nmo = MagicMock()
        self.assertTrue(process.process([self.data], nmo=(0., 2.0, 2.0)))
        self.data.nmo.assert_called_with(0., 2.0, 2.0)

        self.data.nmo = MagicMock()
        self.assertTrue(process.process([self.data], nmo=0))
        self.data.nmo.assert_called_with(0, 1.6)

        self.data.nmo = MagicMock()
        self.assertTrue(process.process([self.data], nmo=1.0))
        self.data.nmo.assert_called_with(1.0, 1.6)
Example #7
0
 def test_process_Interp(self, mock_interp):
     dl = [self.data]
     with self.assertRaises(ValueError):
         process.process([self.data], interp=('ba', 2))
     with self.assertRaises(ValueError):
         process.process([self.data], interp='ba')
     with self.assertRaises(ValueError):
         process.process([self.data], interp=1)
     with self.assertRaises(ValueError):
         process.process([self.data], interp=(1, ))
     process.process(dl, interp=(1, 2))
     mock_interp.assert_called_with(dl, 1.0, 2)
Example #8
0
 def test_process_Denoise(self):
     self.data.denoise = MagicMock()
     with self.assertRaises(ValueError):
         process.process([self.data], denoise=1)
     with self.assertRaises(ValueError):
         process.process([self.data], denoise='12')
     with self.assertRaises(ValueError):
         process.process([self.data], denoise=(1, ))
     process.process([self.data], denoise=(1, 2))
     self.data.denoise.assert_called_with(1, 2)
Example #9
0
    def test_process_NMO(self):
        # If velocity is 2
        process.process([self.data], nmo=(0., 2.0, 2.0))
        self.assertTrue(
            np.allclose(self.data.travel_time * 1.0e-6, self.data.nmo_depth))
        # shouldn't care about uair if offset=0
        process.process([self.data], nmo=(0., 2.0, 200.0))
        self.assertTrue(
            np.allclose(self.data.travel_time * 1.0e-6, self.data.nmo_depth))

        # Just make sure we can use one arg
        process.process([self.data], nmo=0.)
Example #10
0
 def test_migrate(self):
     self.data.migrate = MagicMock()
     self.assertTrue(process.process([self.data], migrate=True))
     self.data.migrate.assert_called_with(mtype='stolt')
Example #11
0
 def test_process_Reverse(self):
     self.data.reverse = MagicMock()
     self.assertTrue(process.process([self.data], rev=True))
     self.data.reverse.assert_called_with()
Example #12
0
 def test_process_restack(self):
     process.process([self.data], restack=3)
     self.assertTrue(self.data.data.shape == (20, 13))
     process.process([self.data], restack=[3])
     self.assertTrue(self.data.data.shape == (20, 4))
Example #13
0
 def test_process_Crop(self):
     with self.assertRaises(TypeError):
         process.process([self.data], crop=True)
     with self.assertRaises(ValueError):
         process.process([self.data], crop=(1.0, 'top', 'dum'))
     with self.assertRaises(ValueError):
         process.process([self.data], crop=(1.0, 'bot', 'snum'))
     with self.assertRaises(ValueError):
         process.process([self.data], crop=('ugachacka', 'top', 'snum'))
     process.process([self.data], crop=(17, 'bottom', 'snum'))
     self.assertTrue(self.data.data.shape == (17, 40))
     process.process([self.data], crop=(6, 'top', 'snum'))
     self.assertTrue(self.data.data.shape == (11, 40))
 def test_process_vbp(self):
     radardata = NoInitRadarData()
     process.process([radardata], vbp=(0.1, 100.))
     # The filter is not too good, so we have lots of residual
     self.assertTrue(np.all(np.abs(radardata.data) < 1.0e-4))
 def test_process_hfilt(self):
     radardata = NoInitRadarData()
     process.process([radardata], hfilt=(0, 100))
     # We taper in the hfilt, so this is not just zeros
     self.assertTrue(
         np.all(radardata.data == radardata.hfilt_target_output))
 def test_process_ahfilt(self):
     radardata = NoInitRadarData()
     process.process([radardata], ahfilt=True)
     # We taper in the hfilt, so this is not just zeros
     self.assertTrue(np.all(radardata.data <= 1.))