[AstroPy] Need Help about Astropy.table.Table.write

Peter Williams peter at newton.cx
Fri Jul 25 09:00:10 EDT 2014


I'm with Peter T on this. I don't think the standard is well-designed on
this front, but it's still the standard! You want to deal with other
people's broken data sets as best you can, but you don't want to add to
the problem by creating more broken data sets.

If there's a resource out there that gives a clear summary of allowed
FITS units, the AstroPy error message should point people to it.

Peter

On Fri, 2014-07-25 at 20:28 +0800, Guang Yang wrote:
> Hi Peter,
> 
> Emitting a warning is great, just like when reading some non-standard wcs in fits header. 
> 
> Thanks,
> Guang  
> 
> 
> > -----Original email-----
> > From: "Peter Teuben" <teuben at astro.umd.edu>
> > Sent Time: Jul 25, 2014 8:19:43 PM
> > To: "Astronomical Python mailing list" <astropy at scipy.org>
> > Cc: 
> > Subject: Re: [AstroPy] Need Help about Astropy.table.Table.write
> > 
> > Guang,
> >    in your case I think you were done a service, so make 'ct' become
> > "count", since the (FITS) community has decided this to be a better more
> > descriptive word. Most non-english speakers might even have difficulties
> > with "ct" so your desire to there be a future that can override the fits
> > standard has to be take with caution, especially if the column has a 
> > meaning we already agreed upon.
> > 
> > Perhaps the code can emit a warning and refer to the FITS resource where
> > all the units are defined, or even spit out the ones the code knows
> > about .... heaven forbid?
> > 
> > peter
> > 
> > On 07/25/2014 08:07 AM, Guang Yang wrote:
> > > Hi Tom,
> > >
> > > Great, it works. Hope in the future there will be keywords that can overriede the fits standard constraints. 
> > >
> > > Thank you very much,
> > > Guang
> > >
> > >
> > >> -----Original email-----
> > >> From: "Thomas Robitaille" <thomas.robitaille at gmail.com>
> > >> Sent Time: Jul 25, 2014 6:59:21 PM
> > >> To: "Astronomical Python mailing list" <astropy at scipy.org>
> > >> Cc: 
> > >> Subject: Re: [AstroPy] Need Help about Astropy.table.Table.write
> > >>
> > >> Hi Guang,
> > >>
> > >> To overwrite a file, you can use:
> > >>
> > >>   cat.write('new.fits', format='fits', overwrite=True)
> > >>
> > >> For the unit, the issue is that ``ct`` is not a valid unit according to
> > >> the FITS standard. The 'correct' unit for FITS is ``count``. We may be
> > >> overly strict at the moment in that Table.write will simply crash if a
> > >> unit is not standard-compliant, when we could simply emit a warning and
> > >> still write it out, so I will open an issue for that.
> > >>
> > >> So in the mean time, the solution is to do:
> > >>
> > >>   cat['name'].unit = 'count'
> > >>
> > >> where 'name' is the name of the problematic column. Do this before
> > >> writing it out to FITS.
> > >>
> > >> Cheers,
> > >> Tom
> > >>
> > >> Guang Yang wrote:
> > >>> Hi All,
> > >>>
> > >>> I've found Astropy.table.Table.write is unable to write tables with arbitrary units. 
> > >>> For example, after using sextractor to generate a fits table, 
> > >>>
> > >>> from astropy.table import Table
> > >>> cat = Table.read('sextractor_output.fits', format='fits')
> > >>> cat.write('new.fits', format='fits')
> > >>>
> > >>> Then, the error comes: Unit u'ct' is not part of the FITS standard. And I've found no parameter to avoid the unit problem.
> > >>>
> > >>> Also, when the file 'new.fits' already exists, there seems to be no keyword to overwrite the file.
> > >>>
> > >>> Thanks,
> > >>> Guang Yang
> > >>>
> > >>>  
> > >>>
> > >>>
> > >>>
> > >>> _______________________________________________
> > >>> AstroPy mailing list
> > >>> AstroPy at scipy.org
> > >>> http://mail.scipy.org/mailman/listinfo/astropy
> > >> _______________________________________________
> > >> AstroPy mailing list
> > >> AstroPy at scipy.org
> > >> http://mail.scipy.org/mailman/listinfo/astropy
> > > _______________________________________________
> > > AstroPy mailing list
> > > AstroPy at scipy.org
> > > http://mail.scipy.org/mailman/listinfo/astropy
> > 
> > _______________________________________________
> > AstroPy mailing list
> > AstroPy at scipy.org
> > http://mail.scipy.org/mailman/listinfo/astropy
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
> 
> 





More information about the AstroPy mailing list