Changeset 6817 for trunk/ppImage/src/ppImageDetrendCell.c
- Timestamp:
- Apr 7, 2006, 5:57:23 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendCell.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendCell.c
r6747 r6817 1 #include <stdio.h> 2 #include "pslib.h" 3 #include "psmodules.h" 4 #include "ppImageDetrend.h" 5 #include "ppImageOptions.h" 1 #include "ppImage.h" 6 2 7 // mask, bias, dark, flat are defined per Cell 3 bool ppImageDetrendReadout (ppImageOptions *options, pmConfig *config, pmFPAview *view) { 8 4 9 pmReadout *ppImageDetrendSelectFirst(pmCell *cell, char *name, bool doThis) 10 { 11 if (!doThis) { 12 return NULL; 5 bool status; 6 pmFPAfile *file; 7 8 // construct a view for the detrend images (which have only one readout) 9 pmFPAview *detview = pmFPAviewAlloc (0); 10 *detview = *view; 11 detview->readout = 0; 12 13 // find the currently selected readout 14 file = psMetadataLookupPtr (&status, config->files, "PPIMAGE.INPUT"); 15 pmReadout *input = pmFPAviewThisReadout (view, file->fpa); 16 17 pmReadoutSetWeights (input); 18 19 // Mask bad pixels 20 if (options->doMask) { 21 file = psMetadataLookupPtr (&status, config->files, "PPIMAGE.MASK"); 22 pmReadout *mask = pmFPAviewThisReadout (detview, file->fpa); 23 ppImageDetrendMask(input, mask); 13 24 } 14 25 15 if (cell->readouts->n > 1) { 16 psLogMsg("phase2", PS_LOG_WARN, "%s contains multiple readouts: only the first will be used.", name); 26 # if 0 27 // Non-linearity correction 28 if (options->doNonLin) { 29 ppImageDetrendNonLinear(detrend->input, input, options); 30 } 31 # endif 32 33 // set up the readouts for dark and bias 34 pmReadout *dark = NULL; 35 pmReadout *bias = NULL; 36 if (options->doBias) { 37 file = psMetadataLookupPtr (&status, config->files, "PPIMAGE.BIAS"); 38 bias = pmFPAviewThisReadout (detview, file->fpa); 39 } 40 if (options->doDark) { 41 file = psMetadataLookupPtr (&status, config->files, "PPIMAGE.DARK"); 42 dark = pmFPAviewThisReadout (detview, file->fpa); 17 43 } 18 44 19 pmReadout *readout = cell->readouts->data[0]; // Readout of interest in this cell 45 // Bias, dark and overscan subtraction are all merged. 46 ppImageDetrendBias(input, bias, dark, options); 20 47 21 return readout; 48 // Flat-field correction (no options used?) 49 if (options->doFlat) { 50 file = psMetadataLookupPtr (&status, config->files, "PPIMAGE.FLAT"); 51 pmReadout *flat = pmFPAviewThisReadout (detview, file->fpa); 52 pmFlatField(input, flat); 53 } 54 55 psFree (detview); 56 return true; 22 57 } 23 58 24 bool ppImageDetrendCell(ppImageDetrend *detrend, ppImageOptions *options, pmConfig *config) 25 { 26 #if 0 27 pmCellSetWeights(detrend->input); 28 #endif 59 // XXX in psphot, the recipe options are parsed at this depth 60 // XXX consider if we move ppImageOptions in here 61 // psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, "PSPHOT"); 29 62 30 pmReadout *mask = ppImageDetrendSelectFirst(detrend->mask, "mask", options->doMask);31 pmReadout *bias = ppImageDetrendSelectFirst(detrend->bias, "bias", options->doBias);32 pmReadout *dark = ppImageDetrendSelectFirst(detrend->dark, "dark", options->doDark);33 pmReadout *flat = ppImageDetrendSelectFirst(detrend->flat, "flat", options->doFlat);34 35 #if 036 printf("Flat type: %x\n", flat->image->type.type);37 printf("Flat value: %f\n", flat->image->data.F32[flat->image->numRows/2][flat->image->numCols/2]);38 #endif39 40 for (int k = 0; k < detrend->input->readouts->n; k++) {41 42 pmReadout *input = detrend->input->readouts->data[k]; // Readout of interest in input image43 44 // Mask bad pixels45 if (options->doMask) {46 ppImageDetrendMask(detrend->input, input, mask);47 }48 49 // Non-linearity correction50 if (options->doNonLin) {51 ppImageDetrendNonLinear(detrend->input, input, options);52 }53 54 // Bias, dark and overscan subtraction are all merged.55 ppImageDetrendBias(input, bias, dark, options);56 57 // Flat-field correction (no options used?)58 if (options->doFlat) {59 pmFlatField(input, flat);60 }61 }62 return true;63 }
Note:
See TracChangeset
for help on using the changeset viewer.
