IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 9, 2007, 3:09:20 PM (19 years ago)
Author:
eugene
Message:

updating all changes from from eam_branch_20071023

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroDefineFiles.c

    r14212 r15562  
    44
    55    // these calls bind the I/O handle to the specified fpa
    6     pmFPAfile *output = NULL;
     6    bool status;
    77
    8     output = pmFPAfileDefineOutput (config, input->fpa, "PSASTRO.OUTPUT");
     8    // select the current recipe
     9    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
     10    if (!recipe) {
     11        psError(PSASTRO_ERR_CONFIG, false, "Can't find PSASTRO recipe!\n");
     12        return false;
     13    }
     14
     15    pmFPAfile *output = pmFPAfileDefineOutput (config, input->fpa, "PSASTRO.OUTPUT");
    916    if (!output) {
    1017        psError(PSASTRO_ERR_CONFIG, false, "Failed to build FPA from PSASTRO.INPUT");
     
    1219    }
    1320    output->save = true;
     21
     22    bool fixChips = psMetadataLookupBool (&status, recipe, "PSASTRO.FIX.CHIPS");
     23
     24    if (fixChips) {
     25        if (!psastroDefineFile (config, input->fpa, "PSASTRO.REF.ASTROM", "REF.ASTROM", PM_FPA_FILE_ASTROM, PM_DETREND_TYPE_ASTROM)) {
     26            psError (PS_ERR_IO, false, "Can't find a reference astrometry file");
     27            return NULL;
     28        }
     29    }
    1430
    1531# if (0)
     
    2541    return true;
    2642}
     43
     44bool psastroDefineFile (pmConfig *config, pmFPA *input, char *filerule, char *argname, pmFPAfileType fileType, pmDetrendType detrendType) {
     45
     46    bool status;
     47    pmFPAfile *file;
     48
     49    // look for the file on the argument list
     50    file = pmFPAfileDefineFromArgs  (&status, config, filerule, argname);
     51    if (!status) {
     52        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     53        return false;
     54    }
     55    if (file) {
     56        if (file->type != fileType) {
     57            psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
     58            return false;
     59        }
     60        return true;
     61    }
     62
     63    // look for the file in the camera config table
     64    file = pmFPAfileDefineFromConf  (&status, config, filerule);
     65    if (!status) {
     66        psError (PS_ERR_UNKNOWN, false, "failed to load find definition");
     67        return false;
     68    }
     69    if (file) {
     70        if (file->type != fileType) {
     71            psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
     72            return false;
     73        }
     74        return true;
     75    }
     76
     77    // look for the file to be loaded from the detrend database
     78    file = pmFPAfileDefineFromDetDB (&status, config, filerule, input, detrendType);
     79    if (!status) {
     80        psError (PS_ERR_UNKNOWN, false, "failed to load file definition");
     81        return false;
     82    }
     83    if (file) {
     84        if (file->type != fileType) {
     85            psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType (fileType));
     86            return false;
     87        }
     88        return true;
     89    }
     90    return false;
     91}
     92
Note: See TracChangeset for help on using the changeset viewer.