[AstroPy] (Table) unit formatting
pweilbacher at aip.de
Wed Nov 1 12:52:13 EDT 2017
On Wed, 1 Nov 2017, Thomas Robitaille wrote:
> The issue is that the FITS standard includes a prescription about how units
> should be formatted, and we follow the standard strictly when writing files
> to make sure the files we produce are standard-compliant. I would therefore
> advise against trying to modify TUNIT to make it more 'human-friendly'
> since it will result in it being non-standard-compliant and could cause
> issues when other people try and read it in. When the table is loaded into
> a Table object in Python you can of course convert units to various string
> representations including latex - but we should stick to the standard when
> writing FITS files.
'erg/s/cm**2' /is/ a valid FITS unit string, I see no reason that it
gets mangled to 'cm-2 erg s-1'. I could agree it getting changed to
'erg/(s cm**2)' but removing all slashes and sorting the individual
units in ascending alphabetical order is not required by the standard
And actually, since the standard says that multiple slashes /may/ be
used (despite them being discouraged), FITS readers have to be capable
to handle such files anyway. (Couldn't find the sentence in the IAU
style manual that forbids multiple slashes.)
> The fact that the format on Table columns is not propagated to TDISP sounds
> like an oversight. Can you open an issue in the astropy repository?
> We indeed don't currently print descriptions when showing a Table object in
> Python and also don't write them to FITS. Feel free to open feature
> requests for these in the issue tracker above too. Keep that issue separate
> from the TDISP issue which I think is an actual bug/oversight - whereas I
> think there is no 'standard' way to write descriptions for columns to FITS
> so this is more of a possible feature request.
Right, anyway, I opened https://github.com/astropy/astropy/issues/6807
I didn't see a way to make it a feature request over a bug, but someone
else may be able to tag it accordingly.
But thanks for the answers, so I know that for now I'll have to do these
things "by hand".
Dr. Peter M. Weilbacher http://www.aip.de/People/PWeilbacher
Phone +49 331 74 99-667 encryption key ID 7D6B4AA0
Leibniz-Institut für Astrophysik Potsdam (AIP)
An der Sternwarte 16, D-14482 Potsdam
Vorstand: Prof. Dr. Matthias Steinmetz, Matthias Winker
Stiftung bürgerlichen Rechts, Stiftungsverz. Brandenburg: 26 742-00/7026
More information about the AstroPy