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
csst-sims
csst_mci_sim
Commits
4e8cf2dc
Commit
4e8cf2dc
authored
Apr 17, 2024
by
Yan Zhaojun
Browse files
debug
parent
5bb06e78
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/straylight.py
View file @
4e8cf2dc
...
...
@@ -24,31 +24,31 @@ def transRaDec2D(ra, dec):
return
np
.
array
([
x1
,
y1
,
z1
])
def
earth_angle
(
time_jd
,
x_sat
,
y_sat
,
z_sat
,
ra_obj
,
dec_obj
):
#
def earth_angle(time_jd, x_sat, y_sat, z_sat, ra_obj, dec_obj):
ra_sat
=
np
.
arctan2
(
y_sat
,
x_sat
)
/
np
.
pi
*
180
dec_sat
=
np
.
arctan2
(
z_sat
,
np
.
sqrt
(
x_sat
**
2
+
y_sat
**
2
))
/
np
.
pi
*
180
radec_sat
=
SkyCoord
(
ra
=
ra_sat
*
u
.
degree
,
dec
=
dec_sat
*
u
.
degree
,
frame
=
'gcrs'
)
lb_sat
=
radec_sat
.
transform_to
(
'geocentrictrueecliptic'
)
#
ra_sat = np.arctan2(y_sat, x_sat) / np.pi * 180
#
dec_sat = np.arctan2(z_sat, np.sqrt(x_sat**2+y_sat**2)) / np.pi * 180
#
radec_sat = SkyCoord(ra=ra_sat*u.degree,
#
dec=dec_sat*u.degree, frame='gcrs')
#
lb_sat = radec_sat.transform_to('geocentrictrueecliptic')
# get the obj location
radec_obj
=
SkyCoord
(
ra
=
ra_obj
*
u
.
degree
,
dec
=
dec_obj
*
u
.
degree
,
frame
=
'gcrs'
)
lb_obj
=
radec_obj
.
transform_to
(
'geocentrictrueecliptic'
)
#
# get the obj location
#
radec_obj = SkyCoord(ra=ra_obj*u.degree,
#
dec=dec_obj*u.degree, frame='gcrs')
#
lb_obj = radec_obj.transform_to('geocentrictrueecliptic')
# calculate the angle between sub-satellite point and the earth side
earth_radius
=
6371
# km
sat_height
=
np
.
sqrt
(
x_sat
**
2
+
y_sat
**
2
+
z_sat
**
2
)
angle_a
=
np
.
arcsin
(
earth_radius
/
sat_height
)
/
np
.
pi
*
180
#
# calculate the angle between sub-satellite point and the earth side
#
earth_radius = 6371 # km
#
sat_height = np.sqrt(x_sat**2 + y_sat**2 + z_sat**2)
#
angle_a = np.arcsin(earth_radius/sat_height) / np.pi * 180
# calculate the angle between satellite position and the target position
angle_b
=
lb_sat
.
separation
(
lb_obj
)
#
# calculate the angle between satellite position and the target position
#
angle_b = lb_sat.separation(lb_obj)
# calculat the earth angle
angle
=
180
-
angle_a
-
angle_b
.
degree
#
# calculat the earth angle
#
angle = 180 - angle_a - angle_b.degree
return
angle
#
return angle
###############################################################################
...
...
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