Changeset 6205 for trunk/psModules/src
- Timestamp:
- Jan 26, 2006, 11:10:51 AM (21 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 7 edited
-
astrom/Makefile.am (modified) (1 diff)
-
astrom/pmAstrometry.c (modified) (8 diffs)
-
astrom/pmAstrometry.h (modified) (7 diffs)
-
astrom/pmAstrometryObjects.h (modified) (2 diffs)
-
imcombine/pmReadoutCombine.c (modified) (2 diffs)
-
imcombine/pmReadoutCombine.h (modified) (2 diffs)
-
imsubtract/pmSubtractBias.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/Makefile.am
r5674 r6205 5 5 libpsmoduleastrom_la_SOURCES = \ 6 6 pmAstrometry.c \ 7 pmFPAConstruct.c \ 7 8 pmAstrometryObjects.c 8 9 9 10 psmoduleincludedir = $(includedir) 10 11 psmoduleinclude_HEADERS = \ 11 pmAstrometry.h \ 12 pmAstrometryObjects.h 12 pmAstrometry.h \ 13 pmFPAConstruct.h \ 14 pmAstrometryObjects.h -
trunk/psModules/src/astrom/pmAstrometry.c
r5739 r6205 13 13 * XXX: Should we implement non-linear cell->chip transforms? 14 14 * 15 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $16 * @date $Date: 200 5-12-08 00:00:57$15 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-01-26 21:10:50 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 101 101 psFree(cell->readouts); 102 102 psFree(cell->parent); 103 psFree(cell-> private);103 psFree(cell->hdu); 104 104 } 105 105 } … … 125 125 psFree(chip->cells); 126 126 psFree(chip->parent); 127 psFree(chip-> private);127 psFree(chip->hdu); 128 128 } 129 129 } … … 151 151 } 152 152 psFree(fpa->chips); 153 psFree(fpa-> private);153 psFree(fpa->hdu); 154 154 psFree(fpa->phu); 155 155 } … … 204 204 } 205 205 tmpCell->valid = false; 206 tmpCell-> private= NULL;206 tmpCell->hdu = NULL; 207 207 208 208 psMemSetDeallocator(tmpCell, (psFreeFunc) cellFree); … … 233 233 } 234 234 tmpChip->valid = false; 235 tmpChip-> private= NULL;235 tmpChip->hdu = NULL; 236 236 237 237 psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree); … … 250 250 tmpFPA->camera = camera; 251 251 tmpFPA->chips = psArrayAlloc(0); 252 tmpFPA-> private= NULL;252 tmpFPA->hdu = NULL; 253 253 tmpFPA->phu = NULL; 254 254 … … 873 873 return(numChips); 874 874 } 875 -
trunk/psModules/src/astrom/pmAstrometry.h
r5739 r6205 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-12-08 00:00:57$10 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-26 21:10:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 34 34 } 35 35 p_pmHDU; 36 37 p_pmHDU *pmHDUAlloc(); 38 void *pmHDUFree(p_pmHDU *hdu); 36 39 37 40 /** Focal plane data structure … … 62 65 const psMetadata *camera; ///< Camera configuration 63 66 psArray *chips; ///< The chips 64 p_pmHDU * private;///< FITS data67 p_pmHDU *hdu; ///< FITS data 65 68 psMetadata *phu; ///< Primary Header 66 69 } … … 95 98 pmFPA *parent; ///< Parent FPA 96 99 bool valid; ///< Do we bother about reading and working with this chip? 97 p_pmHDU * private;///< FITS data100 p_pmHDU *hdu; ///< FITS data 98 101 } 99 102 pmChip; … … 124 127 pmChip *parent; ///< Parent chip 125 128 bool valid; ///< Do we bother about reading and working with this cell? 126 p_pmHDU * private;///< FITS data129 p_pmHDU *hdu; ///< FITS data 127 130 } 128 131 pmCell; … … 436 439 ); 437 440 441 438 442 /** 439 443 * … … 451 455 452 456 457 /** 458 * 459 * pmFPAConstruct shall construct a focal plane hierarchy from a camera 460 * configuration. A db handle is also provided so that may be set in the pmFPA. 461 * The resultant pmFPA and its lower-down components shall be ready for to read a 462 * FITS file into it by setting the extname pointers at the appropriate levels to 463 * the appropriate FITS extension name. 464 * 465 */ 466 pmFPA *pmFPAConstruct( 467 const psMetadata *camera, 468 psDB *db 469 ); 470 471 453 472 #endif // #ifndef PS_ASTROMETRY_H 454 473 -
trunk/psModules/src/astrom/pmAstrometryObjects.h
r5674 r6205 8 8 * @author EAM, IfA 9 9 * 10 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $11 * @date $Date: 200 5-12-05 20:49:30 $10 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2006-01-26 21:10:50 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 183 183 * the GRID.*.ANGLE entries (they will be ignored). 184 184 * 185 * XXX: This function name is different in the SDRS.186 *187 185 */ 188 186 /* in pmAstromGrid.c */ -
trunk/psModules/src/imcombine/pmReadoutCombine.c
r5516 r6205 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $8 * @date $Date: 200 5-11-15 20:09:03$7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-26 21:10:50 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 461 461 } 462 462 463 464 465 /** 466 * 467 * The input array fluxLevels consists of Ni vectors, one per mosaic image. 468 * Each vector consists of Nj elements, each a measurement of the input 469 * flat-field image flux levels. All of these vectors must be constructed with 470 * the same number of elements, or the function will return an error. If a chip 471 * is missing from a particular image, that element should be set to NaN. The 472 * vector chipGains supplies initial guesses for the chip gains. If the vector 473 * contains the values 0.0 or NaN for any of the elements, the gain is set to the 474 * mean of the valid values. If the vector length does not match the number of 475 * chips, an warning is raised, all chip gain guesses will be set to 1.0, and the 476 * vector length modified to match the number of chips defined by the supplied 477 * fluxLevels. The sourceFlux input vector must be allocated (not NULL), but the 478 * routine will set the vector length to the number of source images regardless 479 * of the initial state of the vector. All vectors used by this function must be 480 * of type PS_DATA_F64. 481 * 482 483 fluxLevels(i, j): for each flat field image i, this psArray contains a vector 484 with an elemenmt for each chip j. So, fluxLevels(i, j) corresponds to the 485 measured flux M_(i, j) for flat image i, chip j. 486 487 chipGains[]: has j elements, one for each chip. 488 489 490 They have the observed flux levels for each chip of each image. They want to 491 solve for the actual flux levels and the gain of each chip. 492 493 Okay, they want to solve for source fluxes and chip gains. 494 495 496 497 498 499 500 * 501 */ 502 bool pmFlatNormalization( 503 psVector *sourceFlux, 504 psVector *chipGains, 505 psArray *fluxLevels) 506 { 507 PS_ASSERT_PTR_NON_NULL(fluxLevels, false); 508 psS32 numImages = fluxLevels->n; 509 psS32 numChips = ((psVector *) fluxLevels->data[0])->n; 510 for (psS32 i = 0 ; i < numImages ; i++) { 511 psVector *tmpVec = (psVector *) fluxLevels->data[i]; 512 PS_ASSERT_VECTOR_NON_NULL(tmpVec, false); 513 PS_ASSERT_VECTOR_TYPE(tmpVec, PS_TYPE_F64, false); 514 PS_ASSERT_VECTOR_SIZE(tmpVec, numChips, false); 515 } 516 517 // 518 // Ensure that *localChipGains points to a vector of the same length as numImages. 519 // 520 PS_ASSERT_PTR_NON_NULL(chipGains, false); 521 PS_ASSERT_VECTOR_TYPE(chipGains, PS_TYPE_F64, false); 522 psVector *localChipGains = chipGains; 523 if (numChips != chipGains->n) { 524 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the chipGains vector length does not match the number of chips.\n"); 525 localChipGains = psVectorAlloc(numChips, PS_TYPE_F64); 526 psBool rc = psVectorInit(localChipGains, 1.0); 527 if (rc == false) { 528 printf("XXX: gen error\n"); 529 } 530 } 531 532 // 533 // If the chipGains vector contains the values 0.0 or NaN for any of the elements, 534 // the gain is set to the mean of the valid values. 535 // 536 psBool meanFlag = false; 537 psVector *chipGainsMask = psVectorAlloc(chipGains->n, PS_TYPE_U8); 538 for (psS32 i = 0 ; i < chipGains->n ; i++) { 539 if ((fabs(chipGains->data.F64[i]) < FLT_EPSILON) || 540 (isnan(chipGains->data.F64[i]))) { 541 chipGainsMask->data.U8[i] = 1; 542 meanFlag = true; 543 } 544 } 545 // Must calculate the mean. 546 if (meanFlag == true) { 547 psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 548 stats = psVectorStats(stats, chipGains, NULL, chipGainsMask, 1); 549 if (stats == NULL) { 550 printf("XXX: gen error\n"); 551 } 552 psF64 mean; 553 psBool rc = p_psGetStatValue(stats, &mean); 554 if (rc == false) { 555 printf("XXX: gen error\n"); 556 } 557 // Set the gain to this mean for chips with a gain of 0.0 or NAN 558 559 for (psS32 i = 0 ; i < chipGains->n ; i++) { 560 if ((fabs(chipGains->data.F64[i]) < FLT_EPSILON) || 561 (isnan(chipGains->data.F64[i]))) { 562 chipGains->data.F64[i] = mean; 563 } 564 } 565 } 566 567 // 568 // Assert that sourceFlux is non-NULL, correct type, correct size. 569 // 570 PS_ASSERT_PTR_NON_NULL(sourceFlux, false); 571 PS_ASSERT_VECTOR_TYPE(sourceFlux, PS_TYPE_F64, false); 572 psVectorRealloc(sourceFlux, numImages); 573 574 575 576 577 578 579 psFree(psVector); 580 if (numImages != chipGains->n) { 581 psFree(localChipGains); 582 } 583 } -
trunk/psModules/src/imcombine/pmReadoutCombine.h
r5516 r6205 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $8 * @date $Date: 200 5-11-15 20:09:03$7 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-26 21:10:50 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 72 72 pmFringePoint; 73 73 74 75 /** 76 * 77 * The input array fluxLevels consists of Ni vectors, one per mosaic image. 78 * Each vector consists of Nj elements, each a measurement of the input 79 * flat-field image flux levels. All of these vectors must be constructed with 80 * the same number of elements, or the function will return an error. If a chip 81 * is missing from a particular image, that element should be set to NaN. The 82 * vector chipGains supplies initial guesses for the chip gains. If the vector 83 * contains the values 0.0 or NaN for any of the elements, the gain is set to the 84 * mean of the valid values. If the vector length does not match the number of 85 * chips, an warning is raised, all chip gain guesses will be set to 1.0, and the 86 * vector length modified to match the number of chips defined by the supplied 87 * fluxLevels. The sourceFlux input vector must be allocated (not NULL), but the 88 * routine will set the vector length to the number of source images regardless 89 * of the initial state of the vector. All vectors used by this function must be 90 * of type PS_DATA_F64. 91 * 92 */ 93 bool pmFlatNormalization( 94 psVector *sourceFlux, 95 psVector *chipGains, 96 psArray *fluxLevels 97 ); 98 99 74 100 #endif -
trunk/psModules/src/imsubtract/pmSubtractBias.c
r5843 r6205 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-12-24 01:24:20$8 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-01-26 21:10:51 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 274 274 psPolynomial1D *in) 275 275 { 276 psPolynomial1D *out = psPolynomial1DAlloc(in-> nX, in->type);276 psPolynomial1D *out = psPolynomial1DAlloc(in->type, in->nX); 277 277 Polynomial1DCopy(out, in); 278 278 return(out); … … 1141 1141 1142 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1143 /****************************************************************************** 1160 1144 pmSubtractBias(....): see SDRS for complete specification.
Note:
See TracChangeset
for help on using the changeset viewer.
