Skip to content

Commit

Permalink
Changed ALE to produce J2000 centric position information
Browse files Browse the repository at this point in the history
  • Loading branch information
acpaquette committed May 25, 2023
1 parent bef1dc6 commit 8e60818
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
5 changes: 1 addition & 4 deletions ale/base/data_naif.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ def reference_frame(self):
String name of the target reference frame
"""
if not hasattr(self, "_reference_frame"):
try:
self._reference_frame = spice.cidfrm(spice.bodn2c(self.target_name))[1]
except:
self._reference_frame = 'IAU_{}'.format(self.target_name)
self._reference_frame = "J2000"
return self._reference_frame

@property
Expand Down
12 changes: 4 additions & 8 deletions ale/formatters/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ def to_isd(driver):
instrument_position['spk_table_original_size'] = len(times)
instrument_position['ephemeris_times'] = times
# Rotate positions and velocities into J2000 then scale into kilometers
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
positions = j2000_rotation.apply_at(positions, times)/1000
instrument_position['positions'] = positions
instrument_position['velocities'] = velocities
instrument_position['positions'] = np.array(positions)/1000
instrument_position['velocities'] = np.array(velocities)/1000
instrument_position["reference_frame"] = j2000_rotation.dest

meta_data['instrument_position'] = instrument_position
Expand All @@ -188,10 +186,8 @@ def to_isd(driver):
sun_position['spk_table_original_size'] = len(times)
sun_position['ephemeris_times'] = times
# Rotate positions and velocities into J2000 then scale into kilometers
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
positions = j2000_rotation.apply_at(positions, times)/1000
sun_position['positions'] = positions
sun_position['velocities'] = velocities
sun_position['positions'] = np.array(positions)/1000
sun_position['velocities'] = np.array(velocities)/1000
sun_position["reference_frame"] = j2000_rotation.dest

meta_data['sun_position'] = sun_position
Expand Down

0 comments on commit 8e60818

Please sign in to comment.