Пример #1
0
    def test_HighPassBadcutoff(self):
        radardata = NoInitRadarData()

        # fails without constant-spaced data
        radardata.flags.interp = np.ones((2, ))
        with self.assertRaises(ValueError):
            # We have a screwed up filter here because of sampling vs. frequency used
            radardata.highpass(1.0e-4)
Пример #2
0
    def test_vbp_fir(self):
        radardata = NoInitRadarData()
        radardata.vertical_band_pass(1., 10., filttype='fir', order=100)

        radardata.vertical_band_pass(1.,
                                     10.,
                                     filttype='fir',
                                     order=2,
                                     fir_window='hanning')
Пример #3
0
    def test_HighPass(self):
        radardata = NoInitRadarData()

        # fails without constant-spaced data
        radardata.flags.interp = np.ones((2, ))
        radardata.highpass(1000.0)
        # There is no high-frequency variability, so this result should be small
        # We only have residual variability from the quality of the filter
        print(
            np.abs((radardata.data - radardata.data[0, 0]) /
                   radardata.data[0, 0]))
        self.assertTrue(
            np.all(
                np.abs((radardata.data - radardata.data[0, 0]) /
                       radardata.data[0, 0]) < 1.0e-3))
Пример #4
0
 def test_vbp_butter(self):
     radardata = NoInitRadarData()
     radardata.vertical_band_pass(0.1, 100., filttype='butter')
     # The filter is not too good, so we have lots of residual
     self.assertTrue(np.all(np.abs(radardata.data) < 1.0e-4))
Пример #5
0
 def test_WinAvgbadtaper(self):
     radardata = NoInitRadarData()
     with self.assertRaises(ValueError):
         radardata.winavg_hfilt(11, taper='not_a_taper', filtdepth=-1)
Пример #6
0
 def test_WinAvgPexp(self):
     radardata = NoInitRadarData()
     radardata.winavg_hfilt(11, taper='pexp', filtdepth=-1)
     self.assertTrue(np.all(radardata.data == radardata.pexp_target_output))
Пример #7
0
 def test_WinAvgExpBadwinavg(self):
     # Tests the check on whether win_avg < tnum
     radardata = NoInitRadarData()
     radardata.winavg_hfilt(data_dummy.shape[1] + 10, taper='full')
     self.assertTrue(
         np.all(radardata.data == radardata.hfilt_target_output))
Пример #8
0
 def test_WinAvgExp(self):
     radardata = NoInitRadarData()
     radardata.winavg_hfilt(11, taper='full')
     self.assertTrue(
         np.all(radardata.data == radardata.hfilt_target_output))
Пример #9
0
 def test_HighPassNotspaced(self):
     radardata = NoInitRadarData()
     with self.assertRaises(ImpdarError):
         # We have a screwed up filter here because of sampling vs. frequency used
         radardata.highpass(1000.0)
Пример #10
0
 def test_HfiltRun(self):
     radardata = NoInitRadarData()
     radardata.horizontalfilt(0, 100)
     # We taper in the hfilt, so this is not just zeros
     self.assertTrue(
         np.all(radardata.data == radardata.hfilt_target_output))
Пример #11
0
 def test_AdaptiveRun(self):
     radardata = NoInitRadarData()
     radardata.adaptivehfilt()
     # since we subtract average trace and all traces are identical, we should get zeros out
     self.assertTrue(np.all(radardata.data <= 1.))
Пример #12
0
 def test_vbp_badftype(self):
     radardata = NoInitRadarData()
     with self.assertRaises(ValueError):
         radardata.vertical_band_pass(0.1, 100., filttype='dummy')