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
Add topocentric ITRS frame. Create direct transforms between it and o… #13398
Conversation
Hello @mkbrewer 👋! It looks like you've made some changes in your pull request, so I've checked the code again for style. There are no PEP8 style issues with this pull request - thanks! 🎉 Comment last updated at 2022-07-27 19:50:52 UTC |
I am concerned that the transform graph in the Read the Docs build under Astronomical Coordinate Systems Built-in Frame Classes doesn't show my new ITRS<->AltAz and ITRS<->HADec transforms. Am I missing something there? |
I have been doing some more testing. My direct ITRS<->Observed transforms speed up transforms to
I will update the example to show the correct way of doing this. BTW, it would be nice if the units label for arcsec included a space after the number. |
Could someone please find the time to review this? @mhvk? @StuartLittlefair? I am hoping that it won't just languish for months or years. |
Hi @mkbrewer - yes of course, sorry for leaving it to gather dust. I'll try and get to this early next week, but please remind me if I don't! |
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.
Hi @mkbrewer - got around to this finally.
I like the code, but wonder what we can do to make this more user friendly. As you can see in my inline comments, we are straying into the area where the astropy user really has to understand what the coordinate transforms do in order to use them correctly. I think most of this can be addressed in a separate PR for documentation, but perhaps you could look at some of your new docstrings in this light as well?
astropy/coordinates/builtin_frames/itrs_to_observed_transforms.py
Outdated
Show resolved
Hide resolved
Hi @mkbrewer Thanks for the careful replies. I'm definitely in favour of this PR, and I think some minor tweaks to the docs will help the end user. I've suggested these in the inline comments. There are some minor code style errors that are preventing that CI test from passing. You need 2 blank lines around L292 and L954 in Finally, I think this is a change that would benefit from highlighting in the "What's New" section of the 5.2 release. Something along the lines of "A topocentric ITRS frame has been added that makes dealing with near-Earth objects easier" followed by a code example like: t = Time('J2010')
obj = EarthLocation(-1*u.deg, 52*u.deg, height=10.*u.km)
home = EarthLocation(-1*u.deg, 52*u.deg, height=0.*u.km)
# Direction of object from GEOCENTER
itrs_geo = obj.get_itrs(t).cartesian
# now get the Geocentric ITRS position of observatory
obsrepr = home.get_itrs(t).cartesian
# topocentric ITRS position of a straight overhead object
itrs_repr = itrs_geo - obsrepr
# create a ITRS object that appears straight overhead for a TOPOCENTRIC OBSERVER
topocentric_itrs_frame = ITRS(obstime=t, location=home)
itrs_topo = topocentric_itrs_frame.realize_frame(itrs_repr)
# convert to AltAz
aa = itrs_topo.transform_to(AltAz(obstime=t, location=home)) |
One further question that I have: #13398 (comment) |
Very good question! Yes - you should be concerned. I can't believe I missed this, but the transforms don't get registered with the graph unless the code in |
Thanks! |
Still no luck with the transform graph. I don't know what it is about subtracting the two Cartesian positions in |
Well, I don't know about the graphic in the docs, but your transform is there in the frame transform graph. Previously this used to go through CIRS: In [41]: from astropy.coordinates.builtin_frames import frame_transform_graph
...: from astropy.coordinates import AltAz, ITRS
...:
...: trans = frame_transform_graph.get_transform(ITRS, AltAz)
...: for t in trans.transforms:
...: print(f'{t.fromsys.name} -> {t.tosys.name}')
...:
itrs -> altaz For the line in topo_itrs_repr = itrs_geo.cartesian.without_differentials() - siding_spring.get_itrs(t).cartesian or, if you want to keep the satellite velocity (which you get using itrs_siding_spring = siding_spring.get_gcrs(t).transform_to(ITRS(obstime=t)) # CLUNKY, should add zero velocity to get_itrs
dp = itrs_geo.cartesian.without_differentials() - itrs_siding_spring.cartesian.without_differentials()
dv = itrs_geo.cartesian.differentials['s'] - itrs_siding_spring.cartesian.differentials['s']
topo_itrs_repr = dp.with_differentials(dv) N.B - perhaps I'm overdoing this, but is it worth explaining in |
Oh yes. I somehow failed to notice the velocity in the TEME frame and didn't include that in my testing, which is why it worked. Velocity in the ITRS is independent of location, so I don't see the point of
|
Regarding the graphic. I found this in
Does that mean building a new graph is being skipped? |
I'm going to go with an example of carrying the velocity to the topocentric frame without |
Looks good now. The one failure is unrelated. |
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.
Lovely! This looks almost perfect now. I have one more small request, which is that you add a test of the round-trip ITRS->HADec->ITRS. This will test L142 in itrs_observed_transforms.py
which is currently untested
Unfortunately, the documentation build failed, but whatever caused that appears to be unrelated to this PR. And this after my transforms finally appeared in the transform graph after the last build. |
Hmm... |
Is the coordinates failure in https://github.com/astropy/astropy/runs/7472108451?check_suite_focus=true related? The matplotlib stuff looks unrelated. |
No, it is not. |
Yeah, ok. I see it in As far as CI is concerned, I think this is good, unless you also want "exotic" archs to run, then we can add "Extra CI" label; lemme know. Thanks! |
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 looks great! All my comments are essentially nitpicks, so I'm approving, but perhaps this gives the opportunity to also squash the commits (at least the bug/typo fixes).
The new examples make me wonder whether it makes sense to allow subtraction of ITRS frames... it seems a bit ugly to have to go through the cartesian coordinates. But that is another issue!
|
||
def add_refraction(aa_crepr, observed_frame): | ||
# add refraction to AltAz cartesian representation | ||
refa, refb = erfa.refco( |
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.
Hmm, reminds me that this erfa function needs a quantity-aware wrapper as well! But not yet there, so good as is.
You guys get my taskmaster of the year award! 😜 |
Failures are unrelated again. |
49ae8da
to
ce44bfd
Compare
@mkbrewer - OK, looks all OK to go in. Just squashed the commits a bit, to remove the PEP ones, etc. Will merge once the tests ran again. Thanks so much for a really nice contribution! |
You are welcome! I hope that this is helpful for those who deal with the positions of satellites. |
…bserved frames.
Description
This pull request is to address issue #13355. It creates a topocentric ITRS frame and transforms to and from this frame and
AltAz
orHADec
with the ability to add or remove refraction corrections as required.Closes #13355
Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
Extra CI
label.no-changelog-entry-needed
label. If this is a manual backport, use theskip-changelog-checks
label unless special changelog handling is necessary.astropy-bot
check might be missing; do not let the green checkmark fool you.backport-X.Y.x
label(s) before merge.