Changeset 9952 for trunk/ppImage/src/ppImageLoop.c
- Timestamp:
- Nov 13, 2006, 12:26:09 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageLoop.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageLoop.c
r9871 r9952 6 6 #include "ppImage.h" 7 7 #include "ppImageDetrendFringe.h" 8 8 9 9 10 bool ppImageLoop (pmConfig *config, ppImageOptions *options) { … … 45 46 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) return false; 46 47 47 const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); // Name of chip48 psArray *fringeRef = NULL; // Array of array of fringe statistics for reference --- for each cell49 psArray *fringeSci = NULL; // Array of fringe statistics for science --- for each cell50 if (options->doFringe) {51 fringeRef = psArrayAlloc(chip->cells->n);52 fringeSci = psArrayAlloc(chip->cells->n);53 }54 55 48 while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) { 56 49 psLogMsg ("ppImageLoop", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 57 50 if (!cell->process || !cell->file_exists) { continue; } 58 51 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) return false; 59 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell60 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 name69 psStringAppend(&fringeExt, "FRINGE_%s_%s", chipName, cellName);70 fringeRef->data[view->cell] = pmFringesReadFits(NULL, fringeFile->fits, fringeExt);71 psFree(fringeExt);72 }73 52 74 53 // process each of the readouts … … 80 59 if (!ppImageDetrendReadout (config, options, view)) return false; 81 60 82 if (options->doFringe) {83 ppImageDetrendFringeMeasure((pmFringeStats**)(&fringeSci->data[view->cell]),84 fringeRef->data[view->cell], readout, options);85 }86 61 } 87 62 } 88 63 89 64 // Solve the fringe system 90 pmFringeScale *fringeSoln = NULL; // Solution for the fringes91 65 if (options->doFringe) { 92 fringeSoln = ppImageDetrendFringeSolve(fringeSci, fringeRef, options); 93 psFree(fringeSci); 94 psFree(fringeRef); 66 pmChip *fringe = pmFPAfileThisChip(config->files, view, "PPIMAGE.FRINGE"); 67 if (!ppImageDetrendFringeSolve(chip, fringe, options)) { 68 return false; 69 } 95 70 } 96 71 … … 103 78 if (options->doFringe) { 104 79 psTrace("ppImage", 3, "Applying fringe correction...\n"); 105 bool mdok; // Status of MD lookup 106 pmFPAfile *fringeFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.FRINGE"); 107 pmCell *fringeCell = pmFPAviewThisCell(view, fringeFile->fpa); 108 psImage *fringe = ppImageDetrendFringeGenerate(cell, fringeCell, fringeSoln); 80 pmCell *fringeCell = pmFPAfileThisCell(config->files, view, "PPIMAGE.FRINGE"); 81 psImage *fringe = ppImageDetrendFringeGenerate(cell, fringeCell); 109 82 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 110 83 if (!readout->data_exists) { continue; } … … 125 98 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 126 99 } 127 psFree(fringeSoln);128 100 129 101 ppImageMosaicChip (config, view, "PPIMAGE.OUTPUT.CHIP", "PPIMAGE.OUTPUT"); … … 163 135 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) return false; 164 136 165 psFree (view); 137 psFree(view); 138 166 139 return true; 167 140 }
Note:
See TracChangeset
for help on using the changeset viewer.
