IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 18, 2007, 3:32:49 PM (19 years ago)
Author:
Paul Price
Message:

Removing interpolation of FPA.FILTER.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageParseCamera.c

    r11101 r11145  
    1616        return NULL;
    1717    }
    18 
    19     // determine filter from the concepts
    20     char *filter = pmConceptsFilterIDfromConcept ("FPA.FILTER", input->fpa->concepts, config->camera);
    2118
    2219#if 0
     
    8784
    8885    if (options->doFlat) {
    89         // if we fail to find the item in Args, we try again in Conf, then DetDB
    90         // we need to handle the errors and catch serious errors, as opposed to
    91         // data-not-found errors
    92         bool status = false;
    93         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FLAT", "FLAT");
    94         psErrorClear();
    95         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FLAT");
    96         psErrorClear();
    97         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT);
    98         if (!status) {
    99             psError (PS_ERR_IO, false, "can't find a flat image source");
    100             return NULL;
    101         }
    102     }
    103 
    104     // fringe frame are only applied for a subset of the filters. 
     86        // if we fail to find the item in Args, we try again in Conf, then DetDB
     87        // we need to handle the errors and catch serious errors, as opposed to
     88        // data-not-found errors
     89        bool status = false;
     90        pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FLAT", "FLAT");
     91        psErrorClear();
     92        pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FLAT");
     93        psErrorClear();
     94        pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT);
     95        if (!status) {
     96            psError (PS_ERR_IO, false, "can't find a flat image source");
     97            return NULL;
     98        }
     99    }
     100
     101    // fringe frame are only applied for a subset of the filters.
    105102    // if the filter is one of those identified by a FRINGE.FILTERS metadata entry
    106103    // in ppImage.config, apply the fringe frame
    107104    if (options->doFringe) {
    108         // select FRINGE.FILTERS from the recipe and test if the filter matches
    109         // is the mdi saved with psList or string?
    110         psMetadataItem *mdi = psMetadataLookup (recipe, "FRINGE.FILTERS");
    111         if (mdi == NULL) {
    112             // no valid filters for fringe data for this camera
    113             options->doFringe = false;
    114             goto skip_fringe;
    115         }
    116         // place entry on a list regardless of type
    117         psList *filters = NULL;
    118         if (mdi->type == PS_DATA_STRING) {
    119             filters = psListAlloc(NULL);
    120             psListAdd (filters, PS_LIST_HEAD, mdi);
    121         } else {
    122             if (mdi->type != PS_DATA_METADATA_MULTI) psAbort ("ppImage", "invalid type for FRINGE.FILTERS");
    123             filters = psMemIncrRefCounter(mdi->data.list);
    124         }
    125 
    126         // search through list to find the current filter
    127         psListIterator *iter = psListIteratorAlloc (filters, PS_LIST_HEAD, FALSE);
    128         options->doFringe = false;
    129         for (int i = 0; !options->doFringe && (i < filters->n); i++) {
    130             psMetadataItem *item = psListGetAndIncrement (iter);
    131             char *validFilter = item->data.V;
    132             if (strcmp (validFilter, filter)) continue;
    133             options->doFringe = true;
    134         }
     105        // determine filter from the concepts
     106        const char *filter = psMetadataLookupStr(&status, input->fpa->concepts, "FPA.FILTER");
     107        if (!status || !filter || strlen(filter) == 0) {
     108            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FPA.FILTER.\n");
     109            return NULL;
     110        }
     111
     112        // select FRINGE.FILTERS from the recipe and test if the filter matches
     113        // is the mdi saved with psList or string?
     114        psMetadataItem *mdi = psMetadataLookup (recipe, "FRINGE.FILTERS");
     115        if (mdi == NULL) {
     116            // no valid filters for fringe data for this camera
     117            options->doFringe = false;
     118            goto skip_fringe;
     119        }
     120        // place entry on a list regardless of type
     121        psList *filters = NULL;
     122        if (mdi->type == PS_DATA_STRING) {
     123            filters = psListAlloc(NULL);
     124            psListAdd (filters, PS_LIST_HEAD, mdi);
     125        } else {
     126            if (mdi->type != PS_DATA_METADATA_MULTI) psAbort ("ppImage", "invalid type for FRINGE.FILTERS");
     127            filters = psMemIncrRefCounter(mdi->data.list);
     128        }
     129
     130        // search through list to find the current filter
     131        psListIterator *iter = psListIteratorAlloc (filters, PS_LIST_HEAD, FALSE);
     132        options->doFringe = false;
     133        for (int i = 0; !options->doFringe && (i < filters->n); i++) {
     134            psMetadataItem *item = psListGetAndIncrement (iter);
     135            char *validFilter = item->data.V;
     136            if (strcmp (validFilter, filter)) continue;
     137            options->doFringe = true;
     138        }
    135139    }
    136140skip_fringe:
    137141    if (options->doFringe) {
    138         bool status = false;
    139         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FRINGE", "FRINGE");
    140         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FRINGE");
    141         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE);
    142         if (!status) {
    143             psError (PS_ERR_IO, false, "can't find a fringe image source");
    144             return NULL;
    145         }
     142        bool status = false;
     143        pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FRINGE", "FRINGE");
     144        pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FRINGE");
     145        pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE);
     146        if (!status) {
     147            psError (PS_ERR_IO, false, "can't find a fringe image source");
     148            return NULL;
     149        }
    146150    }
    147151
Note: See TracChangeset for help on using the changeset viewer.