def test_find_best_frametype(self): from gwpy.io import datafind # check we can actually run this test here try: os.environ['LIGO_DATAFIND_SERVER'] except KeyError as e: self.skipTest(str(e)) # test a few (channel, frametype) pairs for channel, target in [ ('H1:GDS-CALIB_STRAIN', ['H1_HOFT_C00', 'H1_ER_C00_L1']), ('L1:IMC-ODC_CHANNEL_OUT_DQ', ['L1_R']), ('H1:ISI-GND_STS_ITMY_X_BLRMS_30M_100M.mean,s-trend', ['H1_T']), ('H1:ISI-GND_STS_ITMY_X_BLRMS_30M_100M.mean,m-trend', ['H1_M'])]: ft = datafind.find_best_frametype( channel, 1143504017, 1143504017+100) self.assertIn(ft, target) # test that this works end-to-end as part of a TimeSeries.find try: ts = self.TEST_CLASS.find(FIND_CHANNEL, FIND_GPS, FIND_GPS+1) except (ImportError, RuntimeError) as e: self.skipTest(str(e))
def test_find_best_frametype(self, channel, expected): from gwpy.io import datafind try: ft = datafind.find_best_frametype( channel, 1143504017, 1143504017+100) except ValueError as exc: # ignore if str(exc).lower().startswith('cannot locate'): pytest.skip(str(exc)) raise assert ft in expected
def test_find_best_frametype(self, channel, expected): from gwpy.io import datafind try: ft = datafind.find_best_frametype(channel, 1143504017, 1143504017 + 100) except ValueError as exc: # ignore if str(exc).lower().startswith('cannot locate'): pytest.skip(str(exc)) raise assert ft in expected
def test_find_best_frametype(self, connection): """Test :func:`gwpy.io.datafind.find_best_frametype """ with mock.patch('glue.datafind.GWDataFindHTTPConnection') as \ mock_connection, \ mock.patch('gwpy.io.datafind.num_channels', lambda x: 1), \ mock.patch('gwpy.io.gwf.iter_channel_names', lambda x: ['L1:LDAS-STRAIN']): mock_connection.return_value = connection assert io_datafind.find_best_frametype('L1:LDAS-STRAIN', 968654552, 968654553) == 'GW100916'
def test_find_best_frametype(self, connection): """Test :func:`gwpy.io.datafind.find_best_frametype """ with mock.patch('glue.datafind.GWDataFindHTTPConnection') as \ mock_connection, \ mock.patch('gwpy.io.datafind.num_channels', lambda x: 1), \ mock.patch('gwpy.io.gwf.iter_channel_names', lambda x: ['L1:LDAS-STRAIN']): mock_connection.return_value = connection assert io_datafind.find_best_frametype( 'L1:LDAS-STRAIN', 968654552, 968654553) == 'HW100916'
def test_find_best_frametype(self): from gwpy.io import datafind # test a few (channel, frametype) pairs for channel, target in [ ('H1:GDS-CALIB_STRAIN', ['H1_HOFT_C00', 'H1_ER_C00_L1']), ('L1:IMC-ODC_CHANNEL_OUT_DQ', ['L1_R']), ('H1:ISI-GND_STS_ITMY_X_BLRMS_30M_100M.mean,s-trend', ['H1_T']), ('H1:ISI-GND_STS_ITMY_X_BLRMS_30M_100M.mean,m-trend', ['H1_M']) ]: ft = datafind.find_best_frametype(channel, 1143504017, 1143504017 + 100) assert ft in target # test that this works end-to-end as part of a TimeSeries.find ts = self.TEST_CLASS.find(FIND_CHANNEL, *LOSC_GW150914_SEGMENT)