[AstroPy] issue with initialisation of a fits binary table
npkuin at gmail.com
Mon Sep 8 11:14:26 EDT 2014
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.
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.
On Mon, Sep 8, 2014 at 2:59 PM, Erik Bray <embray at stsci.edu> wrote:
> On 09/04/2014 09:24 PM, Paul Kuin wrote:
> > Hi,
> > I have a question about io.fits
> > I wonder if I just miss something obvious, or it can only be done as a
> > fix. Let me explain my problem.
> > When adding a card to the header, I can do that as
> > header["NEW_KEY"]=("SOME_VALUE","this is an example")
> > and in the header I get
> > NEW_KEY = "SOME_VALUE" \ this is an example
> > So with a keyword.
> > Now, when I define a new column like
> > col = [fits.Column(name="Vmag",format="E",unit="mag",ascii=False)]
> > I can create a binary table
> > tab = fits.BinTableHDU.from_columns(columns=col)
> > The header then is created with a TTYPE keyword with a value, but
> without a comment.
> > Comments are sometimes very useful, and so I checked.
> > I can define
> > col = [fits.Column(name=("Vmag","some
> > which goes some way to being able to have a TTYPE keyword with value and
> > but then trying to create the binary table HDU as before, it fails.
> > Am I missing something?
> > I can probably go back in and modify the header to add comments once I
> have the
> > bintable HDU defined, but it seems so inelegant I did not even try.
> Just set
> header.comments['TTYPE'] = 'Whatever'
> after the fact. Indeed, comments are nice to have, but they're mostly
> orthogonal to the actual structure of FITS files which we're trying to
> away as much as possible.
> If/when the FITS Schema infrastructure I've been working on is ready and
> integrated it will also be possible to define local schemas that provide
> standard comments to various header keywords, but that's a ways off.
> As an aside, it's not necessary here to specify `ascii=False` in the
> initialization. That's already the default, and is only needed to create
> columns for ASCII tables when there's some ambiguity in the format code.
> AstroPy mailing list
> AstroPy at scipy.org
* * * * * * * * http://www.mssl.ucl.ac.uk/~npmk/ * * * *
Dr. N.P.M. Kuin (n.kuin at ucl.ac.uk)
phone +44-(0)1483 (prefix) -204927 (work)
mobile +44(0)7806985366 skype ID: npkuin
Mullard Space Science Laboratory – University College London –
Holmbury St Mary – Dorking – Surrey RH5 6NT– U.K.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy