IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 14, 2007, 2:59:50 PM (19 years ago)
Author:
magnier
Message:

added detrend constraints from the recipe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r10966 r11092  
    608608    PS_ASSERT_STRING_NON_EMPTY(filename, NULL);
    609609
     610    bool status;
    610611    pmFPA *fpa = NULL;
    611612    pmFPAfile *file = NULL;
     
    654655    pmDetrendSelectOptions *options = pmDetrendSelectOptionsAlloc(config->cameraName, *time, type);
    655656
     657    // add additional constraints based on the type defined in the PPIMAGE recipe
     658    // use PPIMAGE or DETREND or ???
     659    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, "PPIMAGE");
     660    if (!status)
     661        psAbort ("psModules", "PPIMAGE recipe not found");
     662    psMetadata *detConstraints = psMetadataLookupPtr (&status, recipe, "DETREND.CONSTRAINTS");
     663    if (!status)
     664        psAbort ("psModules", "DETREND.CONSTRAINTS not found");
     665    // XXX allow this and just skip?
     666
     667    char *typeName = pmDetrendTypeToString (type);
     668    psMetadata *constraints = psMetadataLookupPtr (&status, detConstraints, typeName);
     669    if (!status)
     670        psAbort ("psModules", "DETREND.CONSTRAINTS for type %s not found", typeName);
     671
     672    // loop over the constraints and include in the detselect options
     673    psMetadataIterator *iter = psMetadataIteratorAlloc (constraints, PS_LIST_HEAD, NULL);
     674    psMetadataItem *item = NULL;
     675    while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
     676        if (item->type != PS_DATA_STRING) {
     677            psAbort ("psModules", "invalid type for DETREND.CONSTRAINT element");
     678        }
     679        char *option  = item->name;     // item->name must correspond to a valid detselect option
     680        char *concept = item->data.V; // item->data.V is a concept to look up
     681        if (!strcasecmp (option, "filter")) {
     682            options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
     683            if (!status)
     684                psAbort ("psModules", "filter not found");
     685        }
     686        if (!strcasecmp (option, "exptime")) {
     687            options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
     688            if (!status)
     689                psAbort ("psModules", "exptime not found");
     690        }
     691        if (!strcasecmp (option, "airmass")) {
     692            options->airmass = psMetadataLookupF32 (NULL, input->concepts, concept);
     693            if (!status)
     694                psAbort ("psModules", "airmass not found");
     695        }
     696        # if (0)
     697            if (!strcasecmp (option, "dettemp")) {
     698                options->dettemp = psMetadataLookupF32 (NULL, input->concepts, concept);
     699                if (!status)
     700                    psAbort ("psModules", "dettemp not found");
     701            }
     702        // XXX need to include twilight time somehow (uses lookup based on a time value)
     703        # endif
     704
     705    }
     706
    656707    // search for existing detrend data (detID)
    657708    pmDetrendSelectResults *results = pmDetrendSelect (options);
Note: See TracChangeset for help on using the changeset viewer.