예제 #1
0
    def test__get_pick_targ_infoAutoselect(self):
        # Make sure that we are selecting the proper output format
        rd = NoInitRadarData()

        # With no depth, we should output travel time
        rd.nmo_depth = None
        out_name, tout = rd._get_pick_targ_info(None)
        self.assertEqual(out_name, 'twtt')
        self.assertTrue(np.all(tout == rd.travel_time))

        # With depth, return depth
        rd.nmo_depth = np.arange(len(rd.travel_time)) * 1.1
        out_name, tout = rd._get_pick_targ_info(None)
        self.assertEqual(out_name, 'depth')
        self.assertTrue(np.all(tout == rd.nmo_depth))
예제 #2
0
    def test__get_pick_targ_infoGoodSelections(self):
        # Make sure that we are selecting the proper output format
        rd = NoInitRadarData()
        rd.nmo_depth = np.arange(len(rd.travel_time)) * 1.1
        rd.elev = np.arange(rd.tnum) * 1001

        out_name, tout = rd._get_pick_targ_info('twtt')
        self.assertEqual(out_name, 'twtt')
        self.assertTrue(np.all(tout == rd.travel_time))

        out_name, tout = rd._get_pick_targ_info('depth')
        self.assertEqual(out_name, 'depth')
        self.assertTrue(np.all(tout == rd.nmo_depth))

        out_name, tout = rd._get_pick_targ_info('snum')
        self.assertEqual(out_name, 'snum')
        self.assertTrue(np.all(tout == np.arange(rd.snum)))

        out_name, tout = rd._get_pick_targ_info('elev')
        self.assertEqual(out_name, 'elev')
예제 #3
0
    def test__get_pick_targ_infoBadSelections(self):
        # Make sure that we are selecting the proper output format
        rd = NoInitRadarData()

        # Try depth when there is no depth
        rd.nmo_depth = None
        with self.assertRaises(AttributeError):
            out_name, tout = rd._get_pick_targ_info('depth')

        # Elevation with no depth or elevation
        with self.assertRaises(AttributeError):
            out_name, tout = rd._get_pick_targ_info('elev')

        # Elevation with depth but not elevation
        rd.nmo_depth = np.arange(len(rd.travel_time)) * 1.1
        with self.assertRaises(AttributeError):
            out_name, tout = rd._get_pick_targ_info('elev')

        # Now try to pass a bad value for the selection
        with self.assertRaises(ValueError):
            out_name, tout = rd._get_pick_targ_info('dummy')
        with self.assertRaises(ValueError):
            out_name, tout = rd._get_pick_targ_info(['dummy', 'snum'])