IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41414


Ignore:
Timestamp:
Sep 17, 2020, 12:19:25 PM (6 years ago)
Author:
eugene
Message:

make a PSF if forced photometry is requested; plug a leak

Location:
branches/eam_branches/gDiff.20200202/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/gDiff.20200202/src/gDiffCamera.c

    r41413 r41414  
    475475    if (data->forcedPhot1) {
    476476        // this pmFPAfile is used to carry sources detected in the positive image #1
    477         pmFPAfile *posSources1 = defineOutputFile(config, input, true, "GDIFF.POS1.SOURCES", PM_FPA_FILE_CMF);
     477        pmFPAfile *posSources1 = defineOutputFile(config, output, true, "GDIFF.POS1.SOURCES", PM_FPA_FILE_CMF);
    478478        if (!posSources1) {
    479479            psError(psErrorCodeLast(), false, "Unable to set up forced source file.");
     
    483483
    484484        // this pmFPAfile is used to carry sources detected in the diff image @ the positions from positive image #1
    485         pmFPAfile *frcSources1 = defineOutputFile(config, input, true, "GDIFF.FORCED1.SOURCES", PM_FPA_FILE_CMF);
     485        pmFPAfile *frcSources1 = defineOutputFile(config, output, true, "GDIFF.FORCED1.SOURCES", PM_FPA_FILE_CMF);
    486486        if (!frcSources1) {
    487487            psError(psErrorCodeLast(), false, "Unable to set up forced source file.");
  • branches/eam_branches/gDiff.20200202/src/gDiffDefineOutput.c

    r41413 r41414  
    2727
    2828    // The output readout may already be present if we read in the convolution kernel
     29    // NOTE: pmReadoutAlloc returns a reference and saves one on the supplied cell.  The
     30    // psMemIncrRefCounter below is needed in the first block so we can free the
     31    // reference.  (we should code this to drop the returned reference in the second block
    2932    pmReadout *outRO = NULL;            // Output readout
    3033    if (outCell->readouts && outCell->readouts->n > 0 && outCell->readouts->data[0]) {
  • branches/eam_branches/gDiff.20200202/src/gDiffExtras.c

    r41413 r41414  
    2121    if (!targetRO) {
    2222        pmCell *targetCell = pmFPAviewThisCell(view, target->fpa);
    23         targetRO = pmReadoutAlloc(targetCell);
     23        targetRO = pmReadoutAlloc(targetCell); // returns a reference and adds one to the cell
    2424        psAssert(targetRO, "programming error: could not make target readout");
     25        psFree (targetRO); // free the reference
    2526    }
    2627
     
    5556    if (hdu) {
    5657        psMetadata *header = psMetadataLookupMetadata(NULL, targetRO->analysis, "PSPHOT.HEADER"); // Header
    57         hdu->header = psMetadataCopy(hdu->header, header);
     58        if (header) {
     59          hdu->header = psMetadataCopy(hdu->header, header);
     60        }
    5861    }
    5962
  • branches/eam_branches/gDiff.20200202/src/gDiffFiles.c

    r41413 r41414  
    3131
    3232// Subtraction photometry
    33 static const char *subPhotFiles[] = { "GDIFF.OUTPUT.SOURCES", NULL };
     33static const char *subPhotFiles[] = { "GDIFF.OUTPUT.SOURCES",
     34                                      "GDIFF.POS1.SOURCES", "GDIFF.FORCED1.SOURCES",
     35                                      "GDIFF.POS2.SOURCES", "GDIFF.FORCED2.SOURCES", NULL };
    3436
    3537// Inverse subtraction files
  • branches/eam_branches/gDiff.20200202/src/gDiffLoop.c

    r41413 r41414  
    2626    psAssert(config, "Require configuration.");
    2727
    28     HDUCHECK ("0a: start gDiffLoop");
    29 
    3028    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, GDIFF_RECIPE); // Recipe for ppSim
    3129    psAssert(recipe, "We checked this earlier, so it should be here.");
     
    4947    psTimerStart("GDIFF_MATCH");
    5048
    51     HDUCHECK ("0b: gDiffSetMasks");
    52 
    5349    if (!gDiffSetMasks(config)) {
    5450        psError(psErrorCodeLast(), false, "Unable to set masks.");
     
    5652    }
    5753
    58     HDUCHECK ("0b.1: gDiffInputDetections");
    5954    if (data->forcedPhot1) {
    6055        bool foundDetections = false;
     
    7065        }
    7166    }
    72     HDUCHECK ("0b.2: gDiffInputDetections");
     67
    7368    if (data->forcedPhot2) {
    7469        // XXX why is this only done for Phot2 and not Phot1 ??
     
    110105     **** This is the core of the PSF-matched image subtraction code.   ****/
    111106
    112     HDUCHECK ("1: before gDiffMatchPSFs");
    113 
    114107    if (!gDiffMatchPSFs(data)) {
    115108        psError(psErrorCodeLast(), false, "Unable to match PSFs.");
     
    152145    }
    153146
    154     HDUCHECK ("2: after gDiffLowThreshold");
    155 
    156147    // Set up subtraction files
    157148    if (!gDiffFilesIterateDown(config, GDIFF_FILES_SUB)) {
     
    166157        goto ESCAPE;
    167158    }
    168 
    169     HDUCHECK ("2a: gDiffMakePSF");
    170159
    171160    // the functions in this block are not critical for initial testing, so block them out for now
     
    186175    }
    187176
    188     HDUCHECK ("3: before gDiffReadoutSubtract");
    189 
    190177    if (!gDiffReadoutSubtract(config)) {
    191178        psError(psErrorCodeLast(), false, "Unable to subtract images.");
     
    208195    }
    209196   
    210     HDUCHECK ("4: before gDiffBackground");
    211 
    212197    // Higher order background subtraction using psphot
    213198    if (!gDiffBackground(config)) {
     
    218203    // dumpout(config, "diff.2b.fits");
    219204
    220     HDUCHECK ("5: before gDiffVarianceRescale");
    221 
    222205    // Perform Variance correction (rescale within a modest range)
    223206    if (!gDiffVarianceRescale(config, data)) {
     
    240223    }
    241224
    242     HDUCHECK ("6: before gDiffReadoutPhotometry");
    243 
    244225    if (!data->quality && !gDiffReadoutPhotometry("GDIFF.OUTPUT", data)) {
    245226        psError(psErrorCodeLast(), false, "Unable to perform photometry.");
     
    248229    }
    249230    // dumpout(config, "diff.3.fits");
    250 
    251     HDUCHECK ("7: before gDiffReadoutForcedPhot (1)");
    252231
    253232    // forced photometry for positive image 1
  • branches/eam_branches/gDiff.20200202/src/gDiffMakePSF.c

    r41413 r41414  
    1717    psAssert(config, "Require configuration");
    1818
    19     if (!data->photometry) {
     19    if (!data->photometry && !data->forcedPhot1 && !data->forcedPhot2) {
    2020        return true;
    2121    }
Note: See TracChangeset for help on using the changeset viewer.