@@ -1065,19 +1065,14 @@ def test_roundtrip_icrs(astrometry_args, telescope_frame, selenoid, in_lib, out_
10651065 return
10661066
10671067 if telescope_frame == "mcmf" :
1068- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1069-
1070- try :
1071- check_ra , check_dec = phs_utils .transform_app_to_icrs (
1072- time_array = astrometry_args ["time_array" ],
1073- app_ra = app_ra ,
1074- app_dec = app_dec ,
1075- telescope_loc = telescope_loc ,
1076- astrometry_library = out_lib ,
1077- ** kwargs ,
1078- )
1079- except SpiceUNKNOWNFRAME as err :
1080- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1068+ check_ra , check_dec = phs_utils .transform_app_to_icrs (
1069+ time_array = astrometry_args ["time_array" ],
1070+ app_ra = app_ra ,
1071+ app_dec = app_dec ,
1072+ telescope_loc = telescope_loc ,
1073+ astrometry_library = out_lib ,
1074+ ** kwargs ,
1075+ )
10811076 else :
10821077 check_ra , check_dec = phs_utils .transform_app_to_icrs (
10831078 time_array = astrometry_args ["time_array" ],
@@ -1336,32 +1331,27 @@ def test_calc_app_sidereal(astrometry_args, frame, telescope_frame, selenoid):
13361331 if telescope_frame == "itrs" :
13371332 telescope_loc = astrometry_args ["telescope_loc" ]
13381333 else :
1339- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1340-
13411334 telescope_loc = astrometry_args ["moon_telescope_loc" ]
13421335
1343- try :
1344- check_ra , check_dec = phs_utils .calc_app_coords (
1345- lon_coord = (
1346- astrometry_args ["fk5_ra" ]
1347- if (frame == "fk5" )
1348- else astrometry_args ["icrs_ra" ]
1349- ),
1350- lat_coord = (
1351- astrometry_args ["fk5_dec" ]
1352- if (frame == "fk5" )
1353- else astrometry_args ["icrs_dec" ]
1354- ),
1355- coord_type = "sidereal" ,
1356- telescope_loc = telescope_loc ,
1357- telescope_frame = telescope_frame ,
1358- ellipsoid = selenoid ,
1359- time_array = astrometry_args ["time_array" ],
1360- coord_frame = frame ,
1361- coord_epoch = astrometry_args ["epoch" ],
1362- )
1363- except SpiceUNKNOWNFRAME as err :
1364- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1336+ check_ra , check_dec = phs_utils .calc_app_coords (
1337+ lon_coord = (
1338+ astrometry_args ["fk5_ra" ]
1339+ if (frame == "fk5" )
1340+ else astrometry_args ["icrs_ra" ]
1341+ ),
1342+ lat_coord = (
1343+ astrometry_args ["fk5_dec" ]
1344+ if (frame == "fk5" )
1345+ else astrometry_args ["icrs_dec" ]
1346+ ),
1347+ coord_type = "sidereal" ,
1348+ telescope_loc = telescope_loc ,
1349+ telescope_frame = telescope_frame ,
1350+ ellipsoid = selenoid ,
1351+ time_array = astrometry_args ["time_array" ],
1352+ coord_frame = frame ,
1353+ coord_epoch = astrometry_args ["epoch" ],
1354+ )
13651355
13661356 check_coord = SkyCoord (check_ra , check_dec , unit = "rad" )
13671357
@@ -1385,12 +1375,8 @@ def test_calc_app_ephem(astrometry_args, frame, telescope_frame, selenoid):
13851375 # paths through the ephem.
13861376 if telescope_frame == "itrs" :
13871377 telescope_loc = astrometry_args ["telescope_loc" ]
1388- err_type = None
13891378 else :
13901379 telescope_loc = astrometry_args ["moon_telescope_loc" ]
1391- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1392-
1393- err_type = SpiceUNKNOWNFRAME
13941380
13951381 if frame == "fk5" :
13961382 ephem_ra = astrometry_args ["fk5_ra" ]
@@ -1401,21 +1387,18 @@ def test_calc_app_ephem(astrometry_args, frame, telescope_frame, selenoid):
14011387
14021388 ephem_times = np .array ([astrometry_args ["time_array" ][0 ]])
14031389
1404- try :
1405- check_ra , check_dec = phs_utils .calc_app_coords (
1406- lon_coord = ephem_ra ,
1407- lat_coord = ephem_dec ,
1408- coord_times = ephem_times ,
1409- coord_type = "ephem" ,
1410- telescope_loc = telescope_loc ,
1411- telescope_frame = telescope_frame ,
1412- ellipsoid = selenoid ,
1413- time_array = astrometry_args ["time_array" ],
1414- coord_epoch = astrometry_args ["epoch" ],
1415- coord_frame = frame ,
1416- )
1417- except err_type as err :
1418- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1390+ check_ra , check_dec = phs_utils .calc_app_coords (
1391+ lon_coord = ephem_ra ,
1392+ lat_coord = ephem_dec ,
1393+ coord_times = ephem_times ,
1394+ coord_type = "ephem" ,
1395+ telescope_loc = telescope_loc ,
1396+ telescope_frame = telescope_frame ,
1397+ ellipsoid = selenoid ,
1398+ time_array = astrometry_args ["time_array" ],
1399+ coord_epoch = astrometry_args ["epoch" ],
1400+ coord_frame = frame ,
1401+ )
14191402
14201403 check_coord = SkyCoord (check_ra , check_dec , unit = "rad" )
14211404
@@ -1513,21 +1496,16 @@ def test_calc_app_fk5_roundtrip(astrometry_args, telescope_frame, selenoid):
15131496 )
15141497
15151498 if telescope_frame == "mcmf" :
1516- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1517-
1518- try :
1519- check_ra , check_dec = phs_utils .calc_sidereal_coords (
1520- time_array = astrometry_args ["time_array" ],
1521- app_ra = app_ra ,
1522- app_dec = app_dec ,
1523- telescope_loc = telescope_loc ,
1524- coord_frame = "fk5" ,
1525- telescope_frame = telescope_frame ,
1526- ellipsoid = selenoid ,
1527- coord_epoch = 2000.0 ,
1528- )
1529- except SpiceUNKNOWNFRAME as err :
1530- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1499+ check_ra , check_dec = phs_utils .calc_sidereal_coords (
1500+ time_array = astrometry_args ["time_array" ],
1501+ app_ra = app_ra ,
1502+ app_dec = app_dec ,
1503+ telescope_loc = telescope_loc ,
1504+ coord_frame = "fk5" ,
1505+ telescope_frame = telescope_frame ,
1506+ ellipsoid = selenoid ,
1507+ coord_epoch = 2000.0 ,
1508+ )
15311509 else :
15321510 check_ra , check_dec = phs_utils .calc_sidereal_coords (
15331511 time_array = astrometry_args ["time_array" ],
@@ -1558,20 +1536,15 @@ def test_calc_app_fk5_roundtrip(astrometry_args, telescope_frame, selenoid):
15581536 )
15591537
15601538 if telescope_frame == "mcmf" :
1561- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1562-
1563- try :
1564- check_ra , check_dec = phs_utils .calc_sidereal_coords (
1565- time_array = astrometry_args ["time_array" ],
1566- app_ra = app_ra ,
1567- app_dec = app_dec ,
1568- telescope_loc = telescope_loc ,
1569- coord_frame = "fk5" ,
1570- telescope_frame = telescope_frame ,
1571- coord_epoch = 2000.0 ,
1572- )
1573- except SpiceUNKNOWNFRAME as err :
1574- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1539+ check_ra , check_dec = phs_utils .calc_sidereal_coords (
1540+ time_array = astrometry_args ["time_array" ],
1541+ app_ra = app_ra ,
1542+ app_dec = app_dec ,
1543+ telescope_loc = telescope_loc ,
1544+ coord_frame = "fk5" ,
1545+ telescope_frame = telescope_frame ,
1546+ coord_epoch = 2000.0 ,
1547+ )
15751548 else :
15761549 check_ra , check_dec = phs_utils .calc_sidereal_coords (
15771550 time_array = astrometry_args ["time_array" ],
@@ -1607,21 +1580,16 @@ def test_calc_app_fk4_roundtrip(astrometry_args, telescope_frame, selenoid):
16071580 )
16081581
16091582 if telescope_frame == "mcmf" :
1610- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1611-
1612- try :
1613- check_ra , check_dec = phs_utils .calc_sidereal_coords (
1614- time_array = astrometry_args ["time_array" ],
1615- app_ra = app_ra ,
1616- app_dec = app_dec ,
1617- telescope_loc = telescope_loc ,
1618- coord_frame = "fk4" ,
1619- telescope_frame = telescope_frame ,
1620- ellipsoid = selenoid ,
1621- coord_epoch = 1950.0 ,
1622- )
1623- except SpiceUNKNOWNFRAME as err :
1624- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1583+ check_ra , check_dec = phs_utils .calc_sidereal_coords (
1584+ time_array = astrometry_args ["time_array" ],
1585+ app_ra = app_ra ,
1586+ app_dec = app_dec ,
1587+ telescope_loc = telescope_loc ,
1588+ coord_frame = "fk4" ,
1589+ telescope_frame = telescope_frame ,
1590+ ellipsoid = selenoid ,
1591+ coord_epoch = 1950.0 ,
1592+ )
16251593
16261594 else :
16271595 check_ra , check_dec = phs_utils .calc_sidereal_coords (
@@ -1785,25 +1753,18 @@ def test_transform_icrs_to_app_time_obj(astrometry_args, telescope_frame, seleno
17851753 """
17861754 if telescope_frame == "itrs" :
17871755 telescope_loc = astrometry_args ["telescope_loc" ]
1788- err_type = None
17891756 else :
17901757 telescope_loc = astrometry_args ["moon_telescope_loc" ]
1791- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
1792-
1793- err_type = SpiceUNKNOWNFRAME
17941758
1795- try :
1796- check_ra , check_dec = phs_utils .transform_icrs_to_app (
1797- time_array = Time (astrometry_args ["time_array" ], format = "jd" ),
1798- ra = astrometry_args ["icrs_ra" ],
1799- dec = astrometry_args ["icrs_dec" ],
1800- telescope_loc = telescope_loc ,
1801- telescope_frame = telescope_frame ,
1802- ellipsoid = selenoid ,
1803- epoch = Time (astrometry_args ["epoch" ], format = "jyear" ),
1804- )
1805- except err_type as err :
1806- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
1759+ check_ra , check_dec = phs_utils .transform_icrs_to_app (
1760+ time_array = Time (astrometry_args ["time_array" ], format = "jd" ),
1761+ ra = astrometry_args ["icrs_ra" ],
1762+ dec = astrometry_args ["icrs_dec" ],
1763+ telescope_loc = telescope_loc ,
1764+ telescope_frame = telescope_frame ,
1765+ ellipsoid = selenoid ,
1766+ epoch = Time (astrometry_args ["epoch" ], format = "jyear" ),
1767+ )
18071768
18081769 if telescope_frame == "itrs" :
18091770 app_ra = astrometry_args ["app_ra" ]
@@ -2068,9 +2029,25 @@ def test_uvw_track_generator(flip_u, use_uvw, use_earthloc):
20682029def test_uvw_track_generator_moon (selenoid ):
20692030 pytest .importorskip ("lunarsky" )
20702031 # Note this isn't a particularly deep test, but it at least exercises the code.
2071- from spiceypy .utils .exceptions import SpiceUNKNOWNFRAME
20722032
2073- try :
2033+ gen_results = utils .uvw_track_generator (
2034+ lon_coord = 0.0 ,
2035+ lat_coord = 0.0 ,
2036+ coord_frame = "icrs" ,
2037+ telescope_loc = (0 , 0 , 0 ),
2038+ time_array = 2456789.0 ,
2039+ antenna_positions = np .array ([[1 , 0 , 0 ], [0 , 1 , 0 ], [0 , 0 , 1 ]]),
2040+ telescope_frame = "mcmf" ,
2041+ ellipsoid = selenoid ,
2042+ )
2043+
2044+ # Check that the total lengths all match 1
2045+ np .testing .assert_allclose (
2046+ (gen_results ["uvw" ] ** 2.0 ).sum (1 ), 2.0 , rtol = 0 , atol = 1e-3
2047+ )
2048+
2049+ if selenoid == "SPHERE" :
2050+ # check defaults
20742051 gen_results = utils .uvw_track_generator (
20752052 lon_coord = 0.0 ,
20762053 lat_coord = 0.0 ,
@@ -2079,30 +2056,7 @@ def test_uvw_track_generator_moon(selenoid):
20792056 time_array = 2456789.0 ,
20802057 antenna_positions = np .array ([[1 , 0 , 0 ], [0 , 1 , 0 ], [0 , 0 , 1 ]]),
20812058 telescope_frame = "mcmf" ,
2082- ellipsoid = selenoid ,
20832059 )
2084- except SpiceUNKNOWNFRAME as err :
2085- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
2086-
2087- # Check that the total lengths all match 1
2088- np .testing .assert_allclose (
2089- (gen_results ["uvw" ] ** 2.0 ).sum (1 ), 2.0 , rtol = 0 , atol = 1e-3
2090- )
2091-
2092- if selenoid == "SPHERE" :
2093- # check defaults
2094- try :
2095- gen_results = utils .uvw_track_generator (
2096- lon_coord = 0.0 ,
2097- lat_coord = 0.0 ,
2098- coord_frame = "icrs" ,
2099- telescope_loc = (0 , 0 , 0 ),
2100- time_array = 2456789.0 ,
2101- antenna_positions = np .array ([[1 , 0 , 0 ], [0 , 1 , 0 ], [0 , 0 , 1 ]]),
2102- telescope_frame = "mcmf" ,
2103- )
2104- except SpiceUNKNOWNFRAME as err :
2105- pytest .skip ("SpiceUNKNOWNFRAME error: " + str (err ))
21062060
21072061 # Check that the total lengths all match 1
21082062 np .testing .assert_allclose (
0 commit comments