Skip to content

Commit

Permalink
Removed velocities key from ISD if no velocities are present
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinSanders committed Sep 11, 2024
1 parent 69b7604 commit 3480f86
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions ale/formatters/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,12 @@ 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
# If velocities are provided, then rotate, otherwise create array of 0s to match shape of position
# If velocities are provided, then rotate and add to ISD
if velocities is not None:
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
else:
velocities = np.zeros(positions.shape)
instrument_position['velocities'] = velocities
positions = j2000_rotation.apply_at(positions, times)/1000
instrument_position['positions'] = positions
instrument_position['velocities'] = velocities
instrument_position["reference_frame"] = j2000_rotation.dest

meta_data['instrument_position'] = instrument_position
Expand All @@ -195,14 +193,12 @@ 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
# If velocities are provided, then rotate, otherwise create array of 0s to match shape of position
# If velocities are provided, then rotate and add to ISD
if velocities is not None:
velocities = j2000_rotation.rotate_velocity_at(positions, velocities, times)/1000
else:
velocities = np.zeros(positions.shape)
positions = j2000_rotation.apply_at(positions, times)/1000
positions = j2000_rotation.apply_at(positions, times)/1000
sun_position['velocities'] = velocities
sun_position['positions'] = positions
sun_position['velocities'] = velocities
sun_position["reference_frame"] = j2000_rotation.dest

meta_data['sun_position'] = sun_position
Expand Down

0 comments on commit 3480f86

Please sign in to comment.