Can I propose we split this discussion? If we constantly say "wait,
those two things are interrelated" we'll never get anywhere. As I see
it, there are a few discussions going in one intermingled thread - if
we're ok with splitting the topic, I would recommend doing that if you
reply to this.
* How to go from WCS to coordinate systems. By this I don't
necessarily mean the WCS *standard*, but rather, as Tom says, a scheme
of mapping unitless/data values onto *some* coordinate system. Let me
suggest a different term, so we can discuss it without commingling it
with implementation details of WCS: "DTCT" (for Data-To-Coordinate
Transform). How this maps to coordinate systems both in a physical
and API sense is something we need to think about, and should probably
be a separate thread.
* How to deal with IFU data or similar where spatial and wavelength
(or other physical types) of data are intermixed. This clearly ties
into the above and below point, but I think it needs to be carefully
considered *on its own* (as Vicki and others rightfully pointed out)
with an eye towards practicality for astronomy users.
* Spatial coords API: This is the one thing that can actually be
implemented now, and has use completely independent of the other
issues (sometimes I have an RA/Dec table and just want to know it in
galactic coordinates!). I've made some specific comments on this
topic below, but I think it might be more constructive to work from a
skeleton API. Demitri Muna and I are working on this now, so
hopefully there'll be something a little bit more specific to work
from soon. We then do a relatively simple "it just works"
implementation and we can expand the implementation later to fit with
the above two concerns.
* Should we use AST? This part seems to have lapsed a bit, but as (I
think) I said earlier, I can see no way we can use the implementation
of AST directly as a piece of the astropy core for a variety of
reasons (which I can go into if someone wants me to). What we
*should* do is use implementation lessons their valuable experience
can bring us, and hopefully also make a pyast <-> astropy.coords
mapping possible.
* Time API: this is nominally part of this thread, but the discussion
seems to have lapsed in favor of PR #212, which is fine for me, but it
maybe could use some astropy-dev exposure... but either way it should
be a separate discussion, not explicitly referencing coordinate
systems.
> mycoords = eq_coords(49.3274450, -41.1080650)
> mycoords = eq_coords("49.3274450 -41.1080650")
> mycoords = eq_coords("49.3274450", "-41.1080650")
> mycoords = eq_coords("03h17m18.587s -41d06m29.03s")
> mycoords = eq_coords("03:17:18.587 -41:06:29.03")
> mycoords = eq_coords("03:17:18.587", "-41:06:29.03")
I agree that these should all work. I understand Wolfgang's point
that explicit is better than implicit, but you're removing one of the
most relevant lines for astronomers: "Although practicality beats
purity." astropysics.coords supports this functionality, and use it
literally almost every day. Although note that, I think instead of
`eq_coords`, the class should be more specific - e.g. `ICRSCoords` or
`FK5Coords`, as those are well-defined systems, rather than
"equatorial," which means a lot of different things.
> mycoords = eq_coords("03", "17", "18.587", "-41", "06", "29.03")
This one, on the other hand, is more ambiguous... Its true that in
most cases its likely sexigesimal, but this was the only one that I
looked at and said "I've never seen something like that in a table of
a paper before".
>> when the input is, e.g., "23h12m15.6s" strikes me as willfully perverse.
>
> I agree that requiring it is a bit much, but it's still good that it
> can be specified. If we're dealing with a lot of coordinates, and we
> know ahead of time what their format will be, it's quite excessive to
> try to parse out what the format is for each coordinate object
> initialized. Perhaps there should be a classmethod that returns a
> dict of format keywords for a given coordinate input that can then be
> used to instantiate more coordinate objects.
My experience has been that it wouldn't speed things up that much to
pre-determine the parser... Object creation/function call overhead
will probably dominate. *BUT*, if we end up with an array-based
coordinate class (which I think we have to, eventually), this becomes
more important.
These goals can be met with two different interface approaches though,
and I good question is which one should we use. The two choices are:
1. The class initializers do the parsing. e.g.,
ICRSCoords("03h17m18.587s -41d06m29.03s")
2. The class initializers only accept an internal representation, and
some other function is used for the parsing.
ICRSCoords(49.32744583, -41.1080639)
or
ICRSCoords.parse_string("03h17m18.587s -41d06m29.03s")
or
parse_string("03h17m18.587s -41d06m29.03s",coordsys=ICRSCoords)
I favor #1 because it is the easiest to teach to new users, and
there's no obviously compelling reason to separate out the
functionality (it can always be *implemented* internally through a
private parsing function to avoid reinventing the wheel for multiple
coordinate systems).
--
Erik Tollerud