[AstroPy] API question: Instantiating of time/coord and similar
wkerzendorf at gmail.com
Thu May 3 14:53:13 EDT 2012
But AST doesn't handle unit conversion (e.g. from Kelvin to eV) which are also coordinate transformations, because it has a different focus (namely astronomical images and now spectra). For now, we have made the distinctions: time, celestial coordinates, SI units, world coordinate systems for array based data.
That doesn't mean, we don't want them working together: you give a world coordinates system a pixel coordinate, it gives back a celestial coordinate (with units degrees) which I then can easily convert to galactic coordinates. For example
mycoord = myimage.wcs.pix2world(200,300)
mycoord.units is in degrees
mycoord.to_galactic() will return the galactic coordinates.
As I said it would be easiest to show your implementation on an example:
One way we plan to do it is:
mytime = time.from_jd(245423423423)
mytime.to_utc -> will give back a datetime object
mycoord = coord.from_equatorial(200, 20)
mycoord.units (is degrees).
mycoord.to_galactic -> gives back a tuple with galactic coordinates in degrees
How would this work in AST (pseudo code).
The world coordinate system is meant to not specifically be designed for 2D/3D arrays
On 2012-05-03, at 1:39 PM, David Berry wrote:
> What you say is reasonable, but I don't see that it follows that they need to be handled differently. Considered as a class, coordinate systems have a lot of common properties and methods no matter what they describe. Getting a sufficiently generic base class allows you to extend the system easily. That's why it was so easy to add support for spectral and time to AST. In practice it all works out very smoothly.
> On Thursday, 3 May 2012, Perry Greenfield <perry at stsci.edu> wrote:
> > On May 3, 2012, at 11:45 AM, David Berry wrote:
> >> On 3 May 2012 16:39, Wolfgang Kerzendorf <wkerzendorf at gmail.com> wrote:
> >>> Hi all,
> >>> This topic has expanded a lot;-)
> >>> So adressing point 1: Yes, you're technically right. That both of these things do coordinate transformations. But there are many coordinate transformations in astronomy and in astropy we don't have a one-size fits-all mentality about them (in my sense for good reason). For example, switching between different units, doppler-shifting spectra , etc... all are technically coordinate transformations, but we treat them differently and not through one coordinate transformer.
> >> Is there a reason for that?
> > I agree that they are both identical in some respects (and it is worth considering a common api for at least a good part of both). To me the main difference is that one is standards focused (dealing with well known coordinate systems and the transformations between them, whereas wcs is dealing more with instrumental effects and transforming from that to world coordinates (which may be one of the standard systems, but it may not). In one most of the transforms are simple, as is the geometry. In the other they can be quite complex. The former usually transforms few distinct coordinates (yes, you can do big catalogs too), and the latter transforms large numbers of pixel coordinates in many case.
> > So I'm not surprised that people come from different directions when approaching these two issues.
> > Perr
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy