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

Spin data and Spin Phase function setup #824

Merged
merged 10 commits into from
Sep 18, 2024

Conversation

tech3371
Copy link
Contributor

@tech3371 tech3371 commented Sep 10, 2024

Change Summary

Overview

Added function to create spin sample data for input date range. Created bare bone function to calculate spin phase and will extend it in future PR.

Updated Files

  • imap_processing/spice/geometry.py
    • function to calculate spin phase
    • Added fixture to generate spin sample data

Testing

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

@tech3371 tech3371 changed the title Spin data DRAFT - Spin data and Spin Phase function setup Sep 10, 2024
@tech3371 tech3371 self-assigned this Sep 10, 2024
@tech3371 tech3371 added SPICE Related to SPICE Level: L1 Level 1 processing Level: L2 Level 2 processing labels Sep 10, 2024
@tech3371 tech3371 added this to the Sept 2024 milestone Sep 10, 2024
@tech3371 tech3371 changed the title DRAFT - Spin data and Spin Phase function setup Spin data and Spin Phase function setup Sep 10, 2024
Copy link
Contributor

@subagonsouth subagonsouth left a comment

Choose a reason for hiding this comment

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

This is looking good. I think that more can be filled in. If you have spin table data (whether it is from a file or generated), you should be able to calculate the spin phase for a set of times.

One piece that I think is missing is a function that takes a list of METs and returns tabular data from the spin table for each MET. Then the spin phase could be implemented.

Maybe this is growing into too big of a PR?

@tech3371
Copy link
Contributor Author

If you have spin table data (whether it is from a file or generated), you should be able to calculate the spin phase for a set of times.
One piece that I think is missing is a function that takes a list of METs and returns tabular data from the spin table for each MET. Then the spin phase could be implemented.

@subagonsouth I do plan to tackle this in upcoming PR. I didn't want to make this PR too big. I want this PR to only generate spin data and then in upcoming PR, use that data to calculate spin phase which will include those that you are thinking. I also need to spend some time to figure out how to implement it. I will take your current ideas as I am thinking about it.

Copy link
Contributor

@laspsandoval laspsandoval left a comment

Choose a reason for hiding this comment

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

I want Tim's feedback on the repointing times. For now it is ok, but you might have to add the gaps in the test ck kernel in.

@tech3371 tech3371 force-pushed the spin_data branch 2 times, most recently from 9cb0e7a to bf9bf90 Compare September 12, 2024 22:33
Copy link
Collaborator

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

I think this seems like a good approach. Loading a spin file from somewhere on the disk into a pandas dataframe. In the tests, you're making it for the user similar to the SPICE metakernel. In processing we'll set this environment variable to wherever the actual data is.

Something to think about is that we are adding a lot of environment variables now, is this going to be in a separate location from IMAP_DATA_DIR, or is it going to be relative to that and we can leverage that environment variable that is already there?

Comment on lines +221 to +347
# Find index of all timestamps that fall within 10 minutes after midnight
repointing_times = spin_start_dates_series[
(spin_start_dates_series.dt.time >= pd.Timestamp("00:00:00").time())
& (spin_start_dates_series.dt.time < pd.Timestamp("00:10:00").time())
]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your "00" test will always be true, so you can either drop that one, or say +/- 10 minutes so you get before and after midnight.

Suggested change
# Find index of all timestamps that fall within 10 minutes after midnight
repointing_times = spin_start_dates_series[
(spin_start_dates_series.dt.time >= pd.Timestamp("00:00:00").time())
& (spin_start_dates_series.dt.time < pd.Timestamp("00:10:00").time())
]
# Find index of all timestamps that fall within 10 minutes of midnight
repointing_times = spin_start_dates_series[
(spin_start_dates_series.dt.time > pd.Timestamp("23:50:00").time())
& (spin_start_dates_series.dt.time < pd.Timestamp("00:10:00").time())
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am assuming nominal repointing time is 10 minutes. With this, it will become 20 minutes. Is that right? Did you want this to five minutes before and after instead.

@tech3371
Copy link
Contributor Author

Something to think about is that we are adding a lot of environment variables now, is this going to be in a separate location from IMAP_DATA_DIR, or is it going to be relative to that and we can leverage that environment variable that is already there?

@greglucas, @laspsandoval and @subagonsouth was thinking in similar manner. This will depend on where we decide to store spin data and how we get it. But I think having some fixed path for spin data in imap-data-access repo will be good if we decide to keep spin data in csv file and use download API to get it. Something to revisit in the near future.

Copy link
Contributor

@subagonsouth subagonsouth left a comment

Choose a reason for hiding this comment

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

This looks good to go once my one nit-pick is addressed. Thanks for your persistence on this PR!

@tech3371 tech3371 merged commit fe67958 into IMAP-Science-Operations-Center:dev Sep 18, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Level: L1 Level 1 processing Level: L2 Level 2 processing SPICE Related to SPICE
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

SPICE - Spin phase query utils function - using spin start and spin rate data.
4 participants