Changeset 9949 for trunk/psModules/src/camera/pmFPAWrite.c
- Timestamp:
- Nov 13, 2006, 12:15:05 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAWrite.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAWrite.c
r9602 r9949 239 239 return true; 240 240 } 241 242 243 244 int pmCellWriteTable(psFits *fits, const pmCell *cell, const char *name) 245 { 246 PS_ASSERT_PTR_NON_NULL(cell, 0); 247 PS_ASSERT_PTR_NON_NULL(fits, 0); 248 PS_ASSERT_STRING_NON_EMPTY(name, 0); 249 250 const char *chipName = psMetadataLookupStr(NULL, cell->parent->concepts, "CHIP.NAME"); // Name of chip 251 const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME"); // Name of cell 252 253 psArray *table = psMetadataLookupPtr(NULL, cell->analysis, name); // The FITS table 254 if (!table) { 255 // We wrote everything we could find 256 return 0; 257 } 258 259 psString headerName = NULL; // Name for header in analysis metadata 260 psStringAppend(&headerName, "%s.HEADER", name); 261 psMetadata *header = psMetadataLookupMetadata(NULL, cell->analysis, headerName); // The FITS header 262 psFree(headerName); 263 264 psString extname = NULL; // Extension name 265 psStringAppend(&extname, "%s_%s_%s", name, chipName, cellName); 266 267 // XXX Could do a table lookup from the camera format, in case the input file isn't laid out with 268 // NAME_CHIP_CELL extension names --- use these as keys, and the value as the proper extension name. 269 // Allow interpolation of concepts, e.g., "{CHIP.NAME}" --> "ccd13". 270 271 if (!psFitsWriteTable(fits, header, table, extname)) { 272 psError(PS_ERR_UNKNOWN, false, "Unable to write table from chip %s, cell %s to extension %s\n", 273 chipName, cellName, extname); 274 psFree(extname); 275 return 0; 276 } 277 278 psFree(extname); 279 return 1; 280 } 281 282 283 int pmChipWriteTable(psFits *fits, const pmChip *chip, const char *name) 284 { 285 PS_ASSERT_PTR_NON_NULL(chip, 0); 286 PS_ASSERT_PTR_NON_NULL(fits, 0); 287 PS_ASSERT_STRING_NON_EMPTY(name, 0); 288 289 int numWrite = 0; // Number of reads 290 psArray *cells = chip->cells; // Array of cells 291 for (int i = 0; i < cells->n; i++) { 292 pmCell *cell = cells->data[i]; // Cell of interest 293 numWrite += pmCellWriteTable(fits, cell, name); 294 } 295 296 return numWrite; 297 } 298 299 300 int pmFPAWriteTable(psFits *fits, const pmFPA *fpa, const char *name) 301 { 302 PS_ASSERT_PTR_NON_NULL(fpa, 0); 303 PS_ASSERT_PTR_NON_NULL(fits, 0); 304 PS_ASSERT_STRING_NON_EMPTY(name, 0); 305 306 int numWrite = 0; // Number of reads 307 psArray *chips = fpa->chips; // Array of chips 308 for (int i = 0; i < chips->n; i++) { 309 pmChip *chip = chips->data[i]; // Chip of interest 310 numWrite += pmChipWriteTable(fits, chip, name); 311 } 312 313 return numWrite; 314 }
Note:
See TracChangeset
for help on using the changeset viewer.
