Changeset 6064 for trunk/ppImage/src/ppImageDetrendCell.c
- Timestamp:
- Jan 19, 2006, 4:58:42 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendCell.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendCell.c
r5858 r6064 1 1 # include "ppImage.h" 2 #include "pmFPA.h" 2 3 3 4 // mask, bias, dark, flat are defined per Cell 4 5 // pedestal is constructed for each readout, which may have different exposure times 5 6 6 pmReadout *ppDetrendSelectFirst (pmCell *cell, char *name, bool doThis) { 7 pmReadout *ppDetrendSelectFirst(pmCell *cell, char *name, bool doThis) 8 { 7 9 8 10 if (!doThis) { 9 return NULL;11 return NULL; 10 12 } 11 13 12 14 if (cell->readouts->n > 1) { 13 psLogMsg("phase2", PS_LOG_WARN, "%s contains multiple readouts: only the first will be used.", name);15 psLogMsg("phase2", PS_LOG_WARN, "%s contains multiple readouts: only the first will be used.", name); 14 16 } 15 17 … … 19 21 } 20 22 21 bool ppDetrendCell (ppDetrend *detrend, ppOptions *options, ppConfig *config) { 23 bool ppDetrendCell(ppDetrend *detrend, ppOptions *options, ppConfig *config) 24 { 22 25 23 pmReadout *mask = ppDetrendSelectFirst (detrend->mask, "mask", options->doMask); 24 pmReadout *bias = ppDetrendSelectFirst (detrend->bias, "bias", options->doBias); 25 pmReadout *dark = ppDetrendSelectFirst (detrend->dark, "dark", options->doDark); 26 // pmReadout *flat = ppDetrendSelectFirst (detrend->flat, "flat", options->doFlat); 26 pmCellSetWeights(detrend->input); 27 28 pmReadout *mask = ppDetrendSelectFirst(detrend->mask, "mask", options->doMask); 29 pmReadout *bias = ppDetrendSelectFirst(detrend->bias, "bias", options->doBias); 30 pmReadout *dark = ppDetrendSelectFirst(detrend->dark, "dark", options->doDark); 31 pmReadout *flat = ppDetrendSelectFirst(detrend->flat, "flat", options->doFlat); 27 32 28 33 // Dark time for dark image 29 float darkTime = 1.0; 34 float darkTime = 1.0; 30 35 if (options->doDark) { 31 darkTime = psMetadataLookupF32(NULL, detrend->dark->concepts, "CELL.DARKTIME");32 if (darkTime <= 0.0) {33 psErrorStackPrint(stderr, "DARKTIME for dark image (%f) is non-positive.\n", darkTime);34 exit(EXIT_FAILURE);35 }36 darkTime = psMetadataLookupF32(NULL, detrend->dark->concepts, "CELL.DARKTIME"); 37 if (darkTime <= 0.0) { 38 psErrorStackPrint(stderr, "DARKTIME for dark image (%f) is non-positive.\n", darkTime); 39 exit(EXIT_FAILURE); 40 } 36 41 } 37 38 // the pedestal combines the bias and dark contributions for a single readout39 pmReadout *pedestal = NULL;40 42 41 43 for (int k = 0; k < detrend->input->readouts->n; k++) { 42 44 43 pmReadout *input = detrend->input->readouts->data[k]; // Readout of interest in input image45 pmReadout *input = detrend->input->readouts->data[k]; // Readout of interest in input image 44 46 45 // Mask bad pixels46 if (options->doMask) {47 ppDetrendMask (detrend->input, input, mask);48 }47 // Mask bad pixels 48 if (options->doMask) { 49 ppDetrendMask (detrend->input, input, mask); 50 } 49 51 50 // Non-linearity correction51 if (options->doNonLin) {52 ppDetrendNonLinear (detrend->input, input, options);53 }52 // Non-linearity correction 53 if (options->doNonLin) { 54 ppDetrendNonLinear (detrend->input, input, options); 55 } 54 56 55 // generate the pedestal image (passes through the old pedestal if current exptime == last exptime) 56 pedestal = ppDetrendPedestal (pedestal, detrend->input, bias, dark, darkTime, options);57 // Bias, dark and overscan subtraction are all merged. 58 ppDetrendBias(input, bias, dark, options); 57 59 58 // Bias, dark and overscan subtraction are all merged. 59 ppDetrendBias (detrend->input, input, pedestal, options); 60 61 // Flat-field correction (no options used?) 62 if (options->doFlat) { 63 psLogMsg("phase2", PS_LOG_INFO, "flat field disabled.\n"); 64 // pmFlatField (input, flat); 65 } 60 // Flat-field correction (no options used?) 61 if (options->doFlat) { 62 #if 0 63 psLogMsg("phase2", PS_LOG_INFO, "flat field disabled.\n"); 64 #endif 65 pmFlatField(input, flat); 66 } 66 67 } 67 68 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
