Changeset 6618 for branches/rel10_ifa/psModules/src/astrom/pmFPARead.c
- Timestamp:
- Mar 16, 2006, 3:47:44 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmFPARead.c
r6582 r6618 137 137 #endif 138 138 139 static bool badRegion(const psRegion *region) 140 { 141 return isnan(region->x0) || isnan(region->x1) || isnan(region->y0) || isnan(region->y1); 142 } 139 143 140 144 // Carve a readout from the image pixels … … 148 152 149 153 // The image corresponding to the trim region 154 if (badRegion(trimsec)) { 155 psString regionString = psRegionToString(*trimsec); 156 psError(PS_ERR_IO, true, "Invalid trim section: %s\n", regionString); 157 psFree(regionString); 158 psFree(readout); 159 return NULL; 160 } 150 161 readout->image = psMemIncrRefCounter(psImageSubset(image, *trimsec)); 151 162 … … 154 165 psRegion *biassec = NULL; // A BIASSEC region from the list 155 166 while ((biassec = psListGetAndIncrement(iter))) { 167 if (badRegion(trimsec)) { 168 psString regionString = psRegionToString(*biassec); 169 psError(PS_ERR_IO, true, "Invalid bias section: %s\n", regionString); 170 psFree(regionString); 171 psFree(readout); 172 return NULL; 173 } 156 174 psImage *overscan = psMemIncrRefCounter(psImageSubset(image, *biassec)); 157 175 psListAdd(readout->bias, PS_LIST_TAIL, overscan); … … 192 210 } 193 211 194 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, NULL);212 pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER, false, NULL); 195 213 196 214 // Having read the cell, we now have to cut it up … … 216 234 ) 217 235 { 236 bool success = false; // Were we able to read at least one HDU? 218 237 psArray *cells = chip->cells; // Array of cells 219 238 for (int i = 0; i < cells->n; i++) { 220 239 pmCell *cell = cells->data[i]; // The cell of interest 221 if (!pmCellRead(cell, fits, db)) { 222 psError(PS_ERR_IO, false, "Unable to read cell %d.\n", i); 223 return false; 224 } 225 pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, NULL); 226 } 227 228 return true; 240 success |= pmCellRead(cell, fits, db); 241 } 242 if (success) { 243 pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, false, NULL); 244 } 245 246 return success; 229 247 } 230 248 … … 235 253 ) 236 254 { 237 psArray *chips = fpa->chips; // Array of chips 255 bool success = false; // Were we able to read at least one HDU? 256 psArray *chips = fpa->chips; // Array of chips 238 257 for (int i = 0; i < chips->n; i++) { 239 258 pmChip *chip = chips->data[i]; // The cell of interest 240 if (!pmChipRead(chip, fits, db)) { 241 psError(PS_ERR_IO, false, "Unable to read chip %d.\n", i); 242 return false; 243 } 259 success |= pmChipRead(chip, fits, db); 260 } 261 if (success) { 244 262 pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL); 245 } 246 247 return true; 263 } else { 264 psLogMsg(__func__, PS_LOG_WARN, "Unable to read any chips in FPA.\n"); 265 } 266 267 return success; 248 268 } 249 269
Note:
See TracChangeset
for help on using the changeset viewer.
