IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27884


Ignore:
Timestamp:
May 8, 2010, 1:55:26 PM (16 years ago)
Author:
eugene
Message:

working on psphotStack psf matching

Location:
branches/eam_branches/psphot.20100506/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psphot.20100506/src/psphot.h

    r27883 r27884  
    453453psphotStackOptions *psphotStackOptionsAlloc (int num);
    454454psphotStackConvolveSource psphotStackConvolveSourceFromString (const char *string);
     455pmFPAfile *psphotStackGetConvolveSource (pmConfig *config, psphotStackOptions *options, int index);
    455456
    456457#endif
  • branches/eam_branches/psphot.20100506/src/psphotStackImageLoop.c

    r27876 r27884  
    3333        psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3434        if (! chip->process || ! chip->file_exists) { continue; }
    35         // if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphotStack.");
     35        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphotStack.");
    3636
    3737        // there is now only a single chip (multiple readouts?). loop over it and process
    3838        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    3939            psLogMsg ("psphot", 5, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    40             // if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Cell in psphotStack.");
     40            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Cell in psphotStack.");
    4141
    4242            // process each of the readouts
  • branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFs.c

    r27883 r27884  
    6464bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index) {
    6565
    66     // find the currently selected readout
    67     pmFPAfile *fileRaw = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.RAW", index); // File of interest
    68     psAssert (fileRaw, "missing file?");
     66    pmFPAfile *fileSrc = psphotStackGetConvolveSource(config, options, index);
     67    if (!fileSrc) {
     68        psError(PSPHOT_ERR_CONFIG, false, "desired convolution source is missing");
     69        return false;
     70    }
    6971
    70     pmFPAfile *fileCnv = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.CNV", index); // File of interest
    71     psAssert (fileCnv, "missing file?");
     72    pmFPAfile *fileOut = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.IMAGE", index); // File of interest
     73    psAssert (fileOut, "missing output file?");
    7274
    73     pmReadout *readoutRaw = pmFPAviewThisReadout(view, fileRaw->fpa);
    74     psAssert (readoutRaw, "missing readout?");
     75    pmReadout *readoutSrc = pmFPAviewThisReadout(view, fileSrc->fpa);
     76    psAssert (readoutSrc, "missing readout?");
    7577
    76     pmReadout *readoutCnv = pmFPAviewThisReadout(view, fileCnv->fpa);
    77     psAssert (readoutCnv, "missing readout?");
     78    pmReadout *readoutOut = pmFPAviewThisReadout(view, fileOut->fpa);
     79    if (readoutOut == NULL) {
     80        readoutOut = pmFPAGenerateReadout(config, view, "PSPHOT.STACK.OUTPUT.IMAGE", fileSrc->fpa, NULL, 0);
     81        psAssert (readoutOut, "missing readout?");
     82    }
    7883
    7984    // set NAN pixels to 'SAT'
    8085    psImageMaskType maskVal = pmConfigMaskGet("SAT", config);
    81     if (!pmReadoutMaskNonfinite(readoutRaw, maskVal)) {
     86    if (!pmReadoutMaskNonfinite(readoutSrc, maskVal)) {
    8287        psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels in readout.");
    8388        return false;
     
    8691    // Image Matching (PSFs or just flux)
    8792    if (options->convolve) {
    88         matchKernel(config, readoutCnv, readoutRaw, options, index);
    89         saveMatchData(readoutCnv, options, index);
     93        matchKernel(config, readoutOut, readoutSrc, options, index);
     94        saveMatchData(readoutOut, options, index);
    9095        // renormKernel(readoutCnv, options, index);
    9196    } else {
     
    97102    }
    98103
    99     rescaleData(readoutCnv, config, options, index);
     104    rescaleData(readoutOut, config, options, index);
    100105
    101     dumpImage(readoutCnv, readoutRaw, index, "convolved");
     106    dumpImage(readoutOut, readoutSrc, index, "convolved");
    102107
    103108    return true;
  • branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFsPrepare.c

    r27883 r27884  
    11# include "psphotInternal.h"
     2
     3pmPSF *selectPSF (pmFPAfile *fileSrc, const pmFPAview *view, psphotStackOptions *options, int index);
     4bool determineSeeing (pmPSF *psf, psphotStackOptions *options, int index);
    25
    36// set up the stacking parameters
     
    912    }
    1013
    11     // which image do we want to convolve?  RAW, CNV, AUTO?
    12     // find the currently selected readout
    13     pmFPAfile *fileRaw = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.RAW", index); // File of interest
    14     pmFPAfile *fileCnv = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.CNV", index); // File of interest
    15 
    16     pmFPAfile *fileSrc = NULL;
    17     pmPSF *psf = NULL;
    18 
    19     switch (options->convolveSource) {
    20       case PSPHOT_CNV_SRC_AUTO:
    21         fileSrc = fileCnv ? fileCnv : fileRaw;
    22         break;
    23 
    24       case PSPHOT_CNV_SRC_RAW:
    25         fileSrc = fileRaw;
    26         break;
    27 
    28       case PSPHOT_CNV_SRC_CNV:
    29         fileSrc = fileCnv;
    30         break;
    31 
    32       default:
    33         psAbort("impossible case");
    34     }
     14    pmFPAfile *fileSrc = psphotStackGetConvolveSource(config, options, index);
    3515    if (!fileSrc) {
    36         psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %llx, raw : %llx)", (long long) fileCnv, (long long) fileRaw);
     16        psError(PSPHOT_ERR_CONFIG, false, "desired convolution source is missing");
    3717        return false;
    3818    }
    3919
    40     // select the corresponding input psf
    41     {
    42         pmChip *chip = pmFPAviewThisChip(view, fileSrc->fpa); // The chip holds the PSF
    43         pmPSF *psf = psMetadataLookupPtr(NULL, chip->analysis, "PSPHOT.PSF"); // PSF
    44         if (!psf) {
    45             // XXX if we were not supplied a PSF, we should be able to generate one by calling psphot
    46             psError(PSPHOT_ERR_PROG, false, "Unable to find PSF.");
    47             return false;
    48         }
    49         options->psfs->data[index] = psMemIncrRefCounter(psf);
     20    pmPSF *psf = selectPSF (fileSrc, view, options, index);
     21    if (!psf) {
     22        psError(PSPHOT_ERR_PSF, false, "Problem with PSF.");
     23        return false;
     24    }
    5025
    51         // find the image size
    52         pmCell *cell = pmFPAviewThisCell(view, fileSrc->fpa); // Cell of interest
    53         pmHDU *hdu = pmHDUFromCell(cell);
    54         assert(hdu && hdu->header);
    55         int naxis1 = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); // Number of columns
    56         int naxis2 = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); // Number of rows
    57         psAssert ((naxis1 > 0) && (naxis2 > 0), "Unable to determine size of image from PSF.");
    58         if (!options->numCols) {
    59             options->numCols = naxis1;
    60         } else {
    61             if (options->numCols != naxis1) {
    62                 psError (PSPHOT_ERR_CONFIG, true, "mismatched sizes (NAXIS1) for input images");
    63                 return false;
    64             }
    65         }
    66         if (!options->numRows) {
    67             options->numRows = naxis2;
    68         } else {
    69             if (options->numRows != naxis2) {
    70                 psError (PSPHOT_ERR_CONFIG, true, "mismatched sizes (NAXIS2) for input images");
    71                 return false;
    72             }
    73         }
    74     }
     26    determineSeeing (psf, options, index);
    7527
    7628    // load the sources (used to find reference sources for the kernel stamps)
    7729    {
    78         pmFPAfile *outputImage = pmFPAfileDefineOutput(config, NULL, "PSPHOT.STACK.OUTPUT.IMAGE");
    79         pmReadout *readout = pmFPAviewThisReadout(view, outputImage->fpa); // Readout with sources
     30        pmFPAfile *inputSrc = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.SOURCES", index); // File of interest
     31        pmReadout *readout = pmFPAviewThisReadout(view, inputSrc->fpa); // Readout with sources
    8032        pmDetections *detections = psMetadataLookupPtr(NULL, readout->analysis, "PSPHOT.DETECTIONS"); // Sources
    8133        if (!detections || !detections->allSources) {
     
    8840    }
    8941
     42    return true;
     43}
     44
     45// select the corresponding input psf
     46pmPSF *selectPSF (pmFPAfile *fileSrc, const pmFPAview *view, psphotStackOptions *options, int index) {
     47
     48    bool status;
     49
     50    pmChip *chip = pmFPAviewThisChip(view, fileSrc->fpa); // The chip holds the PSF
     51    pmPSF *psf = psMetadataLookupPtr(&status, chip->analysis, "PSPHOT.PSF"); // PSF
     52    if (!psf) {
     53        // XXX if we were not supplied a PSF, we should be able to generate one by calling psphot
     54        psError(PSPHOT_ERR_PROG, true, "Unable to find PSF.");
     55        return NULL;
     56    }
     57    options->psfs->data[index] = psMemIncrRefCounter(psf);
     58
     59    // find the image size
     60    pmCell *cell = pmFPAviewThisCell(view, fileSrc->fpa); // Cell of interest
     61    pmHDU *hdu = pmHDUFromCell(cell);
     62    assert(hdu && hdu->header);
     63    int naxis1 = psMetadataLookupS32(NULL, hdu->header, "NAXIS1"); // Number of columns
     64    int naxis2 = psMetadataLookupS32(NULL, hdu->header, "NAXIS2"); // Number of rows
     65    psAssert ((naxis1 > 0) && (naxis2 > 0), "Unable to determine size of image from PSF.");
     66    if (!options->numCols) {
     67        options->numCols = naxis1;
     68    } else {
     69        if (options->numCols != naxis1) {
     70            psError (PSPHOT_ERR_CONFIG, true, "mismatched sizes (NAXIS1) for input images");
     71            return NULL;
     72        }
     73    }
     74    if (!options->numRows) {
     75        options->numRows = naxis2;
     76    } else {
     77        if (options->numRows != naxis2) {
     78            psError (PSPHOT_ERR_CONFIG, true, "mismatched sizes (NAXIS2) for input images");
     79            return NULL;
     80        }
     81    }
     82    return psf;
     83}
     84
    9085    // determine the input seeing
    91     {
    92         // XXX set this based on the mode (+1 for poly, +0 for map)
    93         float xNum = PS_MAX(psf->trendNx, 1);
    94         float yNum = PS_MAX(psf->trendNy, 1); // Number of realisations
    95         float sumFWHM = 0.0;              // FWHM for image
    96         int numFWHM = 0;                          // Number of FWHM measurements
    97         for (float y = 0; y < yNum; y += 1.0) {
    98             float yPos = options->numRows * ((y + 0.5) / yNum);
    99             for (float x = 0; x < xNum; x++) {
    100                 float xPos = options->numCols * ((x + 0.5) / xNum);
    101                 float fwhm = pmPSFtoFWHM(psf, xPos, yPos); // FWHM for image
    102                 if (isfinite(fwhm)) {
    103                     sumFWHM += fwhm;
    104                     numFWHM++;
    105                 }
     86bool determineSeeing (pmPSF *psf, psphotStackOptions *options, int index) {
     87
     88    // XXX set this based on the mode (+1 for poly, +0 for map)
     89    float xNum = PS_MAX(psf->trendNx, 1);
     90    float yNum = PS_MAX(psf->trendNy, 1); // Number of realisations
     91    float sumFWHM = 0.0;                  // FWHM for image
     92    int numFWHM = 0;                      // Number of FWHM measurements
     93    for (float y = 0; y < yNum; y += 1.0) {
     94        float yPos = options->numRows * ((y + 0.5) / yNum);
     95        for (float x = 0; x < xNum; x++) {
     96            float xPos = options->numCols * ((x + 0.5) / xNum);
     97            float fwhm = pmPSFtoFWHM(psf, xPos, yPos); // FWHM for image
     98            if (isfinite(fwhm)) {
     99                sumFWHM += fwhm;
     100                numFWHM++;
    106101            }
    107102        }
    108         if (numFWHM == 0) {
    109             options->inputSeeing->data.F32[index] = NAN;
    110             options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[index] = 0x02;
    111             psLogMsg("ppStack", PS_LOG_INFO, "Unable to measure PSF FWHM for image %d --- rejected.", index);
    112         } else {
    113             options->inputSeeing->data.F32[index] = sumFWHM / (float)numFWHM;
    114         }
    115         psLogMsg ("psphotStack", PS_LOG_INFO, "Input Seeing for %d: %f\n", index, options->inputSeeing->data.F32[index]);
    116103    }
    117 
     104    if (numFWHM == 0) {
     105        options->inputSeeing->data.F32[index] = NAN;
     106        options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[index] = 0x02;
     107        psLogMsg("ppStack", PS_LOG_INFO, "Unable to measure PSF FWHM for image %d --- rejected.", index);
     108    } else {
     109        options->inputSeeing->data.F32[index] = sumFWHM / (float)numFWHM;
     110    }
     111    psLogMsg ("psphotStack", PS_LOG_INFO, "Input Seeing for %d: %f\n", index, options->inputSeeing->data.F32[index]);
    118112    return true;
    119113}
     114
  • branches/eam_branches/psphot.20100506/src/psphotStackMatchPSFsUtils.c

    r27883 r27884  
    259259
    260260// perform the bulk of the PSF-matching
    261 bool matchKernel(pmConfig *config, pmReadout *readoutCnv, pmReadout *readoutRaw, psphotStackOptions *options, int index) {
     261bool matchKernel(pmConfig *config, pmReadout *readoutOut, pmReadout *readoutSrc, psphotStackOptions *options, int index) {
    262262
    263263    bool mdok;
     
    338338    stampSources = stackSourcesFilter(options->sourceLists->data[index], footprint); // Filtered list of sources
    339339
    340     fake = makeFakeReadout(config, readoutRaw, stampSources, options->psf, maskVal | maskBad, footprint + size);
     340    fake = makeFakeReadout(config, readoutSrc, stampSources, options->psf, maskVal | maskBad, footprint + size);
    341341    if (!fake) goto escape;
    342342
    343     dumpImage(fake, readoutRaw, index, "fake");
    344     dumpImage(readoutRaw,  readoutRaw, index, "real");
     343    dumpImage(fake, readoutSrc, index, "fake");
     344    dumpImage(readoutSrc,  readoutSrc, index, "real");
    345345
    346346    if (threads) pmSubtractionThreadsInit();
    347347
    348348    // Do the image matching
    349     pmSubtractionKernels *kernel = psMetadataLookupPtr(&mdok, readoutRaw->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel
     349    pmSubtractionKernels *kernel = psMetadataLookupPtr(&mdok, readoutSrc->analysis, PM_SUBTRACTION_ANALYSIS_KERNEL); // Conv kernel
    350350    if (kernel) {
    351         if (!pmSubtractionMatchPrecalc(NULL, readoutCnv, fake, readoutRaw, readoutRaw->analysis, stride, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
     351        if (!pmSubtractionMatchPrecalc(NULL, readoutOut, fake, readoutSrc, readoutSrc->analysis, stride, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac)) {
    352352            psError(psErrorCodeLast(), false, "Unable to convolve images.");
    353353            goto escape;
     
    361361        }
    362362
    363         if (!pmSubtractionMatch(NULL, readoutCnv, fake, readoutRaw, footprint, stride, regionSize, spacing, threshold, stampSources, stampsName, type, size, order, widthsCopy, orders, inner, ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, normFrac, sysError, skyErr, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac, PM_SUBTRACTION_MODE_2)) {
     363        if (!pmSubtractionMatch(NULL, readoutOut, fake, readoutSrc, footprint, stride, regionSize, spacing, threshold, stampSources, stampsName, type, size, order, widthsCopy, orders, inner, ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, normFrac, sysError, skyErr, kernelError, covarFrac, maskVal, maskBad, maskPoor, poorFrac, badFrac, PM_SUBTRACTION_MODE_2)) {
    364364            psError(psErrorCodeLast(), false, "Unable to match images.");
    365365            goto escape;
     
    369369    // Reject image completely if the maximum deconvolution fraction exceeds the limit
    370370    float deconvLimit = psMetadataLookupF32(NULL, stackRecipe, "DECONV.LIMIT"); // Limit on deconvolution fraction
    371     float deconv = psMetadataLookupF32(NULL, readoutCnv->analysis, PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Max deconvolution fraction
     371    float deconv = psMetadataLookupF32(NULL, readoutOut->analysis, PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Max deconvolution fraction
    372372    if (deconv > deconvLimit) {
    373373        psWarning("Maximum deconvolution fraction (%f) exceeds limit (%f) --- rejecting image %d\n", deconv, deconvLimit, index);
     
    375375    }
    376376
    377     dumpImage(readoutCnv, readoutRaw, index, "conv");
    378     dumpImageDiff(readoutCnv, fake, readoutRaw, index, "diff");
     377    dumpImage(readoutOut, readoutSrc, index, "conv");
     378    dumpImageDiff(readoutOut, fake, readoutSrc, index, "diff");
    379379
    380380    psFree(fake);
     
    542542
    543543// generate a fake readout against which to PSF match
    544 pmReadout *makeFakeReadout(pmConfig *config, pmReadout *readoutRaw, psArray *sources, pmPSF *psf, psImageMaskType maskVal, int fullSize) {
     544pmReadout *makeFakeReadout(pmConfig *config, pmReadout *readoutSrc, psArray *sources, pmPSF *psf, psImageMaskType maskVal, int fullSize) {
    545545
    546546    pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout with target PSF
     
    548548    psStats *bg = psStatsAlloc(PS_STAT_ROBUST_STDEV); // Statistics for background
    549549    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator
    550     if (!psImageBackground(bg, NULL, readoutRaw->image, readoutRaw->mask, maskVal, rng)) {
     550    if (!psImageBackground(bg, NULL, readoutSrc->image, readoutSrc->mask, maskVal, rng)) {
    551551        psError(PSPHOT_ERR_DATA, false, "Can't measure background for image.");
    552552        psFree(fake);
     
    560560
    561561    bool oldThreads = pmReadoutFakeThreads(true); // Old threading state
    562     if (!pmReadoutFakeFromSources(fake, readoutRaw->image->numCols, readoutRaw->image->numRows, sources, SOURCE_MASK, NULL, NULL, psf, minFlux, fullSize, false, true)) {
     562    if (!pmReadoutFakeFromSources(fake, readoutSrc->image->numCols, readoutSrc->image->numRows, sources, SOURCE_MASK, NULL, NULL, psf, minFlux, fullSize, false, true)) {
    563563        psError(PSPHOT_ERR_DATA, false, "Unable to generate fake image with target PSF.");
    564564        psFree(fake);
     
    567567    pmReadoutFakeThreads(oldThreads);
    568568
    569     fake->mask = psImageCopy(NULL, readoutRaw->mask, PS_TYPE_IMAGE_MASK);
     569    fake->mask = psImageCopy(NULL, readoutSrc->mask, PS_TYPE_IMAGE_MASK);
    570570
    571571    // Add the background into the target image
    572     psImage *bgImage = stackBackgroundModel(readoutRaw, config); // Image of background
     572    psImage *bgImage = stackBackgroundModel(readoutSrc, config); // Image of background
    573573    psBinaryOp(fake->image, fake->image, "+", bgImage);
    574574    psFree(bgImage);
  • branches/eam_branches/psphot.20100506/src/psphotStackOptions.c

    r27883 r27884  
    2929    options->convolve = false;
    3030    options->convolveSource = PSPHOT_CNV_SRC_NONE;
    31 
    32     options->psfs = psArrayAlloc(num);
    33 
    34     options->inputSeeing = psVectorAlloc(num, PS_TYPE_F32);
    35     psVectorInit(options->inputSeeing, NAN);
    36 
    37     options->matchChi2 = psVectorAlloc(num, PS_TYPE_F32);
    38     psVectorInit(options->matchChi2, NAN);
    39 
    40     options->inputMask = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
    41     psVectorInit(options->inputMask, 0);
    42 
    4331    options->targetSeeing = NAN;
    4432
     33    options->psfs        = psArrayAlloc(num);
    4534    options->sourceLists = psArrayAlloc(num); // Individual lists of sources for matching
    46     options->norm = psVectorAlloc(num, PS_TYPE_F32);
    47     psVectorInit(options->norm, NAN);
     35    options->kernels     = psArrayAlloc(num);
     36    options->regions     = psArrayAlloc(num);
    4837
    49     options->kernels = NULL;
    50     options->regions = NULL;
    51     options->matchChi2 = NULL;
    52     options->weightings = NULL;
     38    options->inputMask   = psVectorAlloc(num, PS_TYPE_VECTOR_MASK); // Mask for inputs
     39    options->inputSeeing = psVectorAlloc(num, PS_TYPE_F32);
     40    options->norm        = psVectorAlloc(num, PS_TYPE_F32);
     41    options->matchChi2   = psVectorAlloc(num, PS_TYPE_F32); // chi^2 for stamps when matching
     42    options->weightings  = psVectorAlloc(num, PS_TYPE_F32); // Combination weightings for images (1/noise^2)
     43
     44    psVectorInit(options->inputMask,   0);
     45    psVectorInit(options->inputSeeing, NAN);
     46    psVectorInit(options->norm,        NAN);
     47    psVectorInit(options->matchChi2,   NAN);
     48    psVectorInit(options->weightings,  NAN);
    5349
    5450    return options;
     
    6258    return PSPHOT_CNV_SRC_NONE;
    6359}
     60
     61pmFPAfile *psphotStackGetConvolveSource (pmConfig *config, psphotStackOptions *options, int index) {
     62
     63    // which image do we want to convolve?  RAW, CNV, AUTO?
     64    // find the currently selected readout
     65    pmFPAfile *fileRaw = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.RAW", index); // File of interest
     66    pmFPAfile *fileCnv = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.INPUT.CNV", index); // File of interest
     67
     68    pmFPAfile *fileSrc = NULL;
     69
     70    switch (options->convolveSource) {
     71      case PSPHOT_CNV_SRC_AUTO:
     72        fileSrc = fileCnv ? fileCnv : fileRaw;
     73        break;
     74
     75      case PSPHOT_CNV_SRC_RAW:
     76        fileSrc = fileRaw;
     77        break;
     78
     79      case PSPHOT_CNV_SRC_CNV:
     80        fileSrc = fileCnv;
     81        break;
     82
     83      default:
     84        psAbort("impossible case");
     85    }
     86    if (!fileSrc) {
     87        psError(PSPHOT_ERR_CONFIG, true, "desired convolution source is missing (cnv : %llx, raw : %llx)", (long long) fileCnv, (long long) fileRaw);
     88    }
     89   
     90    return fileSrc;
     91}
  • branches/eam_branches/psphot.20100506/src/psphotStackParseCamera.c

    r27883 r27884  
    2929
    3030        // RAW (unconvolved) input data (RAW:IMAGE, RAW:MASK, RAW:VARIANCE, RAW:PSF)
    31         psString rawImage = psMetadataLookupStr(NULL, input, "RAW:IMAGE"); // Name of image
     31        psString rawImage = psMetadataLookupStr(&status, input, "RAW:IMAGE"); // Name of image
    3232        if (rawImage && strlen(rawImage) > 0) {
    33             pmFPAfile *rawInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.RAW", rawImage, PM_FPA_FILE_IMAGE); // File for image
     33            rawInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.RAW", rawImage, PM_FPA_FILE_IMAGE); // File for image
    3434            if (!rawInputFile) {
    3535                psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, rawImage);
     
    6060
    6161        // CNV (convolved) input data (CNV:IMAGE, CNV:MASK, CNV:VARIANCE, CNV:PSF)
    62         psString cnvImage = psMetadataLookupStr(NULL, input, "CNV:IMAGE"); // Name of image
     62        psString cnvImage = psMetadataLookupStr(&status, input, "CNV:IMAGE"); // Name of image
    6363        if (cnvImage && strlen(cnvImage) > 0) {
    64             pmFPAfile *cnvInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.CNV", cnvImage, PM_FPA_FILE_IMAGE); // File for image
     64            cnvInputFile = defineFile(config, NULL, "PSPHOT.STACK.INPUT.CNV", cnvImage, PM_FPA_FILE_IMAGE); // File for image
    6565            if (!cnvInputFile) {
    6666                psError(PS_ERR_UNKNOWN, false, "Unable to define file from image %d (%s)", i, cnvImage);
     
    9696
    9797        psString sources = psMetadataLookupStr(&status, input, "SOURCES"); // Name of mask
    98         pmFPAfile *srcInputFile = rawInputFile ? rawInputFile : cnvInputFile;
     98        // pmFPAfile *srcInputFile = rawInputFile ? rawInputFile : cnvInputFile;
    9999        if (sources && strlen(sources) > 0) {
    100             if (!defineFile(config, srcInputFile, "PSPHOT.STACK.SOURCES.CNV", sources, PM_FPA_FILE_CMF)) {
     100            if (!defineFile(config, NULL, "PSPHOT.STACK.SOURCES", sources, PM_FPA_FILE_CMF)) {
    101101                psError(PS_ERR_UNKNOWN, false, "Unable to define file from sources %d (%s)", i, sources);
    102102                return false;
Note: See TracChangeset for help on using the changeset viewer.