Changeset 13414 for trunk/psModules/src/objects/pmPSF_IO.c
- Timestamp:
- May 17, 2007, 2:17:12 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmPSF_IO.c (modified) (33 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmPSF_IO.c
r13212 r13414 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-05- 04 00:53:15$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-05-18 00:17:12 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 49 49 50 50 if (view->chip == -1) { 51 bool exists = pmFPACheckDataStatusForPSFmodel (fpa);51 bool exists = pmFPACheckDataStatusForPSFmodel (fpa); 52 52 return exists; 53 53 } 54 54 if (view->chip >= fpa->chips->n) { 55 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n);55 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 56 56 return false; 57 57 } … … 63 63 } 64 64 if (view->cell >= chip->cells->n) { 65 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n);65 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 66 66 return false; 67 67 } … … 74 74 75 75 if (view->readout >= cell->readouts->n) { 76 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n);76 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 77 77 return false; 78 78 } 79 79 pmReadout *readout = cell->readouts->data[view->readout]; 80 80 81 bool exists = pmReadoutCheckDataStatusForPSFmodel (readout); 82 return exists; 81 return pmReadoutCheckDataStatusForPSFmodel (readout); 83 82 } 84 83 … … 86 85 87 86 for (int i = 0; i < fpa->chips->n; i++) { 88 pmChip *chip = fpa->chips->data[i];89 if (!chip) continue;90 if (pmChipCheckDataStatusForPSFmodel (chip)) return true;87 pmChip *chip = fpa->chips->data[i]; 88 if (!chip) continue; 89 if (pmChipCheckDataStatusForPSFmodel (chip)) return true; 91 90 } 92 91 return false; … … 96 95 97 96 for (int i = 0; i < chip->cells->n; i++) { 98 pmCell *cell = chip->cells->data[i];99 if (!cell) continue;100 if (pmCellCheckDataStatusForPSFmodel (cell)) return true;97 pmCell *cell = chip->cells->data[i]; 98 if (!cell) continue; 99 if (pmCellCheckDataStatusForPSFmodel (cell)) return true; 101 100 } 102 101 return false; … … 106 105 107 106 for (int i = 0; i < cell->readouts->n; i++) { 108 pmReadout *readout = cell->readouts->data[i];109 if (!readout) continue;110 if (pmReadoutCheckDataStatusForPSFmodel (readout)) return true;107 pmReadout *readout = cell->readouts->data[i]; 108 if (!readout) continue; 109 if (pmReadoutCheckDataStatusForPSFmodel (readout)) return true; 111 110 } 112 111 return false; … … 118 117 119 118 // select the psf of interest 120 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 121 if (!psf) return false; 122 return true; 119 pmPSF *psf = psMetadataLookupPtr(&status, readout->analysis, "PSPHOT.PSF"); 120 return psf ? true : false; 123 121 } 124 122 … … 129 127 130 128 if (view->chip == -1) { 131 if (!pmFPAWritePSFmodel (fpa, view, file, config)) {129 if (!pmFPAWritePSFmodel(fpa, view, file, config)) { 132 130 psError(PS_ERR_IO, false, "Failed to write PSF for fpa"); 133 131 return false; … … 168 166 169 167 if (!pmReadoutWritePSFmodel (readout, view, file, config)) { 170 psError(PS_ERR_IO, false, "Failed to write PSF for readout");171 return false;168 psError(PS_ERR_IO, false, "Failed to write PSF for readout"); 169 return false; 172 170 } 173 171 return true; … … 179 177 180 178 for (int i = 0; i < fpa->chips->n; i++) { 181 182 179 pmChip *chip = fpa->chips->data[i]; 183 180 if (!pmChipWritePSFmodel (chip, view, file, config)) { … … 192 189 bool pmChipWritePSFmodel (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 193 190 { 194 195 191 for (int i = 0; i < chip->cells->n; i++) { 196 197 192 pmCell *cell = chip->cells->data[i]; 198 193 if (!pmCellWritePSFmodel (cell, view, file, config)) { … … 207 202 bool pmCellWritePSFmodel (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 208 203 { 209 210 204 for (int i = 0; i < cell->readouts->n; i++) { 211 212 205 pmReadout *readout = cell->readouts->data[i]; 213 206 if (!pmReadoutWritePSFmodel (readout, view, file, config)) { … … 219 212 } 220 213 221 // for each Readout (ie, analysed image), we write out: header + table with PSF model parameters, 214 // for each Readout (ie, analysed image), we write out: header + table with PSF model parameters, 222 215 // and header + image for the PSF residual images 223 216 bool pmReadoutWritePSFmodel (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) … … 228 221 pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF"); 229 222 if (!psf) { 230 psError(PS_ERR_UNKNOWN, true, "missing PSF for this readout");231 return false;223 psError(PS_ERR_UNKNOWN, true, "missing PSF for this readout"); 224 return false; 232 225 } 233 226 … … 238 231 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 239 232 if (!menu) { 240 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");241 return false;233 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 234 return false; 242 235 } 243 236 // EXTNAME for table data 244 237 rule = psMetadataLookupStr(&status, menu, "PSF.TABLE"); 245 238 if (!rule) { 246 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.TABLE in EXTNAME.RULES in camera.config");247 return false;239 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.TABLE in EXTNAME.RULES in camera.config"); 240 return false; 248 241 } 249 242 char *tableName = pmFPAfileNameFromRule (rule, file, view); … … 251 244 // write the PSF model parameters in a FITS table 252 245 253 // we need to write a header for the table, 246 // we need to write a header for the table, 254 247 psMetadata *header = psMetadataAlloc(); 255 248 … … 264 257 // save the dimensions of each parameter 265 258 for (int i = 0; i < nPar; i++) { 266 char name[9];259 char name[9]; 267 260 psPolynomial2D *poly = psf->params_NEW->data[i]; 268 261 if (poly == NULL) continue; 269 snprintf (name, 9, "PAR%02d_NX", i);262 snprintf (name, 9, "PAR%02d_NX", i); 270 263 psMetadataAddS32 (header, PS_LIST_TAIL, name, 0, "", poly->nX); 271 snprintf (name, 9, "PAR%02d_NY", i);264 snprintf (name, 9, "PAR%02d_NY", i); 272 265 psMetadataAddS32 (header, PS_LIST_TAIL, name, 0, "", poly->nY); 273 266 } … … 287 280 psPolynomial2D *poly = psf->params_NEW->data[i]; 288 281 if (poly == NULL) continue; // skip unset parameters (eg, XPOS) 289 for (int ix = 0; ix < poly->nX; ix++) {290 for (int iy = 0; iy < poly->nY; iy++) {291 292 psMetadata *row = psMetadataAlloc ();293 psMetadataAddS32 (row, PS_LIST_TAIL, "MODEL_TERM", 0, "", i);294 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix);295 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy);296 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]);297 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]);298 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->mask[ix][iy]);299 300 psArrayAdd (psfTable, 100, row);301 psFree (row);302 }303 }304 } 305 282 for (int ix = 0; ix < poly->nX; ix++) { 283 for (int iy = 0; iy < poly->nY; iy++) { 284 285 psMetadata *row = psMetadataAlloc (); 286 psMetadataAddS32 (row, PS_LIST_TAIL, "MODEL_TERM", 0, "", i); 287 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 288 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 289 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]); 290 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]); 291 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->mask[ix][iy]); 292 293 psArrayAdd (psfTable, 100, row); 294 psFree (row); 295 } 296 } 297 } 298 306 299 // write an empty FITS segment if we have no PSF information 307 300 if (psfTable->n == 0) { 308 // XXX this is probably an error (if we have a PSF, how do we have no data?)301 // XXX this is probably an error (if we have a PSF, how do we have no data?) 309 302 psFitsWriteBlank (file->fits, header, tableName); 310 303 } else { 311 psTrace ("pmFPAfile", 5, "writing psf data %s\n", tableName);312 if (!psFitsWriteTable (file->fits, header, psfTable, tableName)) {313 psError(PS_ERR_IO, false, "writing psf table data %s\n", tableName);314 psFree (tableName);315 psFree (psfTable);316 psFree (header);317 return false;318 }304 psTrace ("pmFPAfile", 5, "writing psf data %s\n", tableName); 305 if (!psFitsWriteTable (file->fits, header, psfTable, tableName)) { 306 psError(PS_ERR_IO, false, "writing psf table data %s\n", tableName); 307 psFree (tableName); 308 psFree (psfTable); 309 psFree (header); 310 return false; 311 } 319 312 } 320 313 psFree (tableName); … … 325 318 rule = psMetadataLookupStr(&status, menu, "PSF.RESID"); 326 319 if (!rule) { 327 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.RESID in EXTNAME.RULES in camera.config");328 return false;320 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.RESID in EXTNAME.RULES in camera.config"); 321 return false; 329 322 } 330 323 char *imageName = pmFPAfileNameFromRule (rule, file, view); 331 324 332 // write the residual images (3D) 325 // write the residual images (3D) 333 326 header = psMetadataAlloc (); 334 327 if (psf->residuals == NULL) { 335 // set some header keywords to make it clear there are no residuals?328 // set some header keywords to make it clear there are no residuals? 336 329 psFitsWriteBlank (file->fits, header, imageName); 337 psFree (imageName);330 psFree (imageName); 338 331 psFree (header); 339 332 return true; … … 348 341 // this call creates an extension with NAXIS3 = 3 349 342 if (psf->residuals->Rx) { 350 // this call creates an extension with NAXIS3 = 3351 psArray *images = psArrayAllocEmpty (3);352 psArrayAdd (images, 1, psf->residuals->Ro);353 psArrayAdd (images, 1, psf->residuals->Rx);354 psArrayAdd (images, 1, psf->residuals->Ry);355 356 psFitsWriteImageCube (file->fits, header, images, imageName);357 psFree (images);343 // this call creates an extension with NAXIS3 = 3 344 psArray *images = psArrayAllocEmpty (3); 345 psArrayAdd (images, 1, psf->residuals->Ro); 346 psArrayAdd (images, 1, psf->residuals->Rx); 347 psArrayAdd (images, 1, psf->residuals->Ry); 348 349 psFitsWriteImageCube (file->fits, header, images, imageName); 350 psFree (images); 358 351 } else { 359 // this call creates an extension with NAXIS3 = 1360 psFitsWriteImage(file->fits, header, psf->residuals->Ro, 0, imageName);361 } 362 352 // this call creates an extension with NAXIS3 = 1 353 psFitsWriteImage(file->fits, header, psf->residuals->Ro, 0, imageName); 354 } 355 363 356 psFree (imageName); 364 357 psFree (header); … … 373 366 psPolynomial4D *poly = psf->ApTrend; 374 367 for (int ix = 0; ix < poly->nX; ix++) { 375 for (int iy = 0; iy < poly->nY; iy++) {376 377 row = psMetadataAlloc ();378 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix);379 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy);380 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]);381 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]);382 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->mask[ix][iy]);383 384 psArrayAdd (psfTable, 100, row);385 psFree (row);386 }368 for (int iy = 0; iy < poly->nY; iy++) { 369 370 row = psMetadataAlloc (); 371 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 372 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 373 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]); 374 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]); 375 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->mask[ix][iy]); 376 377 psArrayAdd (psfTable, 100, row); 378 psFree (row); 379 } 387 380 } 388 381 # endif 389 382 } 390 383 391 // XXX add in error handling392 384 bool pmFPAviewReadPSFmodel (const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 393 385 { … … 396 388 397 389 if (view->chip == -1) { 398 pmFPAReadPSFmodel (fpa, view, file, config); 399 return true; 390 return pmFPAReadPSFmodel(fpa, view, file, config); 400 391 } 401 392 402 393 if (view->chip >= fpa->chips->n) { 403 return false;394 psAbort("Programming error: view does not apply to FPA."); 404 395 } 405 396 pmChip *chip = fpa->chips->data[view->chip]; 406 397 407 398 if (view->cell == -1) { 408 pmChipReadPSFmodel (chip, view, file, config); 409 return true; 399 return pmChipReadPSFmodel(chip, view, file, config); 410 400 } 411 401 412 402 if (view->cell >= chip->cells->n) { 413 return false;403 psAbort("Programming error: view does not apply to FPA."); 414 404 } 415 405 pmCell *cell = chip->cells->data[view->cell]; 416 406 417 407 if (view->readout == -1) { 418 pmCellReadPSFmodel (cell, view, file, config); 419 return true; 408 return pmCellReadPSFmodel(cell, view, file, config); 420 409 } 421 410 422 411 if (view->readout >= cell->readouts->n) { 423 return false;412 psAbort("Programming error: view does not apply to FPA."); 424 413 } 425 414 pmReadout *readout = cell->readouts->data[view->readout]; 426 415 427 pmReadoutReadPSFmodel (readout, view, file, config); 428 return true; 416 return pmReadoutReadPSFmodel(readout, view, file, config); 429 417 } 430 418 … … 432 420 bool pmFPAReadPSFmodel (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 433 421 { 434 422 bool success = true; // Was everything successful? 435 423 for (int i = 0; i < fpa->chips->n; i++) { 436 437 424 pmChip *chip = fpa->chips->data[i]; 438 pmChipReadPSFmodel(chip, view, file, config);439 } 440 return true;425 success &= pmChipReadPSFmodel(chip, view, file, config); 426 } 427 return success; 441 428 } 442 429 … … 444 431 bool pmChipReadPSFmodel (pmChip *chip, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 445 432 { 446 433 bool success = true; // Was everything successful? 447 434 for (int i = 0; i < chip->cells->n; i++) { 448 449 435 pmCell *cell = chip->cells->data[i]; 450 pmCellReadPSFmodel (cell, view, file, config);451 } 452 return true;436 success &= pmCellReadPSFmodel (cell, view, file, config); 437 } 438 return success; 453 439 } 454 440 … … 456 442 bool pmCellReadPSFmodel (pmCell *cell, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 457 443 { 458 444 bool success = true; // Was everything successful? 459 445 for (int i = 0; i < cell->readouts->n; i++) { 460 461 446 pmReadout *readout = cell->readouts->data[i]; 462 pmReadoutReadPSFmodel(readout, view, file, config);463 } 464 return true;465 } 466 467 // for each Readout (ie, analysed image), we write out: header + table with PSF model parameters, 447 success &= pmReadoutReadPSFmodel(readout, view, file, config); 448 } 449 return success; 450 } 451 452 // for each Readout (ie, analysed image), we write out: header + table with PSF model parameters, 468 453 // and header + image for the PSF residual images 469 bool pmReadoutReadPSFmodel (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config)470 { 471 bool status; 454 bool pmReadoutReadPSFmodel(pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) 455 { 456 bool status; 472 457 char *rule = NULL; 473 458 psMetadata *header = NULL; … … 476 461 psMetadata *menu = psMetadataLookupMetadata(&status, file->camera, "EXTNAME.RULES"); 477 462 if (!menu) { 478 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config");479 return false;463 psError(PS_ERR_UNKNOWN, true, "missing EXTNAME.RULES in camera.config"); 464 return false; 480 465 } 481 466 // EXTNAME for table data 482 467 rule = psMetadataLookupStr(&status, menu, "PSF.TABLE"); 483 468 if (!rule) { 484 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.TABLE in EXTNAME.RULES in camera.config");485 return false;469 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.TABLE in EXTNAME.RULES in camera.config"); 470 return false; 486 471 } 487 472 char *tableName = pmFPAfileNameFromRule (rule, file, view); … … 489 474 rule = psMetadataLookupStr(&status, menu, "PSF.RESID"); 490 475 if (!rule) { 491 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.RESID in EXTNAME.RULES in camera.config");492 return false;476 psError(PS_ERR_UNKNOWN, true, "missing entry for PSF.RESID in EXTNAME.RULES in camera.config"); 477 return false; 493 478 } 494 479 char *imageName = pmFPAfileNameFromRule (rule, file, view); … … 498 483 // since we have read the IMAGE header, the TABLE header should exist 499 484 if (!psFitsMoveExtName (file->fits, tableName)) { 500 psAbort("cannot find data extension %s in %s", tableName, file->filename);485 psAbort("cannot find data extension %s in %s", tableName, file->filename); 501 486 } 502 487 … … 521 506 // load the dimensions of each parameter 522 507 for (int i = 0; i < nPar; i++) { 523 char name[9];524 snprintf (name, 9, "PAR%02d_NX", i);508 char name[9]; 509 snprintf (name, 9, "PAR%02d_NX", i); 525 510 int nXorder = psMetadataLookupS32 (&status, header, name); 526 snprintf (name, 9, "PAR%02d_NY", i);511 snprintf (name, 9, "PAR%02d_NY", i); 527 512 int nYorder = psMetadataLookupS32 (&status, header, name); 528 psf->params_NEW->data[i] = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, nXorder, nYorder);513 psf->params_NEW->data[i] = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, nXorder, nYorder); 529 514 } 530 515 … … 543 528 // fill in the matching psf->params entries 544 529 for (int i = 0; i > table->n; i++) { 545 psMetadata *row = table->data[i];546 int iPar = psMetadataLookupS32 (&status, row, "MODEL_TERM");547 int xPow = psMetadataLookupS32 (&status, row, "X_POWER");548 int yPow = psMetadataLookupS32 (&status, row, "Y_POWER");549 // XXX sanity check here530 psMetadata *row = table->data[i]; 531 int iPar = psMetadataLookupS32 (&status, row, "MODEL_TERM"); 532 int xPow = psMetadataLookupS32 (&status, row, "X_POWER"); 533 int yPow = psMetadataLookupS32 (&status, row, "Y_POWER"); 534 // XXX sanity check here 550 535 551 536 psPolynomial2D *poly = psf->params_NEW->data[iPar]; 552 537 553 poly->coeff[xPow][yPow] = psMetadataLookupF32 (&status, row, "VALUE");554 poly->coeffErr[xPow][yPow] = psMetadataLookupF32 (&status, row, "ERROR");555 poly->mask[xPow][yPow] = psMetadataLookupU8 (&status, row, "MASK");538 poly->coeff[xPow][yPow] = psMetadataLookupF32 (&status, row, "VALUE"); 539 poly->coeffErr[xPow][yPow] = psMetadataLookupF32 (&status, row, "ERROR"); 540 poly->mask[xPow][yPow] = psMetadataLookupU8 (&status, row, "MASK"); 556 541 } 557 542 psFree (header); … … 562 547 // since we have read the IMAGE header, the TABLE header should exist 563 548 if (!psFitsMoveExtName (file->fits, imageName)) { 564 psAbort("cannot find data extension %s in %s", imageName, file->filename);549 psAbort("cannot find data extension %s in %s", imageName, file->filename); 565 550 } 566 551 … … 569 554 if (Naxis != 0) { 570 555 571 int Nx = psMetadataLookupS32 (&status, header, "NAXIS1");572 int Ny = psMetadataLookupS32 (&status, header, "NAXIS2");573 int Nz = psMetadataLookupS32 (&status, header, "NAXIS3");574 575 int xBin = psMetadataLookupS32 (&status, header, "XBIN");576 int yBin = psMetadataLookupS32 (&status, header, "YBIN");577 578 int xSize = Nx / xBin;579 int ySize = Ny / yBin;580 581 psf->residuals = pmResidualsAlloc (xSize, ySize, xBin, yBin);582 583 psf->residuals->xCenter = psMetadataLookupS32 (&status, header, "XCENTER");584 psf->residuals->yCenter = psMetadataLookupS32 (&status, header, "YCENTER");585 586 psRegion fullImage = {0, 0, 0, 0};587 psFitsReadImageBuffer(psf->residuals->Ro, file->fits, fullImage, 0); // Desired pixels588 if (Nz > 1) {589 assert (Nz == 3);590 psFitsReadImageBuffer(psf->residuals->Rx, file->fits, fullImage, 1); // Desired pixels591 psFitsReadImageBuffer(psf->residuals->Ry, file->fits, fullImage, 2); // Desired pixels592 }556 int Nx = psMetadataLookupS32 (&status, header, "NAXIS1"); 557 int Ny = psMetadataLookupS32 (&status, header, "NAXIS2"); 558 int Nz = psMetadataLookupS32 (&status, header, "NAXIS3"); 559 560 int xBin = psMetadataLookupS32 (&status, header, "XBIN"); 561 int yBin = psMetadataLookupS32 (&status, header, "YBIN"); 562 563 int xSize = Nx / xBin; 564 int ySize = Ny / yBin; 565 566 psf->residuals = pmResidualsAlloc (xSize, ySize, xBin, yBin); 567 568 psf->residuals->xCenter = psMetadataLookupS32 (&status, header, "XCENTER"); 569 psf->residuals->yCenter = psMetadataLookupS32 (&status, header, "YCENTER"); 570 571 psRegion fullImage = {0, 0, 0, 0}; 572 psFitsReadImageBuffer(psf->residuals->Ro, file->fits, fullImage, 0); // Desired pixels 573 if (Nz > 1) { 574 assert (Nz == 3); 575 psFitsReadImageBuffer(psf->residuals->Rx, file->fits, fullImage, 1); // Desired pixels 576 psFitsReadImageBuffer(psf->residuals->Ry, file->fits, fullImage, 2); // Desired pixels 577 } 593 578 } 594 579
Note:
See TracChangeset
for help on using the changeset viewer.
