-
-
Notifications
You must be signed in to change notification settings - Fork 18
Conversion from celestial to altaz coordinates #6
base: master
Are you sure you want to change the base?
Conversation
Some of this came up in the initial API discussions for coordinates. In particular the need for time and observer location and whether those are top level attributes of all coordinate objects or something that is added to subclasses. The other discussion concerned whether NDData should have epoch information at the top level or rely on it being in the coordinates object. The pyast library handles AZEL. @dsberry had implemented a version of the astropy coordinates API using pyast. I think the next step is to define the observer object. I'm guessing that spacecraft as observers causes issues. |
Just a quick comment, I think that the position on the earth should just be represented by a |
A follow-up on my previous comment - one could simply have |
This is such a complex topic, because there's so many different ways to make this API, i.e. how to group the different parameters needed into different classes. Here's a (depending on the scope of
At the moment we have One issue I think we should keep an eye on is that we don't duplicate the same parameters in different objects, or at least as few duplications as possible if it can't be avoided. E.g. currently
and Another point I'd like to make is that I think it would be a mistake to implement celestial <=> horizontal coordinate conversions from scratch, because it's a huge effort. Instead we should wrap an existing high-precision and fast C library and give it a nice Python API (does anyone disagree on this point?). A while back I've tried to summarize the existing libraries and tried to identify which would have a BSD-compatible license here. Unfortunately as far as I can tell there is no BSD-compatible suitable library available at the moment, so we should bug the authors of the candidate libraries to re-consider:
To get a taste for what is needed for high-precision celestial <=> horizontal coordinate conversions, have a look at the TPM states and the TPM state parameters. I don't see the value of implementing a very low-precision conversion assuming the Earth is a sphere as suggested above (anyone disagree?) I'm not sure, but I doubt that the API we are discussing here is independent of the library we base it on, so I doubt it is a good idea to implement some nice API for low-precision coordinate conversions for astropy 0.3 and assume this API would work well (clean and efficient) for later when we do change to fast, high-precision coordinate conversions using some library. Which parameters should be stored in which So before or in parallel to this discussion on the
For the last two questions, let me list some of the coordinate computations I'd like to be able to do (with high precision and if possible efficiently) with
These things I would say are out of the scope for
Sorry for the long post! I guess my comment can be summarized like this: |
@mperrin - To start with a minor detail: I think it might be better to start this as a new document ( @mperrin @astrofrog - I definitely like what you're saying here, and is exactly what I was thinking. We can combine the two by having a I also think that adding this functionality should also add a registry of sites, starting with some of the "standard" lists of observatories. Later on, we would expand this to include additional information (or at least the option of it) like telescopes, various parameters of those telescopes, instruments on them, and even information like particular CCDs' readout characteristics. We don't want to be in the business of managing all this information in the source code, but it would be relatively easy to make a framework to do this so that As for @mperrin's question of Speaking of which, the particular case of |
@timj @astrofrog re: space-based locations: Actually, I would think these are relatively easy. The complications for earth coordinates mostly come from dealing with equinoxes and such, which are not an issue for spacecraft observers. If you have e.g. barycentric coordinates (cartesian or otherwise) for your spacecraft, you can take any ICRSCoordinate, offset the origin to the location of your spacecraft, possibly rotate, switch back to spherical, and you're done. That machinery is already in (This post is not GR-compliant, but I'm willing to punt that for later... :) |
@cdeil - A discussion of what's "in scope" is exactly what the API discussion is about, isn't it? I do not want this to be in general terms, though, as that's what many of these discussions have devolved into. So I like that @mperrin has a specific set of requirements/examples here, and I think I agree with all your items of what should be in (although I think atmospheric refraction is farther down on the todo list than all the others). I think ephemerides should be in Astropy - not a huge set of them, but a framework that others can build from if they want to. We definitely need Sun and Moon (and all the hard work is already done, as that's in SOFA, which we already have), and I think the planets wouldn't be too much trouble. It also wouldn't be that much work to add in a way to query the JPL ephemerides files and represent them in a way Astropy could read. I think this should all be in the core, but is the next item on the list after getting the coordinates hashed out. (Also, as I mentioned above, outer space observers should actually be pretty easy to implement in the existing framework.) We should also keep possible future compatibility with GR in mind, but it's last on the priority list (but yes, in the core someday is a future goal).
I'm going to push back a little here: I strongly disagree that we should be thinking about the C library implementations when designing the API. We should design an API that makes sense, and then implement accordingly. I think a lot of the other library's APIs are confusing because they did not do this, or added on API features once they realized they could implement them. I have plenty I could say about the rest, but I don't want to get caught up here in the question of whether or not to use a C library, as it's a separate discussion. There will definitely be a skype/google hangour-con on this topic soon after 0.2 is released - I presume you want to be in on that @cdeil ? |
@eteq - re "My inclination is that it should be kpno.observe(star), and if there's no obstime in the star" The whole notion of having an "obstime in the star" sounds painfully unintuitive to me. That's not a meaningful concept physically, and it's not how most astronomers think about this topic. Yes, there are some coordinates types that include an obstime parameter, but that's really the exception not the rule. Consider the most typical case: You've got a star which has some known ICRS/J2000 coordinates, and you want to figure out its position on some other datetime, say today 2013 Jan 21 10:00 pm EST. Thus the datetime of the observation is completely different from the datetime associated with the coordinates class. Trying to conflate those is going to cause far more confusion than anything else, in my opinion. |
Re: space based observers, this is not quite as simple as you make it out to be. The relative-motion-induced shift in apparent locations ("aberration of starlight") is a larger effect for space based observers than terrestrial ones given the higher velocities. You can't actually punt this effect without getting relative positions wrong by many tens of arcseconds. That said, I think we should (for now, and likely a long time) set aside space based observers entirely. The fundamental paradigm of an observer with a fixed location and a locally-defined horizontal coordinate system doesn't apply. Spacecraft attitude control is a complex and subtle subject which I don't see astropy making inroads into any time soon. I'd suggest waiting until we have some clear use cases for this before giving it any more thought. We have plenty of well-defined and relevant use cases for terrestrial calculations to keep us busy for now. :-) |
@eteq The list of telescope coordinates is a pretty easy thing to deal with. The perl Astro::Telescope (timj/perl-Astro-Telescope@01abf3d) module handles it by supporting the names of pre-canned coordinates that are available in SLALIB or PAL but it also generates coordinates from the list at the Minor Planet Center (http://www.minorplanetcenter.net/iau/lists/ObsCodes.html). |
@eteq - we may want to consider whether the For example, one could use FK4 coordinates with an equinox of B1950, and epoch (for the coordinates) of B1978, and want to observe that source tomorrow. The user can't just update the So one could rename |
@eteq regarding plannets and moon ephemeris data the SOFA implementations are fine for low precision situations (up to an arcminute error I think). There are a number of other approaches that are more accurate but without requiring the full DE405 JPL ephemeris data files. Pat Wallace suggested that we take a look at http://cdsarc.u-strasbg.fr/viz-bin/Cat?VI/87 since it gives milliarcsec accuracy and only requires 1 MB of data file to be included. I've also just discovered Chapront 1995, A&AS, 109 which is used by some telescope control systems but I haven't had a look at the size of the data files required to implement it. |
For instrumenting a telescope I was just looking for sample code using astropy for conversion between celestial coordinates (RA and declination) and local Earth based observer's horizon based Altitude/Azimuth coordinates (taking into account the observer's location - latitude, longitude, and perhaps altitude, and the current date/time). [In both directions ideally] I didn't find anything obvious in the documentation, and this pull request suggests it is an open feature request... is that correct? Thanks! |
At the #hackAAS hack day, I started helping @elovegrove to modify her program PYRO (https://github.com/elovegrove/PYRO) to use astropy.coordinates. However I quickly discovered that astropy.coordinates is still missing an interface to convert from celestial coordinates to apparent horizontal coordinates at some observatory. So, I started coding.
The first ingredient is some way to represent an observer's position on the earth. I implemented a LatitudeLongitude coordinates class, following the examples of the other systems. For now there's only one such system and it doesn't have any transformations, and also it ignores the details of the geoid to just treat the Earth as a perfect sphere. (I imagine if eventually more precision is needed, one could use the transformations framework to define conversions between various geoid models… but that's getting ahead of the story).
Then, the next question is, what should the API be for using LatitudeLongitudes to get a HorizontalCoordinates? I propose something like this:
One could conversely imagine making it a function on the observatory location instead:
Either API could work fine. It just seems a bit cleaner to me to have the time and place of the observation treated identically, as part of the function call. It should still support a syntax using the convert_to function, something like
but I think this is a common enough conversion that it deserves some syntactic sugar. Thoughts?