Repository navigation
support corrected spin start times (use_corrected_spin_start flag) - #3548
Conversation
…est_data) has changed
|
@tmplummer - the last commit was added because our CI cache saves the A Ideally we'd only be caching on |
tmplummer
left a comment
There was a problem hiding this comment.
Overall looks good. I am just a bit concerned about defaulting to use the corrected times. Can you do an accounting of all instruments that use these functions so we can double check where to use corrected times and where not to?
| @functools.cache | ||
| def _load_spin_data_with_cache(csv_paths: tuple[Path]) -> pd.DataFrame: | ||
| def _load_spin_data_with_cache( | ||
| csv_paths: tuple[Path], use_corrected_spin_start: bool |
There was a problem hiding this comment.
My opinion is that get_spin_data should return the full table, not one or the other spin start time. I can see instances where it would perhaps be useful to know the difference between original and corrected. For example, that was how I thought Lo prostar would apply the correct shift... Maybe that isn't true. I am open to disagreement on this.
There was a problem hiding this comment.
I guess I'm confused now - I thought the purpose of introducing the *_corr columns was that no caller to the function would need to change their calls. Lo prostar (the new implementation in a pending PR) is simply calling get_spin_data(), so it will apply the correct shift once that code is merged and reprocessing is done (unless it was applying hand-crafted shifts applicable for certain date ranges, which it is not).
| 1, | ||
| 0, | ||
| 0, | ||
| ], |
There was a problem hiding this comment.
Haha, that really blew those lines up!
|
|
||
|
|
||
| def get_spin_data() -> pd.DataFrame: | ||
| def get_spin_data(use_corrected_spin_start: bool = True) -> pd.DataFrame: |
There was a problem hiding this comment.
I'm a bit worried about defaulting to True. While I agree that it is probably the most often used default, I know for a fact that GLOWS needs this set to False. They had the assumption that the new columns would be returned as new pd.Dataframe columns and so they would not need any code changes to keep existing functionality.
There was a problem hiding this comment.
By "existing functionality", do you mean that GLOWS needs the old (shifted one way or correct, depending on the date) incorrect spin data?
In that case, probably we should change its call here to pass in False?
Or do they not want any code changes or re-deployment of their containers such that that line cannot change? (In which case, all other callers should pass-in True and the default changed to False?)
My concern there would be that after a while we'll simply forget to pass in True for new call sites and re-processing old dates will again generate incorrect data.
|
@tmplummer - can you confirm if my understanding is correct: In the sample files attached with issue #3543, I see that for DOY 169 (June 18th), the DOY 169 was just an example, - all spin files for all dates will be reprocessed, so in all cases the |
All spin files will be reprocessed through September 30. From there on, we expect the corrected start times to match. And, yes... *_corr columns should always be the correct values. |
|
@tmplummer - perhaps what you're getting at is that certain functions should return the "best" data by default. This list slightly modified from your original and the functions that return Even though no code is doing any checks across these corrected/uncorrected columns, that allows us (or the instrument teams) to do that in the future. Code that is looking inside the dataframes will get uncorrected values till modified. Can you give this a thumbs-up if you want this? |
… along with new ones
I think so... do you agree? Then I would add that we should look at all uses of the functions in spin.py and try to determine which instruments don't want the "best" data. |
|
This table was generated using AI a while back. It summarizes the instruments that rely on spin-table data.
|
…olate_spin_data; overridable
|
@tmplummer - the behavior that makes sense to me and that I've gone with based on the discussions above:
This is somewhat motivated by looking at the number of callers who are calling
Hope this sounds reasonable. I haven't changed any calling code for any instrument in the PR (yet), because I don't know what each instrument team is expecting to happen. Perhaps this can be ironed out in the meeting today. |
|
@vineetbansal Margaret just got confirmation from the GLOWS team that the desired behavior is to reprocess everything with the uncorrected spins, i.e., with Do we need a separate issue for L3? I can work on that if there isn't one already. Should be a couple of lines diff. |
|
@leowerneck - I think you meant @tmplummer - I see two places where it is interfacing with GLOWS seems to be doing something like this in their ancillary file. |
|
It seems like L3 does not need modification. For example, running: grep -rnE "spice\.spin|get_spin_|spin_phase\(|interpolate_spin_data" imap_l3_processingdoesn't return anything obvious. The only hit is |
tmplummer
left a comment
There was a problem hiding this comment.
Looks good! Thanks for taking this on.
fc4e121
into
IMAP-Science-Operations-Center:dev
Closes #3543
I've had to add the
use_corrected_spin_startflag at a few more places than originally suggested, since quite a few callers outside this module are directly callingget_spin_data, and I take it that they should get the new (corrected) columns by default as well.I haven't added any new tests, only modified the existing ones.