IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11226


Ignore:
Timestamp:
Jan 21, 2007, 3:11:21 PM (19 years ago)
Author:
magnier
Message:

dropped the unneeded concept functions in FromDetDB; made the found element optional (may be NULL); using pmFPAIdentifySourceFromHeader in BindFromArgs

File:
1 edited

Legend:

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

    r11182 r11226  
    406406
    407407    file->format = format;
    408     *found = true;
     408    if (found)
     409        *found = true;
    409410    return file;
    410411}
     
    427428    pmFPAfile *file = NULL;
    428429    psMetadata *phu = NULL;
    429     psMetadata *format = NULL;
    430430
    431431    if (found && *found)
     
    452452    }
    453453    // XXX temporary hack : force PSF input onto filename
     454    // XXX EAM : I need to define a PSF container which specifies the chip/cell element
     455    // XXX we could use the flat metadata style IF we restrict it to SIMPLE cameras
     456    // XXX (ie, one readout per cell, one cell per chip, one chip per fpa)
    454457    if (file->type == PM_FPA_FILE_PSF) {
    455458        file->filerule = psStringCopy (infiles->data[0]);
     
    461464    file->format = psMemIncrRefCounter(input->format);
    462465
    463     // defin the rule to identify these files in the file->names data
     466    // define the rule to identify these files in the file->names data
    464467    psFree (file->filerule);
    465468    psFree (file->filextra);
     
    489492            return NULL;
    490493        }
    491         if (!pmConfigValidateCameraFormat (format, phu)) {
    492             psError(PS_ERR_IO, false, "specified MASK %s does not match format of supplied INPUT\n", realName);
     494        if (!pmConfigValidateCameraFormat (input->format, phu)) {
     495            psError(PS_ERR_IO, false, "specified data file %s does not match format of supplied INPUT\n", realName);
    493496            psFree (realName);
    494497            psFitsClose (fits);
     
    499502
    500503        // set the view to the corresponding entry for this phu
    501         // XXX this will override the fpa->header, which I don't want to do.
    502         // XXX do I need to carry around the mask and weight headers???
    503         psAbort ("psModules", "pmFPAfileBindMaskFromArgs is not completed");
    504         pmFPAview *view = pmFPAAddSourceFromHeader (input->fpa, phu, format);
     504        pmFPAview *view = pmFPAIdentifySourceFromHeader (input->fpa, phu, input->format);
    505505        if (!view) {
    506506            psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name);
    507507            psFree(phu);
    508             psFree (format);
    509508            return NULL;
    510509        }
     
    520519        psFree (phu);
    521520    }
    522     *found = true;
     521    if (found)
     522        *found = true;
    523523    return file;
    524524}
     
    604604    if (!filemenu) {
    605605        psError (PS_ERR_IO, true, "missing FILE in FORMAT");
     606        psFree(phu);
     607        psFree(fpa);
     608        psFree(format);
    606609        return NULL;
    607610    }
     
    609612    if (!levelName) {
    610613        psError (PS_ERR_IO, true, "missing PHU in FILE in FORMAT");
     614        psFree(phu);
     615        psFree(fpa);
     616        psFree(format);
    611617        return NULL;
    612618    }
     
    614620    if (file->fileLevel == PM_FPA_LEVEL_NONE) {
    615621        psError (PS_ERR_IO, true, "unknown level");
     622        psFree(phu);
     623        psFree(fpa);
     624        psFree(format);
    616625        return NULL;
    617626    }
     
    622631        psError(PS_ERR_IO, false, "Unable to determine source for %s", file->name);
    623632        psFree(phu);
    624         psFree (fpa);
    625         psFree (format);
     633        psFree(fpa);
     634        psFree(format);
    626635        return NULL;
    627636    }
     
    638647    psFree (fpa);
    639648
    640     file->format = format;
    641     *found = true;
     649    if (found)
     650        *found = true;
    642651    return file;
    643652}
     
    669678    // the returned file is just a view to the entry on config->files
    670679    pmFPAfile *file = pmFPAfileDefineInput (config, fpa, filename);
     680    psFree (fpa);
    671681    if (!file) {
    672682        psError(PS_ERR_IO, false, "file %s not defined\n", filename);
    673         psFree(fpa);
    674         psFree(file);
    675         return NULL;
    676     }
    677 
     683        return NULL;
     684    }
    678685
    679686    // image names may not come from file->names
     
    681688        psError(PS_ERR_IO, true, "supplied filerule uses illegal value @FILES");
    682689        // XXX remove the file from config->files
    683         psFree(fpa);
    684690        psFree(file);
    685691        return NULL;
     
    691697        // don't free the file here: it is left on config->files
    692698        // to be used optionally by pmFPAfileDefineFromDetDB (or others)
    693         psFree(fpa);
    694699        return NULL;
    695700    }
     
    700705    file->filerule = tmpName;
    701706
    702     if (found) {
     707    if (found)
    703708        *found = true;
    704     }
    705     psFree (fpa);                       // Drop reference
    706 
    707709    return file;
    708710}
     
    794796        }
    795797        char *option  = item->name;     // item->name must correspond to a valid detselect option
    796 
    797         psArray *conceptData = psStringSplitArray ((char *) item->data.V, ":", true);
    798         if (conceptData == NULL)
    799             psAbort ("psModules", "programming error");
    800         if (conceptData->n == 0)
    801             psAbort ("psModules", "missing data for %s", item->name);
    802         if (conceptData->n  > 2)
    803             psAbort ("psModules", "invalid format for %s", item->name);
    804 
    805         char *concept = NULL;
    806         char *function = NULL;
    807         if (conceptData->n == 1) {
    808             concept = conceptData->data[0];
    809         }
    810         if (conceptData->n == 2) {
    811             function = conceptData->data[0];
    812             concept = conceptData->data[1];
    813         }
    814 
    815         // XXX: 'function' unncesssary now that it's not required for filter?
     798        char *concept = item->data.V;
     799
    816800        if (!strcasecmp (option, "filter")) {
    817             if (function)
    818                 psAbort ("psModules", "no detrend constraint function for filter");
    819801            options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
    820802            if (!status)
     
    823805        }
    824806        if (!strcasecmp (option, "exptime")) {
    825             if (function)
    826                 psAbort ("psModules", "no detrend constraint function for exptime");
    827807            options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
    828808            if (!status)
     
    830810        }
    831811        if (!strcasecmp (option, "airmass")) {
    832             if (function)
    833                 psAbort ("psModules", "no detrend constraint function for airmass");
    834             options->airmass = psMetadataLookupF32 (NULL, input->concepts, concept);
     812            options->airmass = psMetadataLookupF32 (&status, input->concepts, concept);
    835813            if (!status)
    836814                psAbort ("psModules", "airmass not found");
     
    838816        # if (0)
    839817            if (!strcasecmp (option, "dettemp")) {
    840                 options->dettemp = psMetadataLookupF32 (NULL, input->concepts, concept);
     818                options->dettemp = psMetadataLookupF32 (&status, input->concepts, concept);
    841819                if (!status)
    842820                    psAbort ("psModules", "dettemp not found");
     
    844822        if (!strcasecmp (option, "version")) {
    845823            // version is applied as a literal string
    846             if (function)
    847                 psAbort ("psModules", "no detrend constraint function for airmass");
    848             options->version = psStringCopy(concept);
     824            options->version = psMetadataLookupF32 (&status, input->concepts, concept);
     825            if (!status)
     826                psAbort ("psModules", "version not found");
    849827        }
    850828        if (!strcasecmp (option, "twilight")) {
    851829            // XXX determine the twilight time based on concept defining the time-of-day
    852             options->twilight = psMetadataLookupF32 (NULL, input->concepts, concept);
     830            // XXX need to include twilight time somehow (uses lookup based on a time value)
     831            options->twilight = psMetadataLookupF32 (&status, input->concepts, concept);
    853832            if (!status)
    854                 psAbort ("psModules", "dettemp not found");
    855         }
    856         // XXX need to include twilight time somehow (uses lookup based on a time value)
     833                psAbort ("psModules", "twilight not found");
     834        }
    857835        # endif
    858836
     
    877855    psFree (options);
    878856
    879     *found = true;
     857    if (found)
     858        *found = true;
    880859    return file;
    881860}
Note: See TracChangeset for help on using the changeset viewer.