Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1019 calculate instrument spin phase #1022

Conversation

subagonsouth
Copy link
Contributor

Change Summary

Overview

Adds two functions:

  • get_spacecraft_to_instrument_spin_phase_offset()
    This function provides the offset to apply to the spacecraft spin phase to get the instrument spin phase. For now, this is a hard coded table. In the future, it will most likely use SPICE to determine the phase offset.
  • get_instrument_spin_phase()
    This function just adds the offset to the spacecraft spin phase and does a modulus with 1 to return the phase to the [0, 1) range.

Updated Files

  • imap_processing/spice/geometry.py
  • imap_processing/tests/spice/test_geometry.py

Closes: #1019

Add function get_spacecraft_to_instrument_spin_phase_offset
Add test coverage for new geometry functions
@subagonsouth subagonsouth added the SPICE Related to SPICE label Oct 16, 2024
@subagonsouth subagonsouth added this to the Oct 2024 milestone Oct 16, 2024
@subagonsouth subagonsouth self-assigned this Oct 16, 2024
Copy link
Contributor

@tech3371 tech3371 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

"""
Get the spin phase offset from the spacecraft to the instrument.

The spin phase offset is can be calculated using the instrument frame SPICE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The spin phase offset is can be calculated using the instrument frame SPICE
The spin phase offset can be calculated using the instrument frame SPICE

instrument_spin_phase_offset = get_spacecraft_to_instrument_spin_phase_offset(
instrument
)
return (spacecraft_spin_phase + instrument_spin_phase_offset) % 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This % 1 is to get the [0, 1) range?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is correct. The s/c spin phase is in [0, 1) but then we add a positive offset value that is also in the range [0, 1), so we need to "unwind" the phase back into the [0, 1) range.

)
def test_get_instrument_spin_phase(instrument, fake_spin_data):
"""Test coverage for get_instrument_spin_phase()"""
ets = np.array([7.5, 30, 61, 75, 106, 121, 136])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you spell est out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure... that should be MET instead of ephemeris time (et) anyway.

@subagonsouth subagonsouth merged commit f7b2467 into IMAP-Science-Operations-Center:dev Oct 16, 2024
17 checks passed
@subagonsouth subagonsouth deleted the 1019-calculate-instrument-spin-phase branch October 16, 2024 20:16
@tech3371 tech3371 removed this from the Oct 2024 milestone Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPICE Related to SPICE
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Calculate instrument spin phase
2 participants