[AstroPy] Constructing Angle from a tuple specified as sign string plus numbers for degrees, arcmin, arcsec

John Gizis gizis at udel.edu
Mon Aug 10 20:19:07 EDT 2015


"It seems a bit strange that the table format in this case indicates the
sign of
the declination as a completely separate field, rather than as just part of
the
numeric string.  But I'm not intimately familiar with the quirks of the CDS
table format. "

I don't think is unusual for CDS tables. I always thought it was because
Fortran77 didn't know -00 is different than +00.























On Mon, Aug 10, 2015 at 11:49 AM, Erik Bray <embray at stsci.edu> wrote:

> On 08/10/2015 05:26 PM, Eric L. N. Jensen wrote:
> > Hi all,
> >
> > I’m working with a table from CDS (i.e. from an ApJ paper) that
> specifies the declination coordinate in four separate columns:  a string
> for the sign of the declination, and three numerical columns for degrees,
> arcminutes, and arcseconds.  Is there a straightforward way to combine
> these into a single astropy.coordinates Angle object?  The standard Angle
> function (constructor?) only accepts a tuple with three entries.
> >
> > I guess what I’m looking for is the inverse method of ‘signed_dms’.
> >
> > If it’s of use, the table I’m working with is here:
> http://iopscience.iop.org/0067-0049/184/1/18/fulltext/apjs300673t4_mrt.txt
> >
> > Thanks in advance for your help with this,
>
> It seems a bit strange that the table format in this case indicates the
> sign of
> the declination as a completely separate field, rather than as just part
> of the
> numeric string.  But I'm not intimately familiar with the quirks of the CDS
> table format.  Is that normal?  I wonder if there's a way to get the CDS
> reader
> to format those fields as a single column.  Tom Aldcroft would know better.
>
> You can instantiate an Angle array using a generator, so you could
> probably just
> slurp in the data using a generator expression, allowing you to transform
> the
> values one a time while creating the Angle rather than transforming the
> table
> all at once first (please bear with the LISPiness of this example):
>
> dec = Angle(((int(row[0] + str(row[1])), row[2], row[3])
>               for row in table['DE-', 'DEd', 'DEm', 'DEs'))
>
>
> # (Note: originally I used row[2:] above, but there seems to be an
> unrelated bug
> involved in taking slices of rows...I'll report on that.)
>
> Erik
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 
John E. Gizis
Professor
Department of Physics and Astronomy
University of Delaware

302-831-2668
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20150810/5e0b5b9c/attachment.html>


More information about the AstroPy mailing list