def test_find_file_in_range(self): current_path = os.path.dirname(__file__) file_prefix = os.path.join(current_path, DATA_PATH) params = Struct(strategy_start = "2015-01-01-00:00:00", strategy_end = "2015-01-01-18:00:10", data_file_prefix = "HIMap_", data_file_suffix = "_02.fit.gz", file_date_format = "%Y%m%d_%H%M%S", file_prefix = file_prefix, coord_prefix = "coord5m", verbose=True) ctx = Struct(params = params) plugin = find_nested_files.Plugin(ctx) with pytest.raises(AssertionError): plugin() params.strategy_start = "2015-05-04-00:00:00" params.strategy_end = "2015-05-05-18:00:10" plugin() assert ctx.calibrations_paths is not None assert len(ctx.calibrations_paths) == 0 assert ctx.data_file_paths is not None assert len(ctx.data_file_paths) == 2 assert len(ctx.data_file_paths[0]) == 1 assert len(ctx.data_file_paths[1]) == 1 assert ctx.coords_paths is not None assert len(ctx.coords_paths) == 2
def test_find_file_in_range(self): current_path = os.path.dirname(__file__) file_prefix = os.path.join(current_path, DATA_PATH) params = Struct(strategy_start="2015-01-01-00:00:00", strategy_end="2015-01-01-18:00:10", data_file_prefix="HIMap_", data_file_suffix="_02.fit.gz", file_date_format="%Y%m%d_%H%M%S", file_prefix=file_prefix, coord_prefix="coord5m", verbose=True) ctx = Struct(params=params) plugin = find_nested_files.Plugin(ctx) with pytest.raises(AssertionError): plugin() params.strategy_start = "2015-05-04-00:00:00" params.strategy_end = "2015-05-05-18:00:10" plugin() assert ctx.calibrations_paths is not None assert len(ctx.calibrations_paths) == 0 assert ctx.data_file_paths is not None assert len(ctx.data_file_paths) == 2 assert len(ctx.data_file_paths[0]) == 1 assert len(ctx.data_file_paths[1]) == 1 assert ctx.coords_paths is not None assert len(ctx.coords_paths) == 2
def testLoadCoords(self): params = Struct(telescope_latitude=47.2000007629395, telescope_longitude=8.5, telescope_elevation=500, integration_time=1) ctx = Struct(params=params) coords_path = os.path.join(COORDS_ROOT, "coord5m20141121.txt") ctx.coords_paths = {"2014-11-22": coords_path} ctx.strategy_start = datetime(2014, 11, 22, 17, 0, 0) ctx.tod_vx = np.empty((1, 3)) ctx.time_axis = np.arange(3) plugin = process_coords.Plugin(ctx) plugin() assert ctx.coords is not None assert len(ctx.coords.ra) == 3 assert len(ctx.coords.dec) == 3
def testLoadCoords(self): params = Struct(telescope_latitude = 47.2000007629395, telescope_longitude = 8.5, telescope_elevation = 500, integration_time = 1 ) ctx = Struct(params=params) coords_path = os.path.join(COORDS_ROOT, "coord5m20141121.txt") ctx.coords_paths = {"2014-11-22": coords_path} ctx.strategy_start = datetime(2014, 11, 22, 17, 0, 0) ctx.tod_vx = np.empty((1, 3)) ctx.time_axis = np.arange(3) plugin = process_coords.Plugin(ctx) plugin() assert ctx.coords is not None assert len(ctx.coords.ra) == 3 assert len(ctx.coords.dec) == 3