IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 26, 2013, 1:34:58 PM (13 years ago)
Author:
bills
Message:

add functions to save and read the model type values in XFIT headers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/bills_branches/bills_201312/psModules/src/objects/pmSourceIO_CFF.c

    r36389 r36412  
    6565    int modelType = pmModelClassGetType ("PS_MODEL_GAUSS");
    6666
     67    // Read lookup table for model classes (if defined)
     68    pmModelClassReadHeader(header);
     69
    6770    char *PSF_NAME = psMetadataLookupStr (&status, header, "PSFMODEL");
    6871    if (PSF_NAME != NULL) {
     
    111114        float theta      = psMetadataLookupF32 (&status, row, "THETA");
    112115
    113         // XXX: we need to put a lookup table in the cff header to define the correspondence of the
    114         // model type values in the cff with our models. (We want to use an interger for efficiency
    115         // but the value for each model type is set on the organization of the the array in pmModelClass.c
    116         // For now use the input values verbatim and trust the user that this is valid value
    117116        int   galaxyModelType = psMetadataLookupS32(&status, row, "MODEL_TYPE");
     117        if (status) {
     118            galaxyModelType = pmModelClassGetLocalType(galaxyModelType);
     119        } else {
     120            galaxyModelType = -1;
     121        }
    118122        float Sindex     = psMetadataLookupF32 (&status, row, "INDEX"); // Should this be PAR_07 not sersic index
    119123
     
    181185        }
    182186
    183         // XXX: should use < 0 as invalid galaxyModelType
    184 
    185         if (fitGalaxy && galaxyModelType > 0) {
     187        if (fitGalaxy && galaxyModelType >= 0) {
    186188            source->modelFits = psArrayAllocEmpty (1);
    187189            pmModel *model = pmModelAlloc(galaxyModelType);
     
    235237    psF32 exptime = psMetadataLookupF32(&mdok, readout->parent->concepts, "CELL.EXPOSURE");
    236238    PS_ASSERT(mdok, false);
     239
     240    // write the definition of the model class type values to the header
     241    pmModelClassWriteHeader(header);
    237242
    238243    psArray *table = psArrayAllocEmpty(sources->n);
Note: See TracChangeset for help on using the changeset viewer.