Changeset 27086 for trunk/psModules/src/imcombine/pmSubtractionIO.c
- Timestamp:
- Feb 25, 2010, 12:33:42 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmSubtractionIO.c (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmSubtractionIO.c
r26893 r27086 3 3 #include <string.h> 4 4 5 #include "pmErrorCodes.h" 5 6 #include "pmHDU.h" 6 7 #include "pmHDUUtils.h" … … 66 67 } 67 68 if (regions->n == 0) { 68 psError(P S_ERR_BAD_PARAMETER_VALUE, true, "No subtraction regions found.");69 psError(PM_ERR_PROG, true, "No subtraction regions found."); 69 70 psFree(regions); 70 71 return false; … … 87 88 88 89 if (regions->n != kernels->n) { 89 psError(P S_ERR_BAD_PARAMETER_SIZE, true, "Number of regions (%ld) and kernels (%ld) don't match.\n",90 psError(PM_ERR_PROG, true, "Number of regions (%ld) and kernels (%ld) don't match.\n", 90 91 regions->n, kernels->n); 91 92 psFree(regions); … … 165 166 166 167 if (!psFitsWriteTable(fits, header, rows, EXTNAME_KERNEL)) { 167 psError( PS_ERR_IO, false, "Unable to write subtraction kernel to FITS table.");168 psError(psErrorCodeLast(), false, "Unable to write subtraction kernel to FITS table."); 168 169 psFree(header); 169 170 psFree(rows); … … 175 176 176 177 if (image && !psFitsWriteImage(fits, header, image, 0, EXTNAME_IMAGE)) { 177 psError( PS_ERR_IO, false, "Unable to write subtraction kernel image.");178 psError(psErrorCodeLast(), false, "Unable to write subtraction kernel image."); 178 179 psFree(header); 179 180 psFree(rows); … … 201 202 thisView->readout = i; 202 203 if (!pmReadoutWriteSubtractionKernels(readout, file->fits)) { 203 psError( PS_ERR_IO, false, "Failed to write %dth readout", i);204 psError(psErrorCodeLast(), false, "Failed to write %dth readout", i); 204 205 psFree(thisView); 205 206 return false; … … 224 225 thisView->cell = i; 225 226 if (!pmCellWriteSubtractionKernels(cell, thisView, file, config)) { 226 psError( PS_ERR_IO, false, "Failed to write %dth cell", i);227 psError(psErrorCodeLast(), false, "Failed to write %dth cell", i); 227 228 psFree(thisView); 228 229 return false; … … 247 248 thisView->chip = i; 248 249 if (!pmChipWriteSubtractionKernels(chip, thisView, file, config)) { 249 psError( PS_ERR_IO, false, "Failed to write %dth chip", i);250 psError(psErrorCodeLast(), false, "Failed to write %dth chip", i); 250 251 psFree(thisView); 251 252 return false; … … 265 266 266 267 if (!psFitsMoveExtName(fits, EXTNAME_KERNEL)) { 267 psError( PS_ERR_IO, false, "Unable to move to subtraction kernel table.");268 psError(psErrorCodeLast(), false, "Unable to move to subtraction kernel table."); 268 269 return false; 269 270 } … … 271 272 psArray *table = psFitsReadTable(fits); // Table of interest 272 273 if (!table) { 273 psError( PS_ERR_IO, false, "Unable to read FITS table");274 psError(psErrorCodeLast(), false, "Unable to read FITS table"); 274 275 return false; 275 276 } … … 282 283 TARGET = psMetadataLookup##SUFFIX(&mdok, row, NAME); \ 283 284 if (!mdok) { \ 284 psError(P S_ERR_UNKNOWN, false, "Unable to find column %s in subtraction kernel table.", NAME); \285 psError(PM_ERR_PROG, false, "Unable to find column %s in subtraction kernel table.", NAME); \ 285 286 psFree(table); \ 286 287 return false; \ … … 325 326 kernels->solution1 = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, row, NAME_SOL1)); 326 327 if (!mdok) { 327 psError(P S_ERR_UNKNOWN, false, "Unable to find column %s in subtraction kernel table.",328 psError(PM_ERR_PROG, false, "Unable to find column %s in subtraction kernel table.", 328 329 NAME_SOL1); 329 330 psFree(kernels); … … 335 336 kernels->solution1 = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, row, NAME_SOL1)); 336 337 if (!mdok) { 337 psError(P S_ERR_UNKNOWN, false, "Unable to find column %s in subtraction kernel table.",338 psError(PM_ERR_PROG, false, "Unable to find column %s in subtraction kernel table.", 338 339 NAME_SOL1); 339 340 psFree(kernels); … … 343 344 kernels->solution2 = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, row, NAME_SOL2)); 344 345 if (!mdok) { 345 psError(P S_ERR_UNKNOWN, false, "Unable to find column %s in subtraction kernel table.",346 psError(PM_ERR_PROG, false, "Unable to find column %s in subtraction kernel table.", 346 347 NAME_SOL2); 347 348 psFree(kernels); … … 379 380 pmReadout *readout = cell->readouts->data[i]; 380 381 thisView->readout = i; 381 pmReadoutReadSubtractionKernels(readout, file->fits); 382 if (!pmReadoutReadSubtractionKernels(readout, file->fits)) { 383 psError(psErrorCodeLast(), false, "Unable to read subtraction kernels from cell"); 384 psFree(thisView); 385 return false; 386 } 382 387 if (!readout->data_exists) { 383 388 continue; … … 410 415 pmCell *cell = chip->cells->data[i]; 411 416 thisView->cell = i; 412 pmCellReadSubtractionKernels(cell, thisView, file, config); 413 if (!cell->data_exists) { 417 if (!pmCellReadSubtractionKernels(cell, thisView, file, config)) { 418 psError(psErrorCodeLast(), false, "Unable to read subtraction kernels from cell"); 419 psFree(thisView); 420 return false; 421 } 422 if (!cell->data_exists) { 414 423 continue; 415 424 } … … 419 428 420 429 if (!pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, true, true, NULL)) { 421 psError( PS_ERR_IO, false, "Failed to read concepts for chip.\n");430 psError(psErrorCodeLast(), false, "Failed to read concepts for chip.\n"); 422 431 return false; 423 432 } … … 440 449 pmChip *chip = fpa->chips->data[i]; 441 450 thisView->chip = i; 442 pmChipReadSubtractionKernels(chip, thisView, file, config); 451 if (!pmChipReadSubtractionKernels(chip, thisView, file, config)) { 452 psError(psErrorCodeLast(), false, "Unable to read subtraction kernels from chip"); 453 psFree(thisView); 454 return false; 455 } 443 456 } 444 457 psFree(thisView); 445 458 446 459 if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, true, NULL)) { 447 psError( PS_ERR_IO, false, "Failed to read concepts for fpa.\n");460 psError(psErrorCodeLast(), false, "Failed to read concepts for fpa.\n"); 448 461 return false; 449 462 } … … 464 477 if (view->chip == -1) { 465 478 if (!pmFPAWriteSubtractionKernels(fpa, view, file, config)) { 466 psError( PS_ERR_IO, false, "Failed to write subtraction kernels from fpa");479 psError(psErrorCodeLast(), false, "Failed to write subtraction kernels from fpa"); 467 480 psFree(fpa); 468 481 return false; … … 473 486 474 487 if (view->chip >= fpa->chips->n) { 475 psError(P S_ERR_UNKNOWN, false, "Writing chip == %d (>= chips->n == %ld)", view->chip, fpa->chips->n);488 psError(PM_ERR_PROG, true, "Writing chip == %d (>= chips->n == %ld)", view->chip, fpa->chips->n); 476 489 psFree(fpa); 477 490 return false; … … 481 494 if (view->cell == -1) { 482 495 if (!pmChipWriteSubtractionKernels(chip, view, file, config)) { 483 psError( PS_ERR_IO, false, "Failed to write objects from chip");496 psError(psErrorCodeLast(), false, "Failed to write objects from chip"); 484 497 psFree(fpa); 485 498 return false; … … 490 503 491 504 if (view->cell >= chip->cells->n) { 492 psError(P S_ERR_UNKNOWN, false, "Writing cell == %d (>= cells->n == %ld)",505 psError(PM_ERR_PROG, true, "Writing cell == %d (>= cells->n == %ld)", 493 506 view->cell, chip->cells->n); 494 507 psFree(fpa); … … 499 512 if (view->readout == -1) { 500 513 if (!pmCellWriteSubtractionKernels(cell, view, file, config)) { 501 psError( PS_ERR_IO, false, "Failed to write objects from cell");514 psError(psErrorCodeLast(), false, "Failed to write objects from cell"); 502 515 psFree(fpa); 503 516 return false; … … 508 521 509 522 if (view->readout >= cell->readouts->n) { 510 psError(P S_ERR_UNKNOWN, false, "Writing readout == %d (>= readouts->n == %ld)",523 psError(PM_ERR_PROG, true, "Writing readout == %d (>= readouts->n == %ld)", 511 524 view->readout, cell->readouts->n); 512 525 psFree(fpa); … … 516 529 517 530 if (!pmReadoutWriteSubtractionKernels(readout, file->fits)) { 518 psError( PS_ERR_IO, false, "Failed to write objects from readout %d", view->readout);531 psError(psErrorCodeLast(), false, "Failed to write objects from readout %d", view->readout); 519 532 psFree(fpa); 520 533 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
