IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7725


Ignore:
Timestamp:
Jun 28, 2006, 9:21:00 AM (20 years ago)
Author:
magnier
Message:

fixes for CMF format

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO.c

    r7382 r7725  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-06-07 03:27:52 $
     5 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-06-28 19:21:00 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    218218
    219219    case PM_FPA_FILE_CMF:
    220         // write a PHU?
    221         // write a header?
    222         // write the data
     220        // write a PHU? (only if input image is MEF)
     221        // write a header? (only if this is the first readout for cell)
     222        //   note that the file->header is set to track the last hdu->header written
     223        // write the data? (always?)
    223224
    224225        // get the current header
    225226        hdu = pmFPAviewThisHDU (view, file->fpa);
    226227
    227         // if file does not yet have a PHU, write it to disk
     228        // if file does not yet have a PHU, attempt to write one to disk
    228229        if (file->phu == NULL) {
    229230            // get the corresponding phu
    230231            phu = pmFPAviewThisPHU (view, file->fpa);
    231232
    232             // CMF always has extensions
    233             outhead = psMetadataCopy (NULL, phu->header);
    234             psMetadataAdd (outhead, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true);
    235             psFitsWriteBlank (file->fits, outhead);
    236             file->phu = phu->header;
    237             psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type);
    238             psFree (outhead);
    239         }
    240 
    241         // this this header block is new, write it to disk,
     233            // if there is no PHU, this is a single header+image (extension-less) file
     234            // if there is a PHU, write it out as a 'blank'
     235            if (phu) {
     236                outhead = psMetadataCopy (NULL, phu->header);
     237                psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true);
     238                psFitsWriteBlank (file->fits, outhead);
     239                file->phu = phu->header;
     240                psTrace ("pmFPAfile", 5, "wrote phu %s (type: %d)\n", file->filename, file->type);
     241                psFree (outhead);
     242            }
     243        }
     244
     245        // this header block is new, write it to disk
    242246        if (hdu->header != file->header) {
    243247            // determine name for header extension
     
    245249            outhead = psMetadataCopy (NULL, hdu->header);
    246250            psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname);
     251            if (file->phu == NULL) {
     252                // this hdu->header acts as the PHU: set EXTEND to be true
     253                psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true);
     254            }
     255
     256            // XXX : see note below about DVO/addstar expectations
     257            updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER");
     258            psMetadataCopy (outhead, updates);
     259
    247260            psFitsWriteBlank (file->fits, outhead);
    248261            psTrace ("pmFPAfile", 5, "wrote ext head %s (type: %d)\n", file->filename, file->type);
     
    254267        // write this table to disk
    255268        dataname = pmFPAfileNameFromRule (file->extrule, file, view);
     269
     270        // XXX : currently, this is being added to the TABLE header
     271        //       this may be the correct location for a MEF file, but it is
     272        //       inconsistent with DVO/addstar expectations.  DVO/addstar
     273        //       currently only expects a single header/table pair, and the
     274        //       metadata are in the blank (image) header, not the table header
     275        //       it may be necessary to put the results from the first readout
     276        //       in the blank image header to cover this case.
    256277        updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER");
    257278        pmSourcesWriteCMF (file->fits, sources, updates, dataname);
Note: See TracChangeset for help on using the changeset viewer.