Changeset 26894 for trunk/psphot/src/psphotSubtractBackground.c
- Timestamp:
- Feb 10, 2010, 7:36:29 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSubtractBackground.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSubtractBackground.c
r23287 r26894 4 4 // generate the median in NxN boxes, clipping heavily 5 5 // linear interpolation to generate full-scale model 6 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filename)6 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filename, int index, psMetadata *recipe) 7 7 { 8 8 bool status = true; … … 13 13 14 14 // find the currently selected readout 15 pmFPAfile *file = psMetadataLookupPtr (&status, config->files, filename); 15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filename, index); // File of interest 16 16 17 pmFPA *inFPA = file->fpa; 17 18 pmReadout *readout = pmFPAviewThisReadout (view, inFPA); … … 19 20 psImage *mask = readout->mask; 20 21 21 // find the currently selected readout 22 pmReadout *model = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKMDL"); 22 // find the currently selected readout (XXX note that the model is saved on PSPHOT.BACKMDL regardless of 'filename' 23 pmFPAfile *modelFile = pmFPAfileSelectSingle(config->files, "PSPHOT.BACKMDL", index); // File of interest 24 assert (modelFile); 25 pmReadout *model = pmFPAviewThisReadout (view, modelFile->fpa); 23 26 assert (model); 24 25 // select the appropriate recipe information26 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);27 assert (recipe);28 27 29 28 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) … … 35 34 36 35 // select background pixels, from output background file, or create 36 // XXX for now, we will only allow a single background image to be generated 37 37 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKGND"); 38 38 if (file) { … … 66 66 67 67 // back-sub image pixels, from output background file (don't create if not requested) 68 // XXX for now, we will only allow a single background-subtracted image to be generated 68 69 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKSUB"); 69 70 if (file) { … … 109 110 // the pmReadout selected in this function are all view on entries in config->files 110 111 112 // display the backsub and backgnd images 113 // move this inthe the subtract background loop 114 psphotVisualShowBackground (config, view, readout); 115 111 116 npass ++; 112 117 return true; 113 118 } 119 120 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view) 121 { 122 bool status = false; 123 124 // select the appropriate recipe information 125 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 126 psAssert (recipe, "missing recipe?"); 127 128 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 129 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 130 131 // loop over the available readouts 132 for (int i = 0; i < num; i++) { 133 if (!psphotSubtractBackgroundReadout (config, view, "PSPHOT.INPUT", i, recipe)) { 134 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i); 135 return false; 136 } 137 } 138 return true; 139 }
Note:
See TracChangeset
for help on using the changeset viewer.
