def test_get_telescope_center_xyz(): ref_xyz = (-2562123.42683, 5094215.40141, -2848728.58869) ref_latlonalt = (-26.7 * np.pi / 180.0, 116.7 * np.pi / 180.0, 377.8) test_telescope_dict = { "test": { "center_xyz": ref_xyz, "latitude": None, "longitude": None, "altitude": None, "citation": "", }, "test2": { "center_xyz": ref_xyz, "latitude": ref_latlonalt[0], "longitude": ref_latlonalt[1], "altitude": ref_latlonalt[2], "citation": "", }, } telescope_obj = pyuvdata.get_telescope( "test", telescope_dict_in=test_telescope_dict) telescope_obj_ext = pyuvdata.Telescope() telescope_obj_ext.citation = "" telescope_obj_ext.telescope_name = "test" telescope_obj_ext.telescope_location = ref_xyz assert telescope_obj == telescope_obj_ext telescope_obj_ext.telescope_name = "test2" telescope_obj2 = pyuvdata.get_telescope( "test2", telescope_dict_in=test_telescope_dict) assert telescope_obj2 == telescope_obj_ext
def test_get_telescope_center_xyz(): ref_xyz = (-2562123.42683, 5094215.40141, -2848728.58869) ref_latlonalt = (-26.7 * np.pi / 180.0, 116.7 * np.pi / 180.0, 377.8) test_telescope_dict = { 'test': { 'center_xyz': ref_xyz, 'latitude': None, 'longitude': None, 'altitude': None, 'citation': '' }, 'test2': { 'center_xyz': ref_xyz, 'latitude': ref_latlonalt[0], 'longitude': ref_latlonalt[1], 'altitude': ref_latlonalt[2], 'citation': '' } } telescope_obj = pyuvdata.get_telescope( 'test', telescope_dict_in=test_telescope_dict) telescope_obj_ext = pyuvdata.Telescope() telescope_obj_ext.citation = '' telescope_obj_ext.telescope_name = 'test' telescope_obj_ext.telescope_location = ref_xyz assert telescope_obj == telescope_obj_ext telescope_obj_ext.telescope_name = 'test2' telescope_obj2 = pyuvdata.get_telescope( 'test2', telescope_dict_in=test_telescope_dict) assert telescope_obj2 == telescope_obj_ext
def test_hera_loc(): hera_file = os.path.join(DATA_PATH, "zen.2458098.45361.HH.uvh5_downselected") hera_data = UVData() hera_data.read(hera_file, read_data=False, file_type="uvh5") telescope_obj = pyuvdata.get_telescope("HERA") assert np.allclose( telescope_obj.telescope_location, hera_data.telescope_location, rtol=hera_data._telescope_location.tols[0], atol=hera_data._telescope_location.tols[1], )
def test_get_telescope(): for inst in pyuvdata.known_telescopes(): telescope_obj = pyuvdata.get_telescope(inst) assert telescope_obj.telescope_name == inst