<div dir="ltr">Hi Peter,<div><br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div><a href="https://github.com/astropy/astropy/issues/new" target="_blank">https://github.com/astropy/<wbr>astropy/issues/new</a><br></div><div><br></div><div>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.</div><div><br></div><div>I hope this helps!</div><div><br></div><div>Cheers,</div><div>Tom</div><div><br></div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 October 2017 at 14:28, Peter Weilbacher <span dir="ltr"><<a href="mailto:pweilbacher@aip.de" target="_blank">pweilbacher@aip.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
I'm trying to add units to table columns with AstroPy (v2.0.1) and save<br>
the resulting table as FITS (for now). So I enter unit strings like this<br>
   table['colname'].unit = 'erg/s/cm**2'<br>
and write the table to disk. Unfortunately, I not only get the annoying<br>
units warning about the multiple slashes (any way to turn that off?) but<br>
also discover that the strong got converted to 'cm-2 erg s-1' which<br>
while correct is really ugly -- nobody would write it like that in a<br>
paper! And actually, when I use print to look at the table before<br>
saving, I see that units as 'erg / (cm2 s)' which is not nice, either,<br>
but that I can live with.<br>
<br>
Can I adjust this behavior of do I have to edit the TUNITn manually<br>
after saving the file?<br>
<br>
By the way, I was also looking for a way to influence the display of the<br>
columns, i.e. the TDISPn keywords. If I set a format using<br>
   t['colname'].format = '%4.2f'<br>
this is used when printing the table, but does not end up in the<br>
corresponding TDISPn after writing to FITS. Am I missing something?<br>
<br>
Finally, I'd like to give potential users of my file a longer<br>
description, and hoped there was a way to write something to the FITS<br>
comment part (after the slash of the TTYPEn keywords). Setting<br>
   t['colname'].description = 'a descriptive message'<br>
works, but influences neither printing of the table nor writing to FITS.<br>
<br>
Any hints?<br>
   Peter.<br>
--<br>
Dr. Peter M. Weilbacher             <a href="http://www.aip.de/People/PWeilbacher" rel="noreferrer" target="_blank">http://www.aip.de/People/PWei<wbr>lbacher</a><br>
Phone <a href="tel:%2B49%20331%2074%2099-667" value="+493317499667" target="_blank">+49 331 74 99-667</a>                       encryption key ID 7D6B4AA0<br>
------------------------------<wbr>------------------------------<wbr>------------<br>
Leibniz-Institut für Astrophysik Potsdam (AIP)<br>
An der Sternwarte 16, D-14482 Potsdam<br>
<br>
Vorstand: Prof. Dr. Matthias Steinmetz, Matthias Winker<br>
Stiftung bürgerlichen Rechts, Stiftungsverz. Brandenburg: 26 742-00/7026<br>
______________________________<wbr>_________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@python.org" target="_blank">AstroPy@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/astropy" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/astropy</a><br>
</blockquote></div><br></div></div>