Changeset 29003
- Timestamp:
- Aug 20, 2010, 12:12:38 PM (16 years ago)
- Location:
- trunk/ppSub/src
- Files:
-
- 6 edited
- 1 copied
-
Makefile.am (modified) (1 diff)
-
ppSub.h (modified) (1 diff)
-
ppSubBackground.c (modified) (1 diff)
-
ppSubFlagNeighbors.c (copied) (copied from branches/eam_branches/ipp-20100621/ppSub/src/ppSubFlagNeighbors.c )
-
ppSubLoop.c (modified) (8 diffs)
-
ppSubReadoutPhotometry.c (modified) (1 diff)
-
ppSubReadoutSubtract.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/Makefile.am
r28043 r29003 39 39 ppSubDefineOutput.c \ 40 40 ppSubExtras.c \ 41 ppSubFlagNeighbors.c \ 41 42 ppSubMakePSF.c \ 42 43 ppSubMatchPSFs.c \ -
trunk/ppSub/src/ppSub.h
r28121 r29003 175 175 ); 176 176 177 bool ppSubFlagNeighbors(pmConfig *config, pmFPAview *view, psArray *sources, bool matchRef); 178 bool ppSubMatchSources (psArray *objects, psArray *sources, float RADIUS, float MIN_SN); 179 bool ppSubSetSourceImageIDs (psArray *sources, int imageID); 180 177 181 ///@} 178 182 #endif -
trunk/ppSub/src/ppSubBackground.c
r26982 r29003 67 67 for (int y = 0; y < numRows; y++) { 68 68 for (int x = 0; x < numCols; x++) { 69 // special case 1: NAN the masked pixels 69 70 if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskBad) { 70 image->data.F32[y][x] = 0.0; 71 } else { 72 float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelImage, binning); // Background value 73 if (!isfinite(value)) { 74 image->data.F32[y][x] = NAN; 75 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskBad; 76 } else { 77 image->data.F32[y][x] -= value; 78 } 79 } 71 image->data.F32[y][x] = NAN; 72 continue; 73 } 74 // special case 1: NAN & mask pixels without a valid background model 75 float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelImage, binning); // Background value 76 if (!isfinite(value)) { 77 image->data.F32[y][x] = NAN; 78 mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= maskBad; 79 continue; 80 } 81 image->data.F32[y][x] -= value; 80 82 } 81 83 } -
trunk/ppSub/src/ppSubLoop.c
r28121 r29003 17 17 #include <pslib.h> 18 18 #include <psmodules.h> 19 #include <psphot.h> 19 20 20 21 #include "ppSub.h" 22 23 bool dumpout(pmConfig *config, char *name) 24 { 25 pmFPAview *view = ppSubViewReadout(); // View to readout 26 pmReadout *out = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT"); 27 psphotSaveImage (NULL, out->image, name); 28 return true; 29 } 30 21 31 22 32 bool ppSubLoop(ppSubData *data) … … 105 115 return false; 106 116 } 117 // dumpout(config, "diff.1.fits"); 107 118 108 119 // Close convolved files … … 111 122 return false; 112 123 } 124 // dumpout(config, "diff.2a.fits"); 113 125 114 126 // Higher order background subtraction using psphot … … 117 129 return false; 118 130 } 131 // dumpout(config, "diff.2b.fits"); 119 132 120 133 // Perform Variance correction (rescale within a modest range) … … 123 136 return false; 124 137 } 138 // dumpout(config, "diff.2c.fits"); 125 139 126 140 if (data->quality) { … … 138 152 return false; 139 153 } 154 // dumpout(config, "diff.3.fits"); 140 155 141 156 if (!ppSubFilesIterateUp(config, PPSUB_FILES_PHOT_SUB)) { … … 157 172 } 158 173 } 174 // dumpout(config, "diff.4.fits"); 159 175 160 176 // generate the binned image used to write the jpeg … … 204 220 } else { 205 221 // Close subtraction files 222 // dumpout(config, "diff.5.fits"); 206 223 if (!ppSubFilesIterateUp(config, PPSUB_FILES_SUB)) { 207 224 psError(PPSUB_ERR_IO, false, "Unable to close subtraction files."); -
trunk/ppSub/src/ppSubReadoutPhotometry.c
r26982 r29003 97 97 psAssert (sources, "missing sources?"); 98 98 99 // a likely source of false positives is poor subtractions. this results in 100 // detections in the wings (or cores) of bright(er) stars found in both images. 101 // flag detections based on their distance from the bright(er) input sources. 102 bool matchRef = !strcasecmp(name, "PPSUB.INVERSE"); 103 ppSubFlagNeighbors (config, view, sources, matchRef); 104 99 105 if (data->stats) { 100 106 bool mdok; -
trunk/ppSub/src/ppSubReadoutSubtract.c
r28006 r29003 51 51 outRO->variance = (psImage*)psBinaryOp(outRO->variance, minuend->variance, "+", subtrahend->variance); 52 52 53 // NAN the masked pixels in the diff image (pixels masked in A are not yet NAN'ed in B) 54 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config) | pmConfigMaskGet("BLANK", config); // Bits to mask in inputs 55 for (int iy = 0; iy < outRO->image->numRows; iy++) { 56 for (int ix = 0; ix < outRO->image->numCols; ix++) { 57 if ((outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) == 0) continue; 58 outRO->image->data.F32[iy][ix] = NAN; 59 } 60 } 61 53 62 // Measure the variance scales 54 63 psStats *varStats = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for variance images 55 64 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); // Random number generator 56 psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config) |57 pmConfigMaskGet("BLANK", config); // Bits to mask in inputs58 65 psImageBackground(varStats, NULL, minuend->variance, minuend->mask, maskVal, rng); 59 66 float minuendVar = varStats->robustMedian; // Mean variance for minuend
Note:
See TracChangeset
for help on using the changeset viewer.
