Changeset 9857
- Timestamp:
- Nov 3, 2006, 4:40:46 PM (20 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 2 added
- 6 edited
-
Makefile.am (modified) (3 diffs)
-
ppImageDetrendFringe.c (added)
-
ppImageDetrendFringe.h (added)
-
ppImageLoop.c (modified) (4 diffs)
-
ppImageOptions.c (modified) (3 diffs)
-
ppImageOptions.h (modified) (1 diff)
-
ppImageParseCamera.c (modified) (5 diffs)
-
ppImageParseDetrend.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/Makefile.am
r8348 r9857 4 4 ppImage.h \ 5 5 ppImageOptions.h \ 6 ppImageDetrendFringe.h \ 6 7 ppMem.h 7 8 … … 18 19 ppImageDetrendBias.c \ 19 20 ppImageDetrendNonLinear.c \ 21 ppImageDetrendFringe.c \ 20 22 ppImageRebinReadout.c \ 21 23 ppImageMosaic.c \ … … 38 40 ppImageDetrendBias.c \ 39 41 ppImageDetrendNonLinear.c \ 42 ppImageDetrendFringe.c \ 40 43 ppImageRebinReadout.c \ 41 44 ppImageMosaic.c \ -
trunk/ppImage/src/ppImageLoop.c
r9657 r9857 5 5 #include <ppStats.h> 6 6 #include "ppImage.h" 7 #include "ppImageDetrendFringe.h" 7 8 8 9 bool ppImageLoop (pmConfig *config, ppImageOptions *options) { … … 44 45 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) return false; 45 46 47 const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip 48 psArray *fringeRef = NULL; // Array of array of fringe statistics for reference --- for each cell 49 psArray *fringeSci = NULL; // Array of fringe statistics for science --- for each cell 50 if (options->doFringe) { 51 fringeRef = psArrayAlloc(chip->cells->n); 52 fringeSci = psArrayAlloc(chip->cells->n); 53 } 54 46 55 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 47 56 psLogMsg ("ppImageLoop", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 48 57 if (!cell->process || !cell->file_exists) { continue; } 49 58 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) return false; 59 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell 60 61 if (options->doFringe) { 62 pmFPAfile *fringeFile = psMetadataLookupPtr(&status, config->files, "PPIMAGE.FRINGE"); 63 if (!status || !fringeFile) { 64 psErrorStackPrint(stderr, "Can't find fringe data!\n"); 65 exit(EXIT_FAILURE); 66 } 67 68 psString fringeExt = NULL; // Fringe extension name 69 psStringAppend(&fringeExt, "FRINGE_%s_%s", chipName, cellName); 70 fringeRef->data[view->cell] = pmFringesReadFits(NULL, fringeFile->fits, fringeExt); 71 psFree(fringeExt); 72 } 50 73 51 74 // process each of the readouts … … 57 80 if (!ppImageDetrendReadout (config, options, view)) return false; 58 81 82 if (options->doFringe) { 83 ppImageDetrendFringeMeasure((pmFringeStats**)(&fringeSci->data[view->cell]), 84 fringeRef->data[view->cell], readout, options); 85 } 86 } 87 } 88 89 // Solve the fringe system 90 pmFringeScale *fringeSoln = NULL; // Solution for the fringes 91 if (options->doFringe) { 92 fringeSoln = ppImageDetrendFringeSolve(fringeSci, fringeRef, options); 93 psFree(fringeSci); 94 psFree(fringeRef); 95 } 96 97 // Go back over the cells to apply the fringe and do statistics 98 view->cell = view->readout = -1; 99 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 100 if (!cell->process || !cell->file_exists) { continue; } 101 102 // Apply the fringe correction 103 psTrace("ppImage", 3, "Applying fringe correction...\n"); 104 bool mdok; // Status of MD lookup 105 pmFPAfile *fringeFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.FRINGE"); 106 pmCell *fringeCell = pmFPAviewThisCell(view, fringeFile->fpa); 107 psImage *fringe = ppImageDetrendFringeGenerate(cell, fringeCell, fringeSoln); 108 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 109 if (!readout->data_exists) { continue; } 110 111 // XXX: Make generic, so subregions may be subtracted as well 112 psBinaryOp(readout->image, readout->image, "-", fringe); 113 59 114 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 60 115 } 116 psFree(fringe); 117 61 118 62 119 // Perform statistics on the detrended cell … … 67 124 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 68 125 } 126 psFree(fringeSoln); 69 127 70 128 ppImageMosaicChip (config, view, "PPIMAGE.OUTPUT.CHIP", "PPIMAGE.OUTPUT"); -
trunk/ppImage/src/ppImageOptions.c
r9539 r9857 49 49 // Overscan defaults 50 50 options->overscan = NULL; // Overscan options 51 52 // Fringe defaults 53 options->fringeRej = NAN; 54 options->fringeIter = 0; 55 options->fringeKeep = 1.0; 51 56 52 57 // Non-linearity default options … … 163 168 options->doDark = psMetadataLookupBool(NULL, recipe, "DARK"); 164 169 options->doFlat = psMetadataLookupBool(NULL, recipe, "FLAT"); 170 options->doFringe = psMetadataLookupBool(NULL, recipe, "FRINGE"); 165 171 options->doShutter = psMetadataLookupBool(NULL, recipe, "SHUTTER"); 166 172 … … 200 206 } 201 207 208 // Fringe options 209 options->fringeRej = psMetadataLookupF32(NULL, recipe, "FRINGE.REJ"); 210 options->fringeIter = psMetadataLookupS32(NULL, recipe, "FRINGE.ITER"); 211 options->fringeKeep = psMetadataLookupF32(NULL, recipe, "FRINGE.KEEP"); 212 202 213 return options; 203 214 } -
trunk/ppImage/src/ppImageOptions.h
r9342 r9857 38 38 int xBin2, yBin2; 39 39 40 float fringeRej; // Fringe rejection limit 41 int fringeIter; // Fringe iterations 42 float fringeKeep; // Fringe keep fraction 43 40 44 } ppImageOptions; 41 45 -
trunk/ppImage/src/ppImageParseCamera.c
r9438 r9857 34 34 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.BIAS", input->fpa, PM_DETREND_TYPE_BIAS); 35 35 if (!status) { 36 psError (PS_ERR_IO, false, "can't find a bias image source");37 return NULL;38 }36 psError (PS_ERR_IO, false, "can't find a bias image source"); 37 return NULL; 38 } 39 39 } 40 40 if (options->doDark) { … … 44 44 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.DARK", input->fpa, PM_DETREND_TYPE_DARK); 45 45 if (!status) { 46 psError (PS_ERR_IO, false, "can't find a dark image source");47 return NULL;48 }46 psError (PS_ERR_IO, false, "can't find a dark image source"); 47 return NULL; 48 } 49 49 } 50 50 if (options->doMask) { … … 54 54 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.MASK", input->fpa, PM_DETREND_TYPE_MASK); 55 55 if (!status) { 56 psError (PS_ERR_IO, false, "can't find a mask image source");57 return NULL;58 }56 psError (PS_ERR_IO, false, "can't find a mask image source"); 57 return NULL; 58 } 59 59 } 60 60 if (options->doShutter) { … … 62 62 pmFPAfileDefineFromArgs (&status, config, "PPIMAGE.SHUTTER", "SHUTTER"); 63 63 pmFPAfileDefineFromConf (&status, config, "PPIMAGE.SHUTTER"); 64 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.SHUTTER", input->fpa, PM_DETREND_TYPE_ FLAT);64 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.SHUTTER", input->fpa, PM_DETREND_TYPE_SHUTTER); 65 65 if (!status) { 66 psError (PS_ERR_IO, false, "can't find a shutter image source");67 return NULL;68 }66 psError (PS_ERR_IO, false, "can't find a shutter image source"); 67 return NULL; 68 } 69 69 } 70 70 if (options->doFlat) { … … 74 74 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FLAT", input->fpa, PM_DETREND_TYPE_FLAT); 75 75 if (!status) { 76 psError (PS_ERR_IO, false, "can't find a flat image source"); 77 return NULL; 78 } 76 psError (PS_ERR_IO, false, "can't find a flat image source"); 77 return NULL; 78 } 79 } 80 if (options->doFringe) { 81 bool status = false; 82 pmFPAfileDefineFromArgs (&status, config, "PPIMAGE.FRINGE", "FRINGE"); 83 pmFPAfileDefineFromConf (&status, config, "PPIMAGE.FRINGE"); 84 pmFPAfileDefineFromDetDB (&status, config, "PPIMAGE.FRINGE", input->fpa, PM_DETREND_TYPE_FRINGE_IMAGE); 85 if (!status) { 86 psError (PS_ERR_IO, false, "can't find a fringe image source"); 87 return NULL; 88 } 79 89 } 80 90 -
trunk/ppImage/src/ppImageParseDetrend.c
r9342 r9857 54 54 } 55 55 56 if (options->doFringe) { 57 bool status = false; 58 pmFPAfileFromArgs (&status, config, "PPIMAGE.FRINGE", "FRINGE"); 59 pmFPAfileFromConf (&status, config, "PPIMAGE.FRINGE", input->fpa); 60 if (!status) psAbort ("ppImageParseDetrend", "can't find a fringe image source"); 61 } 62 56 63 // the following files are output targets 57 64 // XXX which of these are required?
Note:
See TracChangeset
for help on using the changeset viewer.
