Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Liu Dezi
csst_msc_sim
Commits
b175068c
Commit
b175068c
authored
May 08, 2024
by
Fang Yuedong
Browse files
add astrometric unittest
parent
7709b50d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/test_astrometry.py
0 → 100644
View file @
b175068c
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
(
jdt
,
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
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment