Changeset 26847 for branches/eam_branches/20091201/psModules
- Timestamp:
- Feb 10, 2010, 3:02:06 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/psModules/src/detrend
- Files:
-
- 2 edited
-
pmPattern.c (modified) (4 diffs)
-
pmPatternIO.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psModules/src/detrend/pmPattern.c
r26845 r26847 87 87 88 88 psImage *corr = psImageAlloc(order + 1, numRows, PS_TYPE_F64); // Corrections applied 89 psImageInit(corr, NAN); 89 90 90 91 for (int y = 0; y < numRows; y++) { … … 113 114 } 114 115 116 poly->coeff[0] -= background; 115 117 memcpy(corr->data.F64[y], poly->coeff, (order + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F64)); 116 corr->data.F64[y][0] -= background;117 118 118 psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector 119 119 if (!solution) { … … 125 125 126 126 for (int x = 0; x < numCols; x++) { 127 image->data.F32[y][x] += (background - solution->data.F32[x]);127 image->data.F32[y][x] -= solution->data.F32[x]; 128 128 } 129 129 psFree(solution); … … 174 174 175 175 for (int y = 0; y < numRows; y++) { 176 memcpy(poly->coeff, corr->data.F64[y], order* PSELEMTYPE_SIZEOF(PS_TYPE_F64));176 memcpy(poly->coeff, corr->data.F64[y], (order + 1) * PSELEMTYPE_SIZEOF(PS_TYPE_F64)); 177 177 psVector *solution = psPolynomial1DEvalVector(poly, indices); // Solution vector 178 178 if (!solution) { -
branches/eam_branches/20091201/psModules/src/detrend/pmPatternIO.c
r26843 r26847 9 9 #include "pmFPAfile.h" 10 10 #include "pmFPAfileFitsIO.h" 11 #include "pmFPAHeader.h" 11 12 #include "pmConceptsRead.h" 13 #include "pmConceptsWrite.h" 12 14 13 15 #include "pmPattern.h" … … 24 26 psImage *rowCorr = psMetadataLookupPtr(&gotRow, ro->analysis, PM_PATTERN_ROW_CORRECTION); // Row correction 25 27 float cellCorr = psMetadataLookupF32(&gotCell, ro->analysis, PM_PATTERN_CELL_CORRECTION); // Cell corr. 26 if (!gotRow && !gotCell) {27 // Nothing to write28 return true;29 }30 28 31 29 pmCell *cell = ro->parent; // Cell of interest … … 73 71 PS_ASSERT_PTR_NON_NULL(cell->readouts, false); 74 72 PS_ASSERT_PTR_NON_NULL(view, false); 73 74 if (!pmConceptsWriteCell(cell, true, config)) { 75 psError(PS_ERR_IO, false, "Unable to write concepts for cell."); 76 return false; 77 } 75 78 76 79 pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view … … 97 100 PS_ASSERT_PTR_NON_NULL(view, false); 98 101 102 if (!pmConceptsWriteChip(chip, true, true, config)) { 103 psError(PS_ERR_IO, false, "Unable to write concepts for chip.\n"); 104 return false; 105 } 106 99 107 pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view 100 108 *thisView = *view; … … 120 128 PS_ASSERT_PTR_NON_NULL(fpa->chips, false); 121 129 130 if (!pmConceptsWriteFPA(fpa, true, config)) { 131 psError(PS_ERR_IO, false, "Unable to write concepts for FPA.\n"); 132 return false; 133 } 134 122 135 pmFPAview *thisView = pmFPAviewAlloc(view->nRows); // Copy of input view 123 136 *thisView = *view; … … 168 181 } 169 182 170 bool data = false; // Did we find any data?183 bool data = true; // Did we find any data? 171 184 172 185 psMetadataItem *cellCorr = psMetadataLookup(header, PM_PATTERN_CELL_CORRECTION); // Cell pattern correction … … 216 229 pmReadout *readout = cell->readouts->data[i]; 217 230 thisView->readout = i; 218 pmReadoutReadPattern(readout, file->fits); 219 if (!readout->data_exists) { 220 continue; 221 } 222 #if 0 223 // load in the concept information for this cell 224 if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) { 225 psErrorClear(); 226 psWarning("Difficulty reading concepts for cell; attempting to proceed."); 227 } 228 #endif 229 cell->data_exists = true; 230 } 231 psFree(thisView); 231 if (!pmReadoutReadPattern(readout, file->fits)) { 232 psError(PS_ERR_IO, false, "Unable to read pattern correction."); 233 return false; 234 } 235 } 236 psFree(thisView); 237 238 if (!pmCellReadHeader(cell, file->fits, config)) { 239 psError(PS_ERR_IO, false, "Unable to read header for cell."); 240 return false; 241 } 242 // load in the concept information for this cell 243 if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, true, NULL)) { 244 psErrorClear(); 245 psWarning("Difficulty reading concepts for cell; attempting to proceed."); 246 } 232 247 233 248 return true; … … 256 271 psFree(thisView); 257 272 258 #if 0 273 if (!pmChipReadHeader(chip, file->fits, config)) { 274 psError(PS_ERR_IO, false, "Unable to read header for cell."); 275 return false; 276 } 259 277 if (!pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, true, true, NULL)) { 260 278 psError(PS_ERR_IO, false, "Failed to read concepts for chip.\n"); 261 279 return false; 262 280 } 263 #endif264 281 265 282 return true; … … 284 301 psFree(thisView); 285 302 286 #if 0 303 if (!pmFPAReadHeader(fpa, file->fits, config)) { 304 psError(PS_ERR_IO, false, "Unable to read header for cell."); 305 return false; 306 } 287 307 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, true, NULL)) { 288 308 psError(PS_ERR_IO, false, "Failed to read concepts for fpa.\n"); 289 309 return false; 290 310 } 291 #endif292 311 293 312 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
