Skip to content

Commit

Permalink
Allow no velocities for instrument/sun position
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinSanders committed Sep 9, 2024
1 parent 0ba7b24 commit 69b7604
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ale/formatters/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ 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
# If velocities are provided, then rotate, otherwise create array of 0s to match shape of position
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
instrument_position['positions'] = positions
instrument_position['velocities'] = velocities
Expand All @@ -191,7 +195,11 @@ 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
# If velocities are provided, then rotate, otherwise create array of 0s to match shape of position
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
sun_position['positions'] = positions
sun_position['velocities'] = velocities
Expand Down

0 comments on commit 69b7604

Please sign in to comment.