[AstroPy] writing 2D string column to fits binary table

Paul Kuin npkuin at gmail.com
Tue Jan 27 21:59:21 EST 2015


Hi Stephen, all,

You can ask Bill Pence, who's member of the IAU FITS working group.

fits @ fits.gsfc.nasa.gov

There might be a need somewhere to preserve the original ascii record,
(spaces and all) and to do that padding was to be done with a special
character. I think it would be smart to ask Bill Pence for clarification on
this issue.

- Paul

On Wed, Jan 28, 2015 at 12:37 AM, Benjamin Alan Weaver <
benjamin.weaver at nyu.edu> wrote:

> Hello y'all,
>
> Please disregard the previous email.  That applies to ASCII tables not
> Binary tables.
>
> Ugh, why do they list ASCII tables first?
>
> Kia ora koutou,
> Benjamin Alan Weaver
>
>
> On Tue, Jan 27, 2015 at 7:32 PM, Benjamin Alan Weaver
> <benjamin.weaver at nyu.edu> wrote:
> > Hello y'all,
> >
> >>
> https://archive.stsci.edu/fits/fits_standard/node70.html#SECTION001233130000000000000
> >
> > The date at the bottom says 1999.  The FITS 3.0 standard from
> > 2008-2010 appears to be more consistent with how cfitsio does it (see
> > http://fits.gsfc.nasa.gov/standard30/fits_standard30aa.pdf):
> >
> > Character fields. The value of a character-formatted (Aw) field is a
> > character string of width w containing the characters in columns
> > TBCOLn through TBCOLn+w − 1. The character string shall be composed of
> > the restricted set of ASCII text characters with decimal values in the
> > range 32 through 126 (hexadecimal 20 through 7E).
> >
> > Note the restriction to decimal values > 0.  This would appear to rule
> > out ASCII NULL characters.
> >
> > Kia ora koutou,
> > Benjamin Alan Weaver
> >
> > On Tue, Jan 27, 2015 at 7:29 PM, Stephen Bailey <stephenbailey at lbl.gov>
> wrote:
> >>
> >> On Tue, Jan 27, 2015 at 3:45 PM, Erin Sheldon <erin.sheldon at gmail.com>
> >> wrote:
> >>>
> >>> On 1/27/15, Stephen Bailey <stephenbailey at lbl.gov> wrote:
> >>> > On Tue, Jan 27, 2015 at 10:28 AM, Erin Sheldon <
> erin.sheldon at gmail.com>
> >>> > wrote:
> >>> >
> >>> >> Hi Stephen -
> >>> >>
> >>> >> This is a difficult problem I think.
> >>> >>
> >>> >> In FITS, the strings must get padded with spaces when written.
> That is
> >>> >> my
> >>> >> understanding of the format.
> >>> >>
> >>> >
> >>> > From
> >>> >
> >>> >
> https://archive.stsci.edu/fits/fits_standard/node70.html#SECTION001233130000000000000
> >>> > :
> >>> >
> >>> > 8.3.3 Data Sequence -> 8.3.3.1 Main Data Table  -> Character
> >>> >
> >>> > If the value of the TFORMn keyword specifies data type A, field n
> shall
> >>> > contain a character string of  zero or more members, composed of
> ASCII
> >>> > text. This character string may be terminated before the length
> >>> > specified
> >>> > by the repeat count  by  an ASCII NULL (hexadecimal code 00).
> Characters
> >>> > after the first ASCII NULL are not defined. A string with the number
> of
> >>> > characters specified by the repeat count is not NULL terminated. Null
> >>> > strings are defined by the presence of an ASCII NULL as the first
> >>> > character.
> >>> >
> >>> >
> >>> > This indicates that padding with NULLs is the correct thing to do
> when
> >>> > the
> >>> > string is shorter than the field.  This is also how the data are in
> the
> >>> > ndarray memory and it is distinguishable from the case of strings
> that
> >>> > end
> >>> > with trailing spaces when reading it back in.
> >>>
> >>> Hi Stephen -
> >>>
> >>> Interesting, compare this to the cfitsio manual
> >>>
> >>> http://heasarc.nasa.gov/docs/software/fitsio/c/c_user/node24.html
> >>>
> >>> So this may be cfitsio specific, and perhaps something we should work
> >>> around
> >>> in fitsio.
> >>
> >>
> >> Gack.  My interpretation of that is that cfitsio is violating the FITS
> >> standard by doing something crazy with padding and stripping spaces.
> If you
> >> have some way of working around that in fitsio, that would be great.
> >>
> >> Stephen
> >>
> >>>
> >>>
> >>> -e
> >>>
> >>> --
> >>> Erin Scott Sheldon
> >>> Brookhaven National Laboratory erin dot sheldon at gmail dot com
> >>
> >>
> >>
> >> _______________________________________________
> >> AstroPy mailing list
> >> AstroPy at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/astropy
> >>
> >
> >
> >
> > --
> > a.k.a. The Dream Weaver
> >
> > Outside of a dog, a book is man's best friend. Inside of a dog it's
> > too dark to read.
> >   --Groucho Marx
>
>
>
> --
> a.k.a. The Dream Weaver
>
> Outside of a dog, a book is man's best friend. Inside of a dog it's
> too dark to read.
>   --Groucho Marx
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 

* * * * * * * * 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...
URL: <http://mail.python.org/pipermail/astropy/attachments/20150128/ef9dfb1b/attachment.html>


More information about the AstroPy mailing list