[AstroPy] Need Help about Astropy.table.Table.write
Guang Yang
yg1991 at mail.ustc.edu.cn
Fri Jul 25 08:07:48 EDT 2014
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
More information about the AstroPy
mailing list