IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13528


Ignore:
Timestamp:
May 25, 2007, 5:09:20 PM (19 years ago)
Author:
eugene
Message:

changed the pmFPAfileDefine functions to not require an input status value

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/Makefile.am

    r11291 r13528  
    2626        ppImageAstrom.c \
    2727        ppImageAddstar.c \
     28        ppImageDefineFile.c \
    2829        ppImageVersion.c
    2930
     
    4748        ppImageAstrom.c \
    4849        ppImageAddstar.c \
     50        ppImageDefineFile.c \
    4951        ppImageVersion.c
    5052
  • trunk/ppImage/src/ppFocusParseCamera.c

    r11702 r13528  
    2525    // not all input or output images are used in a given recipe
    2626    if (options->doBias) {
    27         bool status = false;
    28         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.BIAS", "BIAS");
    29         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.BIAS");
    30         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.BIAS", input->fpa, PM_DETREND_TYPE_BIAS);
    31         if (!status) psAbort("can't find a bias image source");
     27        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE)) {
     28            psError (PS_ERR_IO, false, "Can't find a bias image source");
     29            return NULL;
     30        }
    3231    }
    3332    if (options->doDark) {
    34         bool status = false;
    35         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.DARK", "DARK");
    36         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.DARK");
    37         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.DARK", input->fpa, PM_DETREND_TYPE_DARK);
    38         if (!status) psAbort("can't find a dark image source");
     33        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE)) {
     34            psError (PS_ERR_IO, false, "Can't find a dark image source");
     35            return NULL;
     36        }
    3937    }
    4038    if (options->doMask) {
    41         bool status = false;
    42         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.MASK", "MASK");
    43         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.MASK");
    44         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.MASK", input->fpa, PM_DETREND_TYPE_MASK);
    45         if (!status) psAbort("can't find a mask image source");
     39        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK)) {
     40            psError (PS_ERR_IO, false, "Can't find a mask image source");
     41            return NULL;
     42        }
    4643    }
    4744    if (options->doFlat) {
    48         bool status = false;
    49         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FLAT", "FLAT");
    50         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FLAT");
    51         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT);
    52         if (!status) psAbort("can't find a flat image source");
     45        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE)) {
     46            psError (PS_ERR_IO, false, "Can't find a shutter image source");
     47            return NULL;
     48        }
    5349    }
    5450
  • trunk/ppImage/src/ppImage.h

    r12819 r13528  
    6161void ppFocusDropCamera (pmConfig *config);
    6262
     63bool ppImageDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType type);
     64
    6365#endif
  • trunk/ppImage/src/ppImageParseCamera.c

    r12824 r13528  
    2222    // if MASK or WEIGHT was supplied on command line, bind files to 'input'
    2323    // the mask and weight will be mosaicked with the image
    24     pmFPAfile *inputMask = pmFPAfileBindFromArgs(NULL, input, config, "PPIMAGE.INPUT.MASK", "INPUT.MASK");
     24    pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.MASK", "INPUT.MASK");
     25    if (!status) {
     26        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     27        return NULL;
     28    }
    2529    if (inputMask && inputMask->type != PM_FPA_FILE_MASK) {
    2630        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.MASK is not of type MASK");
     
    2832    }
    2933
    30     pmFPAfile *inputWeight = pmFPAfileBindFromArgs(NULL, input, config, "PPIMAGE.INPUT.WEIGHT", "INPUT.WEIGHT");
     34    pmFPAfile *inputWeight = pmFPAfileBindFromArgs(&status, input, config, "PPIMAGE.INPUT.WEIGHT", "INPUT.WEIGHT");
     35    if (!status) {
     36        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     37        return NULL;
     38    }
    3139    if (inputWeight && inputWeight->type != PM_FPA_FILE_WEIGHT) {
    3240        psError(PS_ERR_IO, true, "PPIMAGE.INPUT.WEIGHT is not of type WEIGHT");
     
    4452    // not all input or output images are used in a given recipe
    4553    if (options->doBias) {
    46         bool status = false;
    47         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.BIAS", "BIAS");
    48         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.BIAS");
    49         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.BIAS", input->fpa, PM_DETREND_TYPE_BIAS);
    50         pmFPAfile *bias = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.BIAS");
    51         if (!status || !bias) {
    52             psError (PS_ERR_IO, false, "Can't find a bias image source");
    53             psFree(options);
    54             return NULL;
    55         }
    56         if (bias->type != PM_FPA_FILE_IMAGE) {
    57             psError(PS_ERR_IO, true, "PPIMAGE.BIAS is not of type IMAGE");
    58             psFree(options);
    59             return NULL;
    60         }
     54        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.BIAS", "BIAS", PM_FPA_FILE_IMAGE)) {
     55            psError (PS_ERR_IO, false, "Can't find a bias image source");
     56            psFree (options);
     57            return NULL;
     58        }
    6159    }
    6260    if (options->doDark) {
    63         bool status = false;
    64         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.DARK", "DARK");
    65         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.DARK");
    66         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.DARK", input->fpa, PM_DETREND_TYPE_DARK);
    67         pmFPAfile *dark = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.DARK");
    68         if (!status || !dark) {
    69             psError (PS_ERR_IO, false, "Can't find a dark image source");
    70             psFree(options);
    71             return NULL;
    72         }
    73         if (dark->type != PM_FPA_FILE_IMAGE) {
    74             psError(PS_ERR_IO, true, "PPIMAGE.DARK is not of type IMAGE");
    75             psFree(options);
    76             return NULL;
    77         }
     61        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.DARK", "DARK", PM_FPA_FILE_IMAGE)) {
     62            psError (PS_ERR_IO, false, "Can't find a dark image source");
     63            psFree (options);
     64            return NULL;
     65        }
    7866    }
    7967    if (options->doMask) {
    80         bool status = false;
    81         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.MASK", "MASK");
    82         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.MASK");
    83         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.MASK", input->fpa, PM_DETREND_TYPE_MASK);
    84         pmFPAfile *mask = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.MASK");
    85         if (!status || !mask) {
    86             psError (PS_ERR_IO, false, "Can't find a mask image source");
    87             psFree(options);
    88             return NULL;
    89         }
    90         if (mask->type != PM_FPA_FILE_MASK) {
    91             psError(PS_ERR_IO, true, "PPIMAGE.MASK is not of type MASK");
    92             psFree(options);
    93             return NULL;
    94         }
     68        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.MASK", "MASK", PM_FPA_FILE_MASK)) {
     69            psError (PS_ERR_IO, false, "Can't find a mask image source");
     70            psFree (options);
     71            return NULL;
     72        }
    9573    }
    9674    if (options->doShutter) {
    97         bool status = false;
    98         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.SHUTTER", "SHUTTER");
    99         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.SHUTTER");
    100         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.SHUTTER", input->fpa, PM_DETREND_TYPE_SHUTTER);
    101         pmFPAfile *shutter = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.SHUTTER");
    102         if (!status || !shutter) {
    103             psError (PS_ERR_IO, false, "Can't find a shutter image source");
    104             psFree(options);
    105             return NULL;
    106         }
    107         if (shutter->type != PM_FPA_FILE_IMAGE) {
    108             psError(PS_ERR_IO, true, "PPIMAGE.SHUTTER is not of type IMAGE");
    109             psFree(options);
    110             return NULL;
    111         }
     75        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.SHUTTER", "SHUTTER", PM_FPA_FILE_IMAGE)) {
     76            psError (PS_ERR_IO, false, "Can't find a flat image source");
     77            psFree (options);
     78            return NULL;
     79        }
    11280    }
    11381
    11482    if (options->doFlat) {
    115         // if we fail to find the item in Args, we try again in Conf, then DetDB
    116         // we need to handle the errors and catch serious errors, as opposed to
    117         // data-not-found errors
    118         bool status = false;
    119         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FLAT", "FLAT");
    120         psErrorClear();
    121         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FLAT");
    122         psErrorClear();
    123         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT);
    124         pmFPAfile *flat = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.FLAT");
    125         if (!status || !flat) {
    126             psError (PS_ERR_IO, false, "Can't find a flat image source");
    127             psFree(options);
    128             return NULL;
    129         }
    130         if (flat->type != PM_FPA_FILE_IMAGE) {
    131             psError(PS_ERR_IO, true, "PPIMAGE.FLAT is not of type IMAGE");
    132             psFree(options);
    133             return NULL;
    134         }
     83        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FLAT", "FLAT", PM_FPA_FILE_IMAGE)) {
     84            psError (PS_ERR_IO, false, "Can't find a shutter image source");
     85            psFree (options);
     86            return NULL;
     87        }
    13588    }
    13689
     
    183136skip_fringe:
    184137    if (options->doFringe) {
    185         bool status = false;
    186         pmFPAfileDefineFromArgs  (&status, config, "PPIMAGE.FRINGE", "FRINGE");
    187         pmFPAfileDefineFromConf  (&status, config, "PPIMAGE.FRINGE");
    188         pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE);
    189         pmFPAfile *fringe = psMetadataLookupPtr(NULL, config->files, "PPIMAGE.FRINGE");
    190         if (!status || !fringe) {
    191             psError (PS_ERR_IO, false, "Can't find a fringe image source");
    192             psFree(options);
    193             return NULL;
    194         }
    195         if (fringe->type != PM_FPA_FILE_FRINGE) {
    196             psError(PS_ERR_IO, true, "PPIMAGE.FRINGE is not of type FRINGE");
    197             psFree(options);
    198             return NULL;
    199         }
     138        if (!ppImageDefineFile (config, input->fpa, "PPIMAGE.FRINGE", "FRINGE", PM_FPA_FILE_FRINGE)) {
     139            psError (PS_ERR_IO, false, "Can't find a fringe image source");
     140            return NULL;
     141        }
    200142    }
    201143
  • trunk/ppStack/src/ppStackCamera.c

    r13515 r13528  
    8787        psFree(maskFiles);
    8888
    89         found = false;
    90         pmFPAfile *maskFile = pmFPAfileBindFromArgs(&found, imageFile, config, "PPSTACK.INPUT.MASK",
    91                                                     "MASK.FILENAMES");
    92         if (!maskFile || !found) {
     89        bool status;
     90        pmFPAfile *maskFile = pmFPAfileBindFromArgs(&status, imageFile, config, "PPSTACK.INPUT.MASK", "MASK.FILENAMES");
     91        if (!status) {
    9392            psError(PS_ERR_UNKNOWN, false, "Unable to define file from mask %d (%s)", i, mask);
    9493            return false;
  • trunk/ppSub/src/ppSubCamera.c

    r13462 r13528  
    2626
    2727    // Input mask
    28     pmFPAfile *inputMask = pmFPAfileBindFromArgs(NULL, input, config, "PPSUB.INPUT.MASK", "INPUT.MASK");
     28    pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.MASK", "INPUT.MASK");
     29    if (!status) {
     30        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     31        return NULL;
     32    }
    2933    if (inputMask && inputMask->type != PM_FPA_FILE_MASK) {
    3034        psError(PS_ERR_IO, true, "PPSUB.INPUT.MASK is not of type MASK");
     
    3337
    3438    // Input weight map
    35     pmFPAfile *inputWeight = pmFPAfileBindFromArgs(NULL, input, config, "PPSUB.INPUT.WEIGHT", "INPUT.WEIGHT");
     39    pmFPAfile *inputWeight = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.WEIGHT", "INPUT.WEIGHT");
     40    if (!status) {
     41        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     42        return NULL;
     43    }
    3644    if (inputWeight && inputWeight->type != PM_FPA_FILE_WEIGHT) {
    3745        psError(PS_ERR_IO, true, "PPSUB.INPUT.WEIGHT is not of type WEIGHT");
     
    5260
    5361    // Reference mask
    54     pmFPAfile *refMask = pmFPAfileBindFromArgs(NULL, input, config, "PPSUB.REF.MASK", "REF.MASK");
     62    pmFPAfile *refMask = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.REF.MASK", "REF.MASK");
     63    if (!status) {
     64        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     65        return NULL;
     66    }
    5567    if (refMask && refMask->type != PM_FPA_FILE_MASK) {
    5668        psError(PS_ERR_IO, true, "PPSUB.REF.MASK is not of type MASK");
     
    5971
    6072    // Reference weight map
    61     pmFPAfile *refWeight = pmFPAfileBindFromArgs(NULL, input, config, "PPSUB.REF.WEIGHT", "REF.WEIGHT");
     73    pmFPAfile *refWeight = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.REF.WEIGHT", "REF.WEIGHT");
     74    if (!status) {
     75        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     76        return NULL;
     77    }
    6278    if (refWeight && refWeight->type != PM_FPA_FILE_WEIGHT) {
    6379        psError(PS_ERR_IO, true, "PPSUB.REF.WEIGHT is not of type WEIGHT");
  • trunk/psphot/src/psphotDefineFiles.c

    r13416 r13528  
    7575
    7676    // optionally save output plots
     77    // allow specific plots only
    7778    if (psMetadataLookupBool(NULL, recipe, "SAVE.PLOTS")) {
    7879        if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.MOMENTS")) {
    79             psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.MOMENTS");
     80            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for SOURCE.PLOT.MOMENTS");
     81            return false;
    8082        }
    8183        if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.PSFMODEL")) {
    82             psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.PSFMODEL");
     84            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for SOURCE.PLOT.PSFMODEL");
     85            return false;
    8386        }
    8487        if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.APRESID")) {
    85             psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.APRESID");
     88            psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for SOURCE.PLOT.APRESID");
     89            return false;
    8690        }
    8791    }
    8892
    8993    if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) {
    90         status = false;
    91         pmFPAfileDefineFromArgs (&status, config, "PSPHOT.INPUT.CMF", "SRC");
    92         if (!status) {
     94        if (!pmFPAfileDefineFromArgs (&status, config, "PSPHOT.INPUT.CMF", "SRC")) {
    9395            psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.INPUT.CMF");
    9496            return status;
     
    9799
    98100    if (psMetadataLookupPtr(NULL, config->arguments, "PSPHOT.PSF")) {
    99         status = false;
    100101        pmFPAfileBindFromArgs(&status, input, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF");
    101 //        pmFPAfileDefineFromArgs (&status, config, "PSPHOT.PSF.LOAD", "PSPHOT.PSF");
    102102        if (!status) {
    103103            psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.PSF.LOAD");
     
    111111    return true;
    112112}
    113 
    114     // if we have requested PSPHOT.SRC, attempt to resolve it
    115     // this is a list of input sources, stored in a psphot output format file
    116     // XXX this was disabled after the switch to CHIP-mosaicked images.  It needs to be tested
    117     // before it is added back into the code.
    118 # if (0)
    119     // optionally load the PSF Model and/or fixed stars
    120     // XXX add this back in later
    121     // pmFPAfileBindFromArgs (NULL, input, config, "PSPHOT.PSF", "PSF");
    122 # endif
    123 
  • trunk/psphot/src/psphotParseCamera.c

    r12805 r13528  
    1717    // if MASK or WEIGHT was supplied on command line, bind files to 'load'
    1818    // the mask and weight will be mosaicked with the image
    19     pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.MASK",   "MASK");
    20     pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.WEIGHT", "WEIGHT");
     19    pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.MASK",   "MASK");
     20    if (!status) {
     21        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     22        return NULL;
     23    }
     24
     25    pmFPAfileBindFromArgs (&status, load, config, "PSPHOT.WEIGHT", "WEIGHT");
     26    if (!status) {
     27        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     28        return NULL;
     29    }
    2130
    2231    // the psphot analysis is performed on chips
  • trunk/pswarp/src/pswarpParseCamera.c

    r12771 r13528  
    1010    status = false;
    1111    pmFPAfile *input = pmFPAfileDefineFromArgs (&status, config, "PSWARP.INPUT", "INPUT");
    12     if (!input) {
     12    if (!input || !status) {
    1313        psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT");
    1414        return false;
     
    1717    // the input image(s) are required arguments; they define the camera
    1818    status = false;
    19     pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM");
    20     if (status) {
     19    pmFPAfile *astrom = pmFPAfileDefineFromArgs (&status, config, "PSWARP.ASTROM", "ASTROM");
     20    if (!status) {
     21        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     22        return NULL;
     23    }
     24    if (astrom) {
    2125        psLogMsg ("pswarp", 3, "using supplied astrometry\n");
    2226    } else {
     
    2529
    2630    // the mask is not required - but must conform to input camera
    27     pmFPAfile *inMask = pmFPAfileBindFromArgs(NULL, input, config, "PSWARP.MASK", "MASK");
     31    pmFPAfile *inMask = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.MASK", "MASK");
     32    if (!status) {
     33        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     34        return NULL;
     35    }
    2836    if (!inMask) {
    2937        psLogMsg ("pswarp", 3, "no mask supplied\n");
    3038    }
    3139
    32     pmFPAfile *inWeight = pmFPAfileBindFromArgs(NULL, input, config, "PSWARP.WEIGHT", "WEIGHT");
     40    pmFPAfile *inWeight = pmFPAfileBindFromArgs(&status, input, config, "PSWARP.WEIGHT", "WEIGHT");
     41    if (!status) {
     42        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     43        return NULL;
     44    }
    3345    if (!inWeight) {
    3446        psLogMsg ("pswarp", 3, "no weight supplied\n");
Note: See TracChangeset for help on using the changeset viewer.