#412 closed defect (fixed)
psFitsWriteImage and psFitsWriteTable
| Reported by: | Paul Price | Owned by: | Paul Price |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | imageops | Version: | 0.5.0 |
| Severity: | minor | Keywords: | |
| Cc: | robert.desonia@… |
Description
The implementations of psFitsWriteImage and psFitsWriteTable contain an
additional "char *extname" not present in the specification. Since these
functions write to the current extension, this additional parameter should not
be necessary.
Change History (12)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
| Cc: | added |
|---|
How 'bout we define:
psMetadata *psFitsHeaderFromImage(psMetadata *header, psImage *image, const char
*extname);
psMetadata *psFitsHeaderFromTable(psMetadata *header, psMetadata *table, const
char *extname);
comment:3 by , 21 years ago
I'm not sure what you are proposing. The routines you mention don't take a
psFits, so I assume it is not doing any psFits operation. I don't see how that
helps in creating the creation of a new HDU.
-rdd
comment:4 by , 21 years ago
| Status: | new → assigned |
|---|
Sorry. The idea is that we generate a suitable header using those functions
(including the EXTNAME), and that can be passed to the psFitsWrite* functions.
comment:5 by , 21 years ago
But the question still remains: if the psFitsWrite* routines were to write to
the current HDU instead of creating a new HDU, how would a new HDU be created?
If you just want to get rid of the extname from the function, then, yes, one
could just add EXTNAME to the header metadata. I was assuming that one would
want to use EXTNAME for indexing (via psFitsMoveExtName), that I'd force the
user to name the extensions being created, but I could easily remove that
parameter. Do you want me to just do that? In that case, the function
prototype would match the SDRS, but it would still create a new HDU, which
doesn't seem to match the SDRS description.
-rdd
comment:6 by , 21 years ago
OK, I removed extname from the function prototypes to match the SDRS prototype.
comment:7 by , 21 years ago
| blocked: | → 236 |
|---|
comment:9 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Gene and I discussed this this afternoon, and settled on the following:
- psFitsWriteImage and psFitsWriteTable should write the image or table at the
current position in the FITS file (set by psFitsMove* functions), and update
EXTNAME in the header according to a extname parameter. If extname == NULL,
then the EXTNAME in the header is not updated.
- To write to the end of a FITS file, we need a psFitsMoveEnd function, which
moves the "current position" to the end of the file.
- psFitsHeaderFrom{Image,Table} are handy for setting the FITS headers. They
don't involve a psFits, but they enforce FITS concepts.
- We need an additional function to validate and/or correct a psMetadata to be
FITS-compliant (e.g., truncating names to 8 characters).
I'll update the SDRS.

This may be a problem.
psFitsWriteImage was implemented to create a new HDU and psFitsUpdateImage
writes to a current IMAGE HDU. If psFitsWriteImage would to write to the
current HDU, how does one create new HDUs? There is no psFitsCreateHDU.
I once looked into having a psFitsCreateHDU, but it was really complex to do
with CFITSIO, as there was no great way to create a blank HDU and then convert
it into either an IMAGE or table type upon a write (CFITSIO really wants to
write the required header information for an IMAGE or TABLE on creation of the HDU).
-rdd