#494 closed enhancement (fixed)
psFits mapping to cfitsio
| Reported by: | Paul Price | Owned by: | Paul Price |
|---|---|---|---|
| Priority: | lowest | Milestone: | |
| Component: | fits | Version: | unspecified |
| Severity: | minor | Keywords: | |
| Cc: | robert.desonia@… |
Description
As I recall, there were questions a while back about whether what was specified
in the SDRS for psFits was possible with cfitsio. I've been exploring the
mapping from psFits functions to cfitsio functions. As far as I can tell, all
the functions we've specified in the SDRS except psFitsOpenFD are possible using
the below cfitsio functions:
psFitsOpen: fits_open_diskfile / fits_create_diskfile
psFitsOpenFD: NOT POSSIBLE?
psFitsClose: fits_close
psFitsMoveExtName: fits_movnam_hdu
psFitsMoveExtNum: fits_movabs_hdu / fits_movrel_hdu
psFitsMoveEnd: psFitsGetSize + fits_movabs_hdu
psFitsGetExtNum: fits_get_hdu_num
psFitsGetSize: fits_get_num_hdus
psFitsDeleteExtNum: psFitsMoveExtNum + fits_delete_hdu
psFitsDeleteExtName: psFitsMoveExtName + fits_delete_hdu
psFitsTruncate: psFitsGetExtNum + Multiple fits_delete_hdu
psFitsGetExtType: fits_get_hdu_type
psFitsGetExtName: Need to read EXTNAME from header
psFitsSetExtName: Need to write EXTNAME in header
psFitsReadHeader: fits_read_keyword + parsing
psFitsReadHeaderSet: psFitsMoveExtNum + psFitsReadHeader
psFitsWriteHeader: fits_update_key, fits_write_comment, fits_write_history
psFitsHeaderFromImage: Need to generate header keywords by self
psFitsHeaderFromTable: Need to generate header keywords by self
psFitsHeaderValidate: Need to check header by self
psFitsReadImage: fits_get_img_type, fits_get_img_dim
psFitsUpdateImage: psFitsMoveExtName, fits_write_pix
psFitsWriteImage: fits_create_img, fits_write_pix
I didn't bother looking at the tables.
We can probably drop the "bool readonly" in psFits --- cfitsio has a
readonly option.
Some usage cases (writing only; reading is fairly simple):
- Create a file with an image in the PHU and nothing else:
psFitsHeaderFromImage, psFitsWriteImage(extname=NULL)
- Create a file with nothing much in the PHU, and multiple extensions
psFitsWriteImage(extname=fred,jim,bob,foo,bar)
- Create a file with a populated PHU and multiple extensions with populated
psFitsWriteHeader(output has no "EXTNAME"),
psFitsWriteImage(extname=fred,jim,bob,foo,bar).
- Write an image to an existing file
psFitsMoveExtName(extname=fred,jim,bob,foo,bar), psFitsUpdateImage or
psFitsWriteImage.
Change History (6)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
| Cc: | added |
|---|
comment:3 by , 21 years ago
I implemented the open/create by checking if the newer 'diskfile' routines of the open/create functions
exists in the specified CFITSIO library via the configure step. Once that is determined, I use either the
fits_open_file or fits_open_diskfile routine, depending on the routine availability.
-rdd
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
I think this was effectively closed at the meeting today, and in the various
other psFits bugs.

fits_open_diskfile and fits_create_diskfile are functions just recently added to CFITSIO (v 2.501 -
December 2004). Do you want to require basically the latest CFITSIO as to avoid the use of
fits_open_file and fits_create_file?
-rdd