import unittest import os import sys from astropy.time import Time from datetime import datetime from ObservationSim.Astrometry.Astrometry_util import on_orbit_obs_position class TestAstrometry(unittest.TestCase): def __init__(self, methodName='runTest'): super(TestAstrometry, self).__init__(methodName) # self.dataPath = os.path.join( # os.getenv('UNIT_TEST_DATA_ROOT'), 'csst_msc_sim/csst_fz_msc') def test_astrometry_method(self): ra_list = [300.061827] dec_list = [-60.132741] pmra_list = [0.] pmdec_list = [0.] rv_list = [0.] parallax_list = [1e-9] sat_x = 5227.7501 sat_y = -1521.2218 sat_z = -4007.7662 sat_vx = 0.13581745522969868 sat_vy = 7.233066646238058 sat_vz = -2.5770060087052116 dt = datetime.utcfromtimestamp( Time(2461865.75468577, format='jd').unix) date_str = dt.date().isoformat() time_str = dt.time().isoformat() ra_arr, dec_arr = on_orbit_obs_position( input_ra_list=ra_list, input_dec_list=dec_list, input_pmra_list=pmra_list, input_pmdec_list=pmdec_list, input_rv_list=rv_list, input_parallax_list=parallax_list, input_nstars=len(ra_list), input_x=sat_x, input_y=sat_y, input_z=sat_z, input_vx=sat_vx, input_vy=sat_vy, input_vz=sat_vz, input_epoch="J2000", input_date_str=date_str, input_time_str=time_str ) print(ra_arr[0], dec_arr[0]) self.assertTrue(ra_arr[0] != ra_list[0]) self.assertTrue(dec_arr[0] != dec_list[0]) if __name__ == '__main_': unittest.main()