<div dir="ltr">Hi Erik, <div><br></div><div>The problem I see with that is that I won't know in advance which keyword is TTYPE1, TTYPE2, etc. although it probably is in sequence. At the moment I just will let it be. Good to know you are working on improving that for the new version. </div><div><br></div><div>One other item that really bugged me later was trying to add a row to a binTable.There's no good way to do that. I wrote a work-around. I suppose that will also be fixed in the next release. </div><div><br></div><div>Cheers, </div><div><br></div><div>   Paul</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 2:59 PM, Erik Bray <span dir="ltr"><<a href="mailto:embray@stsci.edu" target="_blank">embray@stsci.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 09/04/2014 09:24 PM, Paul Kuin wrote:<br>
> Hi,<br>
><br>
> I have a question about io.fits<br>
><br>
> I wonder if I just miss something obvious, or it can only be done as a later<br>
> fix. Let me explain my problem.<br>
><br>
> When adding a card to the header, I can do that as<br>
><br>
> header["NEW_KEY"]=("SOME_VALUE","this is an example")<br>
> and in the header I get<br>
> NEW_KEY = "SOME_VALUE"   \ this is an example<br>
><br>
> So with a keyword.<br>
><br>
> Now, when I define a new column like<br>
><br>
> col = [fits.Column(name="Vmag",format="E",unit="mag",ascii=False)]<br>
> I can create a binary table<br>
> tab = fits.BinTableHDU.from_columns(columns=col)<br>
><br>
> The header then is created with a TTYPE keyword with a value, but without a comment.<br>
> Comments are sometimes very useful, and so I checked.<br>
><br>
> I can define<br>
> col = [fits.Column(name=("Vmag","some comment"),format="E",unit="mag",ascii=False)]<br>
> which goes some way to being able to have a TTYPE keyword with value and comment,<br>
> but then trying to create the binary table HDU as before, it fails.<br>
><br>
> Am I missing something?<br>
><br>
> I can probably go back in and modify the header to add comments once I have the<br>
> bintable HDU defined, but it seems so inelegant I did not even try.<br>
<br>
</span>Just set<br>
<br>
header.comments['TTYPE'] = 'Whatever'<br>
<br>
after the fact.  Indeed, comments are nice to have, but they're mostly<br>
orthogonal to the actual structure of FITS files which we're trying to abstract<br>
away as much as possible.<br>
<br>
If/when the FITS Schema infrastructure I've been working on is ready and<br>
integrated it will also be possible to define local schemas that provide<br>
standard comments to various header keywords, but that's a ways off.<br>
<br>
As an aside, it's not necessary here to specify `ascii=False` in the Column()<br>
initialization.  That's already the default, and is only needed to create<br>
columns for ASCII tables when there's some ambiguity in the format code.<br>
<br>
Erik<br>
<br>
_______________________________________________<br>
AstroPy mailing list<br>
<a href="mailto:AstroPy@scipy.org">AstroPy@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/astropy" target="_blank">http://mail.scipy.org/mailman/listinfo/astropy</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><br>* * * * * * * * <a href="http://www.mssl.ucl.ac.uk/~npmk/" target="_blank">http://www.mssl.ucl.ac.uk/~npmk/</a> * * * *<br>Dr. N.P.M. Kuin      (<a href="mailto:n.kuin@ucl.ac.uk" target="_blank">n.kuin@ucl.ac.uk</a>)      <br>phone +44-(0)1483 (prefix) -204927 (work) <br>mobile +44(0)7806985366  skype ID: npkuin<br>Mullard Space Science Laboratory  – University College London  –<br>Holmbury St Mary – Dorking – Surrey RH5 6NT–  U.K.</div>
</div>