-
Notifications
You must be signed in to change notification settings - Fork 13
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
SPICE geometry enums and IMAP state function #791
SPICE geometry enums and IMAP state function #791
Conversation
imap_processing/spice/geometry.py
Outdated
class SpiceId(NamedTuple): | ||
"""Class that represents a unique identifier in the NAIF SPICE library.""" | ||
|
||
strid: str | ||
numid: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get rid of this NamedTuple and just use your Enums directly below. Maybe use IntEnum instead. But then you'd just have SpiceBody.IMAP.name
which would still return the string IMAP. (The one difference you have is SSB which I think could just be written out in the long form)
class SpiceId(NamedTuple): | |
"""Class that represents a unique identifier in the NAIF SPICE library.""" | |
strid: str | |
numid: int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only issue I see with that is that some SPICE names have spaces in them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting... and unfortunate. It would be much cleaner as a normal Enum if we could somehow manage that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any spaces in IMAP names and don't know of any SPICE names with spaces so I will implement it with just IntEnum
for now.
imap_processing/spice/geometry.py
Outdated
numid: int | ||
|
||
|
||
class SpiceBody(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, I really like this style of defining these as Enums.
Do we ever run into a situation of possibly getting out of sync with the SPICE kernels? Should these be dynamically looked up from the Kernels themselves somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good question. It would be great to parse certain kernels for this information. I'd have to think about how to approach that. For example, do we check those kernels into the repo? The likelihood that any of the spacecraft or instrument values change should be small. I can write a ticket up for this but think that for now it is a nice to have that would take too much development time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Completely agree that this is very minor. I was just curious, so definitely punt on it into the very distant future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for the addition. Just a few changes along with Greg's.
imap_processing/spice/geometry.py
Outdated
from imap_processing.spice.kernels import ensure_spice | ||
|
||
|
||
class SpiceId(NamedTuple): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this not work here?
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/bodn2c_c.html
sun_id = spice.bodn2c("SUN")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With little I know, it looks good to me. I was able to follow it on high level.
Add geometry functions for computing IMAP spacecraft state (position, velocity) Add IMAP SPK kernel from Nick's 366 day simulation Add test coverage for new geometry functions
Remove SpiceId(NamedTuple) Parameterize test to cover single and iterable ET input Change typing on ensure_spice to apease mypy Fix up ensure_spice decorator factory typing
0482da9
to
55320bf
Compare
8b7d5e8
into
IMAP-Science-Operations-Center:dev
Change Summary
Overview
New Files
Deleted Files
N/A
Updated Files
Testing
2 Unit tests added
closes #787