[AstroPy] Need Help about Astropy.table.Table.write
Thomas Robitaille
thomas.robitaille at gmail.com
Fri Jul 25 06:59:21 EDT 2014
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
More information about the AstroPy
mailing list