|
23 | 23 | frame_transform_az_el, |
24 | 24 | get_spacecraft_to_instrument_spin_phase_offset, |
25 | 25 | lo_instrument_pointing, |
| 26 | + spherical_to_cartesian, |
26 | 27 | ) |
27 | 28 | from imap_processing.spice.repoint import get_pointing_times |
28 | 29 | from imap_processing.spice.spin import get_spin_data, get_spin_number |
@@ -1262,36 +1263,13 @@ def create_ra_dec( |
1262 | 1263 | ecl_lats : list of float |
1263 | 1264 | Ecliptic latitude (degrees) for each of the 60 bin centers. |
1264 | 1265 | """ |
1265 | | - |
1266 | | - def radec2cart(ra: float, colatitude_deg: float) -> np.ndarray: |
1267 | | - """ |
1268 | | - Convert right ascension and colatitude to a Cartesian unit vector. |
1269 | | -
|
1270 | | - Parameters |
1271 | | - ---------- |
1272 | | - ra : float |
1273 | | - Right ascension in degrees. |
1274 | | - colatitude_deg : float |
1275 | | - Colatitude (90° − latitude) in degrees. |
1276 | | -
|
1277 | | - Returns |
1278 | | - ------- |
1279 | | - np.ndarray |
1280 | | - 3-element unit vector [x, y, z]. |
1281 | | - """ |
1282 | | - x = np.cos(np.radians(ra)) * np.sin(np.radians(colatitude_deg)) |
1283 | | - y = np.sin(np.radians(ra)) * np.sin(np.radians(colatitude_deg)) |
1284 | | - z = np.cos(np.radians(colatitude_deg)) |
1285 | | - |
1286 | | - return np.array([x, y, z]) |
1287 | | - |
1288 | | - spin_colatitude_deg = 90.0 - spin_ecl_lat |
1289 | | - |
1290 | 1266 | pivot_angle_rad = np.radians(pivot_angle) |
1291 | 1267 |
|
1292 | 1268 | # In ECLIPJ2000 the NEP is [0, 0, 1]. |
1293 | 1269 | nep_unit = np.array([0.0, 0.0, 1.0]) |
1294 | | - spin_axis_unit = radec2cart(spin_ecl_lon, spin_colatitude_deg) |
| 1270 | + spin_axis_unit = spherical_to_cartesian( |
| 1271 | + np.array([[1.0, spin_ecl_lon, spin_ecl_lat]]) |
| 1272 | + )[0] |
1295 | 1273 | spin_axis_unit /= np.linalg.norm(spin_axis_unit) |
1296 | 1274 |
|
1297 | 1275 | # Build a right-handed frame in the plane perpendicular to the spin axis, |
|
0 commit comments