IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13136


Ignore:
Timestamp:
May 2, 2007, 2:12:03 PM (19 years ago)
Author:
magnier
Message:

added psphotSetDophotType; changed pmSourceDophotType to pmSourceGetDophotType; use original hdu for updates (not a copy)

File:
1 edited

Legend:

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

    r13034 r13136  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-04-26 01:20:29 $
     5 *  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-05-03 00:12:03 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141
    4242// translations between psphot object types and dophot object types
    43 int pmSourceDophotType (pmSource *source)
     43int pmSourceGetDophotType (pmSource *source)
    4444{
    4545    switch (source->type) {
     
    6565    }
    6666    return (0);
     67}
     68
     69// translations between psphot object types and dophot object types
     70bool pmSourceSetDophotType (pmSource *source, int type)
     71{
     72    if (type == 4) {
     73        source->mode |= PM_SOURCE_MODE_FAIL;
     74    }
     75    if (type == 7) {
     76        source->mode |= PM_SOURCE_MODE_POOR;
     77    }
     78    if (type == 10) {
     79        source->mode |= PM_SOURCE_MODE_SATSTAR;
     80    }
     81
     82    switch (type) {
     83      case 1:
     84      case 4:
     85      case 7:
     86      case 10:
     87        source->type = PM_SOURCE_TYPE_STAR;
     88        return true;
     89      case 2:
     90        source->type = PM_SOURCE_TYPE_EXTENDED;
     91        return true;
     92      case 8:
     93        source->type = PM_SOURCE_TYPE_DEFECT;
     94        return true;
     95      default:
     96        return false;
     97    }
     98    return false;
    6799}
    68100
     
    323355        // this header block is new, write it to disk
    324356        if (hdu->header != file->header) {
    325             outhead = psMetadataCopy (NULL, hdu->header);
     357            // XXX I was building a new copy, why?  supplement the output header
     358            // outhead = psMetadataCopy (NULL, hdu->header);
    326359
    327360            // add EXTNAME, EXTHEAD, EXTTYPE to header
    328361            // psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTNAME", PS_META_REPLACE, "extension name", headname);
    329             psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTDATA", PS_META_REPLACE, "name of table extension", dataname);
    330             psMetadataAddStr (outhead, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", "IMAGE");
     362            psMetadataAddStr (hdu->header, PS_LIST_TAIL, "EXTDATA", PS_META_REPLACE, "name of table extension", dataname);
     363            psMetadataAddStr (hdu->header, PS_LIST_TAIL, "EXTTYPE", PS_META_REPLACE, "extension type", "IMAGE");
    331364            if (!file->phu) {
    332365                // this hdu->header acts as the PHU: set EXTEND to be true
    333                 psMetadataAddBool (outhead, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true);
     366                psMetadataAddBool (hdu->header, PS_LIST_TAIL, "EXTEND", PS_META_REPLACE, "this file has extensions", true);
    334367            }
    335368
     
    337370            updates = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.HEADER");
    338371            if (updates) {
    339                 psMetadataCopy (outhead, updates);
     372                psMetadataCopy (hdu->header, updates);
    340373            }
    341374            updates = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.HEADER");
    342375            if (updates) {
    343                 psMetadataCopy (outhead, updates);
     376                psMetadataCopy (hdu->header, updates);
    344377            }
    345378
    346             psFitsWriteBlank (file->fits, outhead, headname);
     379            psFitsWriteBlank (file->fits, hdu->header, headname);
    347380            psTrace ("pmFPAfile", 5, "wrote ext head %s (type: %d)\n", file->filename, file->type);
    348381            file->header = hdu->header;
    349             psFree (outhead);
    350382        }
    351383
Note: See TracChangeset for help on using the changeset viewer.