Repository navigation
Add basic example building Mars reference frames. - #14990
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
|
||
| from .icrs import ICRS | ||
|
|
||
| __all__ = ["BaseBodyCoordinateFrame"] |
There was a problem hiding this comment.
This is technically a new API, so this PR needs a change log.
|
For some reason my last commit is not taken into account ... I'm going to close and reopen the PR, to see if CI are triggered. |
|
Still trying to justify the introduction of a base class ... I have added a North Pole coordinates attribute to the class. The ephemerids of the prime meridian should also be there but they depend on the observation time, so maybe a generic method to be overwritten would be better.... but it is beyond the scope of this pull request. |
2640414 to
e092916
Compare
mhvk
left a comment
There was a problem hiding this comment.
@cmarmo - thanks for the attempt at splitting out and apologies for being a bit tardy.
I think this PR still introduces BaseBodyCoordinateFrame in a way that is unclear and would suggest to simplify it so we can just merge the example you made, and focus on how to implement the actual frame elsewhere. In particular, as per my previous comment, "this should not be in builtin_frames. In principle, if it stays really basic and adds a bit more than it does now to BaseCoordinateFrame, it could be in base_frame.py. Alternatively, it might make more sense in solar_system.py, including machinery to generate planet-specific frames on demand, though my sense is that perhaps for starters we should stick it in wcs."
The more I think about it, the better it seems to have the minimal version constructed on the spot in wcs, where we can just use what is needed, without yet worrying about how to transform to other systems.
|
@mhvk , I have applied your comments. As this PR no longer adds a new class I guess there is no need for a changelog? |
mhvk
left a comment
There was a problem hiding this comment.
OK, looks good. Just one request to add a bit of clarification.
| # representation with respect to the spherical model, assuming the point on the | ||
| # surface of the body (``height = 0``) | ||
|
|
||
| mars_sphere = MarsCoordinateFrame(lon=np.linspace(0, 2*np.pi, 128)*u.radian, |
There was a problem hiding this comment.
Since I am still asking for an edit, could you align the indentations while you are at it?
(Also, I'd do np.linspace(0, 360, 121) * u.deg - radians are just so annoying! but up to you.)
There was a problem hiding this comment.
Hope this is what you had in mind...
mhvk
left a comment
There was a problem hiding this comment.
Sorry, I think we can improve the plot still a little -- I'll check at home...
| mars_ocentric = MarsCoordinateFrame( | ||
| lon=np.linspace(0, 360, 128)*u.deg, | ||
| lat=np.linspace(-90, 90, 128)*u.deg, | ||
| representation_type=MarsBestFitOcentricAeroid) |
There was a problem hiding this comment.
is this plot the one you expected?
Yes, I checked the trends with lat and long and it seems to me that they are correct.... their readability could probably be improved...
There was a problem hiding this comment.
OK. I wasn't quite sure how to read the figure, but after a bit more staring think I've got it. Not quite sure how to improve it, so maybe fine to leave it as is.
|
|
||
| fig, ax = plt.subplots(2, subplot_kw={"projection": "3d"}) | ||
|
|
||
| ax[0].scatter( |
There was a problem hiding this comment.
Sorry to see at this only now, but in principle we should not use private properties and we should be able to use units... (using astropy.visualization.quantity_support()) I'll have a closer look tonight or tomorrow.
There was a problem hiding this comment.
I'm checking the use of quantity_support and how to get rid of the private properties.
|
@cmarmo - I couldn't push to your repository directly so made a PR to it - see oudeis-io#1 |
Sorry! I didn't check the PR before pushing new commits... I'm going to merge your pr after fixing the conflicts. |
|
I think the last 3 commits now do nothing -- you can check with |
|
Yes, rebasing and fixing pre-commit where I messed things up... |
32ebc44 to
e0dc584
Compare
mhvk
left a comment
There was a problem hiding this comment.
Great! Will set this to be merged once tests pass.

Description
This pull request addresses item 1 in #14820 (review).
The example about creating a reference frame for Mars is cleaned up (thanks @mhvk for your explanations, I was climbing the wrong mountain... 😕), the ITRS test is added.
I've kept the definition of a
BaseBodyCoordinateFrameeven if for now it looks unnecessary. Here's why:solar_system.py). The observer position (as in sunpy), will be available in the next major version of WCSLIB.DId I successfully make my case? 😇
As always, thanks for considering this pull request!
This work is funded by the Europlanet 2024 Research Infrastructure (RI) Grant.