﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
494	psFits mapping to cfitsio	Paul Price	Paul Price	"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."	enhancement	closed	lowest		fits	unspecified	minor	fixed		robert.desonia@…
