Skip to content

Added new East-North-Up and UVW frames (from radio astronomy) - #6882

Closed
Joshuaalbert wants to merge 6 commits into
astropy:masterfrom
Joshuaalbert:enu-uvw-frame
Closed

Joshuaalbert wants to merge 6 commits into
astropy:masterfrom
Joshuaalbert:enu-uvw-frame

Conversation

@Joshuaalbert

@Joshuaalbert Joshuaalbert commented Nov 21, 2017 •

Copy link
Copy Markdown

Description edited by @astrofrog: this is a rebased version of #5706 - the original description from that PR is as follows:

This contains a new representation (ENU) for the East-North-Up (right handed) system at a given observer location and obstime. It gives the transformations between ENU and the ITRS frames for the graph transformation. The use case I originally wrote this for was for ray tracing.

@astropy-bot

astropy-bot Bot commented Nov 21, 2017 •

Copy link
Copy Markdown

Hi there @Joshuaalbert 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

I noticed the following issue with this pull request:

  • Changelog entry not present (or pull request number missing) and neither the Affects-dev nor the no-changelog-entry-needed label are set

Would it be possible to fix this? Thanks!

If there are any issues with this message, please report them here.

@astrofrog astrofrog changed the title rebased and added new East-North-Up and UVW (from radio astronomy) fr… Added new East-North-Up and UVW frames (from radio astronomy) Nov 21, 2017
@astrofrog

Copy link
Copy Markdown
Member

@Joshuaalbert - it looks like there are some real test failures due to missing imports. Could you fix these? Note that you can run the tests locally using:

pip install pytest-astropy
python setup.py test

(the pip install command is only needed the first time you try and run the tests)

@eteq
eteq self-requested a review November 21, 2017 23:19

@eteq eteq left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry that this has taken so long, @Joshuaalbert - I lost track of the earlier one.

Generally looks good, but I left some comments where I think the docstrings need more info. Note also that I'm a bit confused why the ENU coordinates are here. My read of #5300 is that that's just a rotation/mirroring of AltAz, which isn't necessary. On the other hand, UVW definitely is. And isn't it the case that UVW with phase=0 is the same? Or am I mis-understanding here?

Also, there needs to be an entry in the changelog for this...


class ENU(BaseCoordinateFrame):
"""
A coordinate or frame in the East-North-Up (ENU) system.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think a bit more specifics about this system are called for. It's centered on the surface of the earth, right? (at location) and the east/north/up are based on the obstime orientation? So is it different from AltAz in any way other than the names? If so, it should be tied to AltAz rather than ITRS, right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(or if I'm misunderstanding and it's different from AltAz, that difference should be stated clearly here in the docstring)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So the ENU system and AltAz have similar coordinates except AltAz is left-handed. Azimuth increases from North to East. AltAz is the same as North-East-Down. Otherwise the origin is fixed to location like AltAz. I included ENU because I had found it useful before, however I'm not married to the idea of including it in astropy. However, I think the UVW is certainly useful for many people. I chose to tie the graph transform to ITRS for simplicity in terms of rotations but now that I think about it, simply flipping Up to Down and rearranging ENU to NED is simpler.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My main concern here is that there's some subtle differences between AltAz and the ENU implemented here - the most obvious is the possibility of atmospheric refraction, but there are more subtle things (like the different code pathways having different machine precision since AltAz uses erfa). So Might it make more sense for this to be transformed from AltAz? That comes with some baggage, though, of requiring an atmospheric refraction.

So I'm tempted to instead say either drop ENU entirely or have it be tied to UVW. (I think the latter is what you were suggesting in your last sentence here?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So I've decided I should just drop ENU as it's not strictly an astro frame in common use. In anycase, it's the same as UVW with phase = zenith.


class UVW(BaseCoordinateFrame):
"""
A coordinate or frame in the UVW system, the conventional radio astronomy frame.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similarly, I think this needs just a sentence or paragraph or something on what the u,v, and w coordinates are. While it's conventional in radio astronomy, the docs still should be comprehensible to non-radio astronomers.

This could also go in the Parameters section if you think that might be clearer.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The convention for UVW is well stated here https://casa.nrao.edu/Memos/CoordConvention.pdf, which is also where I got the unit tests from.
When phase=0 (by which I understand to mean ra=0 and dec=0) the z-axis of UVW points at the vernal equinox (minus the LST). ENU is equivalent to UVW(phase = (ra=local_sidereal_time, dec=latitude)), which is similar to AltAz (see above).

More intuitively, the UVW is the projected ENU frame as seen from the source (the pointing given by phase). The convention is the one used by radio astronomers to specify the baselines of interferometer elements.

I'll add to the docstring.

@frame_transform_graph.transform(FunctionTransform, UVW, ITRS)
def uvw_to_itrs(uvw_coo, itrs_frame):
lon, lat, height = uvw_coo.location.to_geodetic('WGS84')
lst = AltAz(alt=90*u.deg,az=0*u.deg,location=uvw_coo.location,obstime=uvw_coo.obstime).transform_to(ICRS).ra

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Didn't know of that method. Will definitely use it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is a notable problem which I can't understand.
Pytest is failing at lst = time.sidereal_time('mean',10*u.deg) with the below error, but when I run these two lines in the shell it works fine...
Pytest doesn't seem to like things.

time = at.Time("2017-01-26T17:07:00.000",format='isot',scale='utc')
lst = time.sidereal_time('mean',10*u.deg)

produces IERSRangeError: (some) times are outside of range covered by IERS table.
It happens because in function _check_interpolate_indices(self, indices_orig, indices_clipped, max_input_mjd)

z = p[2],
copy=False)
return itrs_frame.realize_frame(rep)
@frame_transform_graph.transform(FunctionTransform, UVW, UVW)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(PEP8 minor nitpick): needs a blank line above

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

check

removed East North Up frame, changed tests to match.
@bsipocz bsipocz modified the milestones: v3.0.0, v3.1 Jan 18, 2018
@astropy-bot astropy-bot Bot closed this Jul 18, 2018
@astrofrog

Copy link
Copy Markdown
Member

There was a bug in the bot, it should not have been closed without the warning so re-opening.

@astrofrog astrofrog reopened this Jul 18, 2018
@astropy astropy deleted a comment from astropy-bot Bot Jul 19, 2018
@astropy-bot

astropy-bot Bot commented Jul 19, 2018

Copy link
Copy Markdown

Hi humans 👋 - this pull request hasn't had any new commits for approximately 7 months. I plan to close this in a month if the pull request doesn't have any new commits by then.

In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary.

If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. You may also consider sending a reminder e-mail about it to the astropy-dev mailing list.

If you believe I commented on this pull request incorrectly, please report this here.

@mhvk

mhvk commented Jul 19, 2018

Copy link
Copy Markdown
Contributor

@Joshuaalbert - would you like to finish this PR? If not, I can take over, as I would like to have the UVW frames. Currently, there are still tests of ENU, even though that frame is no longer defined (and I think we don't really need it). Also, there is some stylistic cleanup (I'll add comments if you can do the changes, otherwise I'll just do them and open a new PR).

@adrn

adrn commented Aug 8, 2018

Copy link
Copy Markdown
Member

Is there another common name for the UVW frame? We use UVW as Galactic velocity components, so there could be some confusion.

@Joshuaalbert

Copy link
Copy Markdown
Author

UVW are the classical letters given to the baseline coordinates. I don't think there are other conventions in use.

@Joshuaalbert

Copy link
Copy Markdown
Author

@mhvk You may continue this PR. It would take a rewrite if I were to readdress it. Specifically, I would need to pay very strict attention to the definition of UVW used by the VLBI people. It's not enough to simply use East-North-Up for precision radio astronomy. The coordinates really depend on the relative motion of the observer.

@astropy-bot

astropy-bot Bot commented Aug 23, 2018

Copy link
Copy Markdown

⏰ Time's up! ⏰

I'm going to close this pull request as per my previous message. If you think what is being added/fixed here is still important, please remember to open an issue to keep track of it. Thanks!

If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here.

@astropy-bot astropy-bot Bot closed this Aug 23, 2018
@bsipocz bsipocz added the closed-by-bot Closed by stale bot label Aug 23, 2018
@astrofrog

Copy link
Copy Markdown
Member

@mhvk - are you interesting in taking this over as you suggested? If so, it might be best to open a new PR rather than re-open this one?

@mhvk

mhvk commented Aug 23, 2018

Copy link
Copy Markdown
Contributor

Yes, I am interested, but given @Joshuaalbert's comment above it would seem a rewrite is needed, so leaving this closed is fine. I created #7766 to remind us.

@caseyjlaw

Copy link
Copy Markdown

@mhvk This would be so valuable for more open access to radio interferometry algorithm development.
Looking at the comment in the old PR, I wonder if we could make progress for connected interferometers. Perhaps it won't be VLBI capable, but we could have a warning if someone tried to use it in that context.

@caseyjlaw

Copy link
Copy Markdown

@Joshuaalbert Would it possible to limit the scope of this to connected interferometers? Maybe the name of the system could be more specific or it can raise a warning if used for VLBI.
This is a development that I see many independent groups need. It would be great to get something implemented.

@mhvk

mhvk commented May 19, 2019

Copy link
Copy Markdown
Contributor

@caseyjlaw - point taken about this being useful - I really do hope to still get around to it (if you have time, do feel free to do it, though...). I do think, though, that we should stick to whatever the precise and proper standard is, and not try to have a shortcut that sort-of works for some not so well-defined conditions. And I don't think it will be that much harder to do it right - all the pieces are definitely in place.

Anyway, probably best to move further discussion to #7766 - closed issues are not the best place to discuss plans!

caseyjlaw added a commit to caseyjlaw/astropy that referenced this pull request Jan 10, 2020
caseyjlaw added a commit to caseyjlaw/astropy that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants