Changeset 6205
- Timestamp:
- Jan 26, 2006, 11:10:51 AM (20 years ago)
- Location:
- trunk/psModules
- Files:
-
- 12 edited
-
src/astrom/Makefile.am (modified) (1 diff)
-
src/astrom/pmAstrometry.c (modified) (8 diffs)
-
src/astrom/pmAstrometry.h (modified) (7 diffs)
-
src/astrom/pmAstrometryObjects.h (modified) (2 diffs)
-
src/imcombine/pmReadoutCombine.c (modified) (2 diffs)
-
src/imcombine/pmReadoutCombine.h (modified) (2 diffs)
-
src/imsubtract/pmSubtractBias.c (modified) (3 diffs)
-
test/astrom/tst_pmAstrometry.c (modified) (7 diffs)
-
test/config/tst_pmConfig.c (modified) (3 diffs)
-
test/detrend/tst_pmNonLinear.c (modified) (3 diffs)
-
test/imsubtract/tst_pmSubtractBias.c (modified) (2 diffs)
-
test/imsubtract/tst_pmSubtractSky.c (modified) (4 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. -
trunk/psModules/test/astrom/tst_pmAstrometry.c
r5681 r6205 9 9 * XXX: Create the pmHDU alloc/free function, test them here 10 10 * 11 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $12 * @date $Date: 200 5-12-05 21:28:55$11 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2006-01-26 21:10:51 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 137 137 138 138 // 139 // How to test the p_pmHDU * privatemember?139 // How to test the p_pmHDU *hdu member? 140 140 // 141 141 … … 208 208 } 209 209 210 if (fpa-> private!= NULL) {211 psLogMsg(__func__,PS_LOG_ERROR, "TEST ERROR: pmFPAAlloc did not set -> privateto NULL.");210 if (fpa->hdu != NULL) { 211 psLogMsg(__func__,PS_LOG_ERROR, "TEST ERROR: pmFPAAlloc did not set ->hdu to NULL."); 212 212 return 9; 213 213 } … … 258 258 259 259 // 260 // How to test the p_pmHDU * privatemember?260 // How to test the p_pmHDU *hdu member? 261 261 // 262 262 … … 325 325 } 326 326 327 if (chip-> private!= NULL) {328 psLogMsg(__func__, PS_LOG_ERROR, "TEST ERROR: chip-> privateset improperly.\n");327 if (chip->hdu != NULL) { 328 psLogMsg(__func__, PS_LOG_ERROR, "TEST ERROR: chip->hdu set improperly.\n"); 329 329 return 25; 330 330 } … … 395 395 396 396 // 397 // How to test the p_pmHDU * privatemember?397 // How to test the p_pmHDU *hdu member? 398 398 // 399 399 … … 473 473 } 474 474 475 if (cell-> private!= NULL) {476 psLogMsg(__func__, PS_LOG_ERROR, "TEST ERROR: cell-> privateset improperly.\n");475 if (cell->hdu != NULL) { 476 psLogMsg(__func__, PS_LOG_ERROR, "TEST ERROR: cell->hdu set improperly.\n"); 477 477 return 27; 478 478 } -
trunk/psModules/test/config/tst_pmConfig.c
r5683 r6205 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-12-05 21:41:31 $ 9 * XXX: Untested: 10 * pmConfigValidateCamera() 11 * pmConfigCameraFromHeader() 12 * pmConfigRecipeFromCamera() 13 * pmConfigDB() 14 * 15 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-01-26 21:10:51 $ 11 17 * 12 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 47 42 48 /****************************************************************************** 43 test00(): Test the various allocators and deallocators.49 test00(): 44 50 XXX: untested: 45 51 TIME: … … 129 135 130 136 printf("----------------------------------------------------------------\n"); 137 printf("Calling pmConfigRead() with acceptable arguments.\n"); 131 138 132 139 rc = pmConfigRead(&site, &camera, &recipe, &argc, str, "RecipeName"); -
trunk/psModules/test/detrend/tst_pmNonLinear.c
r5435 r6205 19 19 * and where the data is outside the pmReadout range. 20 20 * 21 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $22 * @date $Date: 200 5-10-20 23:06:24$21 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 22 * @date $Date: 2006-01-26 21:10:51 $ 23 23 * 24 24 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 71 71 pmReadout *myReadout = pmReadoutAlloc(NULL); 72 72 myReadout->image = myImage; 73 psPolynomial1D *myPoly = psPolynomial1DAlloc( 2, PS_POLYNOMIAL_ORD);73 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); 74 74 myPoly->coeff[1] = 1.0; 75 75 … … 169 169 pmReadout *rc = NULL; 170 170 myReadout->image = myImage; 171 psPolynomial1D *myPoly = psPolynomial1DAlloc( 2, PS_POLYNOMIAL_ORD);171 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, 2); 172 172 myPoly->coeff[1] = 1.0; 173 173 -
trunk/psModules/test/imsubtract/tst_pmSubtractBias.c
r5844 r6205 25 25 * XXX: Memory leaks are not being detected. 26 26 * 27 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $28 * @date $Date: 200 5-12-24 01:24:36$27 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 28 * @date $Date: 2006-01-26 21:10:51 $ 29 29 * 30 30 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 643 643 644 644 psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 645 psPolynomial1D *myPoly = psPolynomial1DAlloc(P OLYNOMIAL_FIT_ORDER, PS_POLYNOMIAL_ORD);645 psPolynomial1D *myPoly = psPolynomial1DAlloc(PS_POLYNOMIAL_ORD, POLYNOMIAL_FIT_ORDER); 646 646 psSpline1D *mySpline = NULL; 647 647 -
trunk/psModules/test/imsubtract/tst_pmSubtractSky.c
r5516 r6205 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $10 * @date $Date: 200 5-11-15 20:09:03$9 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-01-26 21:10:51 $ 11 11 * 12 12 * XXX: I added the CELL.TRIMSEC region code but there are not tests for it. … … 55 55 myReadout->image = tmpImageF32; 56 56 psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 57 psPolynomial2D *myPoly = psPolynomial2DAlloc(P OLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);57 psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER); 58 58 59 59 printPositiveTestHeader(stdout, "pmSubtractSky", "doSubtractSkySimple"); … … 98 98 myReadout->image = tmpImageF32; 99 99 psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 100 psPolynomial2D *myPoly = psPolynomial2DAlloc(P OLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);100 psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER); 101 101 psImage *trueImage = psImageAlloc(numCols, numRows, PS_TYPE_F32); 102 102 psF32 errorTolerance = ERROR_TOLERANCE * ((psF32) binFactor); … … 208 208 pmReadout *rc = NULL; 209 209 psStats *myStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 210 psPolynomial2D *myPoly = psPolynomial2DAlloc(P OLY_X_ORDER, POLY_Y_ORDER, PS_POLYNOMIAL_ORD);210 psPolynomial2D *myPoly = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, POLY_X_ORDER, POLY_Y_ORDER); 211 211 212 212 printPositiveTestHeader(stdout, "pmSubtractSky", "Testing bad input parameter conditions.");
Note:
See TracChangeset
for help on using the changeset viewer.
