@@ -19,10 +19,14 @@ def arrays_to_altaz(zenith, azimuth, obstime=None):
19
19
)
20
20
21
21
22
- def arrays_to_camera (x , y , pointing_direction , obstime = None ):
22
+ def arrays_to_camera (x , y , pointing_direction , obstime = None , rotated = True ):
23
23
if obstime is not None :
24
24
obstime = to_astropy_time (obstime )
25
- frame = CameraFrame (pointing_direction = pointing_direction , obstime = obstime )
25
+ frame = CameraFrame (
26
+ pointing_direction = pointing_direction ,
27
+ obstime = obstime ,
28
+ rotated = rotated ,
29
+ )
26
30
return SkyCoord (
27
31
x = np .asanyarray (x ) * u .mm ,
28
32
y = np .asanyarray (y ) * u .mm ,
@@ -63,7 +67,7 @@ def to_astropy_time(series_or_array):
63
67
return Time (time , scale = 'utc' )
64
68
65
69
66
- def equatorial_to_camera (ra , dec , zd_pointing , az_pointing , obstime ):
70
+ def equatorial_to_camera (ra , dec , zd_pointing , az_pointing , obstime , rotated = True ):
67
71
'''
68
72
Convert sky coordinates from the equatorial frame to FACT camera
69
73
coordinates.
@@ -80,6 +84,11 @@ def equatorial_to_camera(ra, dec, zd_pointing, az_pointing, obstime):
80
84
Azimuth of the telescope pointing direction in degree
81
85
obstime: datetime or np.datetime64
82
86
Time of the observations
87
+ rotated: bool
88
+ True means x points right and y points up when looking on the camera
89
+ from the dish, which is the efinition of FACT-Tools >= 1.0 and Mars.
90
+ False means x points up and y points left,
91
+ which is definition in the original FACTPixelMap file.
83
92
84
93
Returns
85
94
-------
@@ -93,13 +102,13 @@ def equatorial_to_camera(ra, dec, zd_pointing, az_pointing, obstime):
93
102
eq_coordinates = arrays_to_equatorial (ra , dec , obstime = obstime )
94
103
pointing_direction = arrays_to_altaz (zd_pointing , az_pointing , obstime )
95
104
96
- camera_frame = CameraFrame (pointing_direction = pointing_direction )
105
+ camera_frame = CameraFrame (pointing_direction = pointing_direction , rotated = rotated )
97
106
cam_coordinates = eq_coordinates .transform_to (camera_frame )
98
107
99
108
return cam_coordinates .x .to (u .mm ).value , cam_coordinates .y .to (u .mm ).value
100
109
101
110
102
- def camera_to_equatorial (x , y , zd_pointing , az_pointing , obstime ):
111
+ def camera_to_equatorial (x , y , zd_pointing , az_pointing , obstime , rotated = True ):
103
112
'''
104
113
Convert FACT camera coordinates to sky coordinates in the equatorial (icrs)
105
114
frame.
@@ -118,6 +127,11 @@ def camera_to_equatorial(x, y, zd_pointing, az_pointing, obstime):
118
127
Azimuth of the telescope pointing direction in degree
119
128
obstime: datetime or np.datetime64
120
129
Time of the observations
130
+ rotated: bool
131
+ True means x points right and y points up when looking on the camera
132
+ from the dish, which is the efinition of FACT-Tools >= 1.0 and Mars.
133
+ False means x points up and y points left,
134
+ which is definition in the original FACTPixelMap file.
121
135
122
136
Returns
123
137
-------
@@ -127,13 +141,15 @@ def camera_to_equatorial(x, y, zd_pointing, az_pointing, obstime):
127
141
Declination in degrees
128
142
'''
129
143
pointing_direction = arrays_to_altaz (zd_pointing , az_pointing , obstime )
130
- cam_coordinates = arrays_to_camera (x , y , pointing_direction , obstime = obstime )
144
+ cam_coordinates = arrays_to_camera (
145
+ x , y , pointing_direction , obstime = obstime , rotated = True
146
+ )
131
147
eq_coordinates = cam_coordinates .transform_to (ICRS )
132
148
133
149
return eq_coordinates .ra .hourangle , eq_coordinates .dec .deg
134
150
135
151
136
- def horizontal_to_camera (zd , az , zd_pointing , az_pointing ):
152
+ def horizontal_to_camera (zd , az , zd_pointing , az_pointing , rotated = True ):
137
153
'''
138
154
Convert sky coordinates from the equatorial frame to FACT camera
139
155
coordinates.
@@ -148,6 +164,11 @@ def horizontal_to_camera(zd, az, zd_pointing, az_pointing):
148
164
Zenith distance of the telescope pointing direction in degree
149
165
az_pointing: number or array-like
150
166
Azimuth of the telescope pointing direction in degree
167
+ rotated: bool
168
+ True means x points right and y points up when looking on the camera
169
+ from the dish, which is the efinition of FACT-Tools >= 1.0 and Mars.
170
+ False means x points up and y points left,
171
+ which is definition in the original FACTPixelMap file.
151
172
152
173
Returns
153
174
-------
@@ -161,13 +182,15 @@ def horizontal_to_camera(zd, az, zd_pointing, az_pointing):
161
182
altaz = arrays_to_altaz (zd , az )
162
183
pointing_direction = arrays_to_altaz (zd_pointing , az_pointing )
163
184
164
- camera_frame = CameraFrame (pointing_direction = pointing_direction )
185
+ camera_frame = CameraFrame (
186
+ pointing_direction = pointing_direction , rotated = rotated
187
+ )
165
188
cam_coordinates = altaz .transform_to (camera_frame )
166
189
167
190
return cam_coordinates .x .to (u .mm ).value , cam_coordinates .y .to (u .mm ).value
168
191
169
192
170
- def camera_to_horizontal (x , y , zd_pointing , az_pointing ):
193
+ def camera_to_horizontal (x , y , zd_pointing , az_pointing , rotated = True ):
171
194
'''
172
195
Convert FACT camera coordinates to sky coordinates in the equatorial (icrs)
173
196
frame.
@@ -184,6 +207,11 @@ def camera_to_horizontal(x, y, zd_pointing, az_pointing):
184
207
Zenith distance of the telescope pointing direction in degree
185
208
az_pointing: number or array-like
186
209
Azimuth of the telescope pointing direction in degree
210
+ rotated: bool
211
+ True means x points right and y points up when looking on the camera
212
+ from the dish, which is the efinition of FACT-Tools >= 1.0 and Mars.
213
+ False means x points up and y points left,
214
+ which is definition in the original FACTPixelMap file.
187
215
188
216
Returns
189
217
-------
@@ -193,7 +221,9 @@ def camera_to_horizontal(x, y, zd_pointing, az_pointing):
193
221
Declination in degrees
194
222
'''
195
223
pointing_direction = arrays_to_altaz (zd_pointing , az_pointing )
196
- cam_coordinates = arrays_to_camera (x , y , pointing_direction )
224
+ cam_coordinates = arrays_to_camera (
225
+ x , y , pointing_direction , rotated = rotated
226
+ )
197
227
altaz = cam_coordinates .transform_to (AltAz (location = LOCATION ))
198
228
199
229
return altaz .zen .deg , altaz .az .deg
0 commit comments