IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 14, 2014, 2:28:47 PM (12 years ago)
Author:
bills
Message:

Iniital implementation of the full force stages to the pipeline.
Maginitude and galactic coordinate limits on extended source fits

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/psModules

  • trunk/psModules/src/objects/pmSourceIO_CFF.c

    r36375 r36441  
    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
     
    123127        source->type = PM_SOURCE_TYPE_STAR; // XXX this should be added to the flags
    124128
    125         // XXX we can set this in general, but for a specific image, we need to weed out SATSTARS
     129        // XXX we can set this in general, but for a specific image, we need to weed out SATSTARS and
     130        // stars that are masked
    126131        if (psfStar) {
    127132            source->tmpFlags |= PM_SOURCE_TMPF_CANDIDATE_PSFSTAR;
     
    180185        }
    181186
    182         // XXX: should use < 0 as invalid galaxyModelType
    183 
    184         if (fitGalaxy && galaxyModelType > 0) {
     187        if (fitGalaxy && galaxyModelType >= 0) {
    185188            source->modelFits = psArrayAllocEmpty (1);
    186189            pmModel *model = pmModelAlloc(galaxyModelType);
     
    235238    PS_ASSERT(mdok, false);
    236239
     240    // write the definition of the model class type values to the header
     241    psMetadata *outputHeader = psMetadataAlloc();
     242    pmModelClassWriteHeader(outputHeader);
     243
    237244    psArray *table = psArrayAllocEmpty(sources->n);
    238245
     
    246253        psS32 modelType = 0;
    247254        bool fitGalaxy = false;
    248         bool psfStar = false;
     255        bool psfStar = (source->mode & PM_SOURCE_MODE_PSFSTAR) ? true : false;
    249256        psF32 sersicIndex = 0;
    250         if (source->modelFits == NULL) {
     257        // For now only perform galaxy fits on extended objects
     258        if (source->modelEXT == NULL) {
    251259            pmModel *model = source->modelPSF;
    252260            if (model == NULL) continue;
     
    260268            yPos = model->params->data.F32[PM_PAR_YPOS];
    261269            flux = source->psfFlux;
    262             psfStar = (source->mode & PM_SOURCE_MODE_PSFSTAR) ? true : false;
    263270            rMajor = 0;
    264271            rMinor = 0;
     
    329336
    330337        psArrayAdd(table, 100, row);
     338        psFree(row);
    331339    }
    332340
    333     if (!psFitsWriteTable(fits, NULL, table, extname)) {
     341    if (!psFitsWriteTable(fits, outputHeader, table, extname)) {
    334342        psError(psErrorCodeLast(), false, "writing ext data %s\n", extname);
    335343        psFree(table);
    336         psFree(header);
     344        psFree(outputHeader);
    337345        return false;
    338346    }
    339347    psFree(table);
    340     // psFree(header);
     348    psFree(outputHeader);
    341349
    342350    return true;
Note: See TracChangeset for help on using the changeset viewer.