Changeset 5768
- Timestamp:
- Dec 12, 2005, 11:52:24 AM (21 years ago)
- Location:
- branches/rel9/psModules
- Files:
-
- 4 deleted
- 13 edited
-
Makefile.am (modified) (1 diff)
-
configure.ac (modified) (6 diffs)
-
src/astrom/pmAstrometry.c (modified) (2 diffs)
-
src/astrom/pmAstrometry.h (modified) (2 diffs)
-
src/config/pmConfig.c (modified) (3 diffs)
-
src/imcombine/pmImageCombine.c (modified) (2 diffs)
-
src/objects/Makefile.am (modified) (2 diffs)
-
src/objects/pmObjects.c (modified) (15 diffs)
-
src/objects/pmObjects.h (modified) (3 diffs)
-
src/objects/pmPSF.c (modified) (3 diffs)
-
src/objects/pmPSFtry.c (modified) (7 diffs)
-
src/objects/pmPSFtry.h (modified) (2 diffs)
-
src/objects/psLibUtils.c (deleted)
-
src/objects/psLibUtils.h (deleted)
-
src/objects/psModulesUtils.c (deleted)
-
src/objects/psModulesUtils.h (deleted)
-
test/astrom/tst_pmAstrometry01.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel9/psModules/Makefile.am
r5366 r5768 6 6 pkgconfig_DATA= psmodule.pc 7 7 8 EXTRA_DIST = Doxyfile.in psmodule-config.in psmodule.pc.in 8 EXTRA_DIST = \ 9 Doxyfile.in \ 10 psmodule-config.in \ 11 psmodule.pc.in \ 12 autogen.sh 9 13 10 14 if DOXYGEN -
branches/rel9/psModules/configure.ac
r5693 r5768 1 1 AC_PREREQ(2.59) 2 2 3 AC_INIT([psmodule],[0.9. 0],[http://pan-starrs.ifa.hawaii.edu/bugzilla])3 AC_INIT([psmodule],[0.9.1],[http://pan-starrs.ifa.hawaii.edu/bugzilla]) 4 4 AC_CONFIG_SRCDIR([psmodule.pc.in]) 5 5 … … 37 37 AC_SUBST([AM_CFLAGS]) 38 38 39 dnl ------------------- PERL options --------------------- 40 AC_ARG_WITH(perl, 41 [AS_HELP_STRING(--with-perl=FILE,Specify location of PERL executable.)], 42 [AC_CHECK_PROG(PERL, $withval, $withval)], 43 [AC_CHECK_PROG(PERL, perl, `which perl`)]) 44 if test "$PERL" == "" 45 then 46 AC_MSG_ERROR([PERL is required. Use --with-perl to specify its install location.]) 47 fi 48 AC_SUBST(PERL,$PERL) 49 39 50 SRCPATH='${top_srcdir}/src' 40 SRCDIRS="astrom camera config detrend imcombine imsubtract objects photom" 41 SRCINC=`echo "${SRCDIRS=}" | ${SED} "s|\(\\w\+\)|-I\${SRCPATH=}/\1|g"` 42 SRCSUBLIBS=`echo "${SRCDIRS=}" | ${SED} "s|\(\\w\+\)|\1/libpsmodule\1.la|g"` 43 AC_SUBST([SRCSUBLIBS],${SRCSUBLIBS=}) 51 SRCDIRS="astrom config detrend imcombine imsubtract objects" 52 # escape two escapes at this level so \\ gets passed to the shell and \ to perl 53 SRCINC=`echo "${SRCDIRS=}" | ${PERL} -pe "s|(\w+)|-I\\\\${SRCPATH=}/\1|g"` 54 SRCINC="-I${SRCPATH=} ${SRCINC=}" 55 SRCSUBLIBS=`echo "${SRCDIRS=}" | ${PERL} -pe "s|(\w+)|\1/libpsmodule\1.la|g"` 56 AC_SUBST(SRCSUBLIBS,${SRCSUBLIBS=}) 57 AC_SUBST(SRCINC,${SRCINC=}) 44 58 AC_SUBST([SRCDIRS],${SRCDIRS=}) 45 AC_SUBST([SRCINC],${SRCINC=})46 59 47 60 dnl doxygen ------------------------------------------------------------------- … … 56 69 57 70 if test -z ${PSLIB_CONFIG} ; then 58 PKG_CHECK_MODULES([PSLIB], [pslib >= 0. 8.0])71 PKG_CHECK_MODULES([PSLIB], [pslib >= 0.9.0]) 59 72 else 60 73 AC_CHECK_FILE($PSLIB_CONFIG,[], … … 79 92 src/Makefile 80 93 src/astrom/Makefile 81 src/camera/Makefile82 94 src/config/Makefile 83 95 src/detrend/Makefile … … 85 97 src/imsubtract/Makefile 86 98 src/objects/Makefile 87 src/photom/Makefile88 99 test/Makefile 89 100 test/astrom/Makefile 90 test/camera/Makefile91 101 test/config/Makefile 92 102 test/detrend/Makefile … … 94 104 test/imsubtract/Makefile 95 105 test/objects/Makefile 96 test/photom/Makefile97 106 Doxyfile 98 107 psmodule-config -
branches/rel9/psModules/src/astrom/pmAstrometry.c
r5681 r5768 13 13 * XXX: Should we implement non-linear cell->chip transforms? 14 14 * 15 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $16 * @date $Date: 2005-12- 05 21:28:55$15 * @version $Revision: 1.10.2.1 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-12-12 21:52:17 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 799 799 return(cellCoord); 800 800 } 801 802 /***************************************************************************** 803 *****************************************************************************/ 804 bool pmFPASelectChip( 805 pmFPA *fpa, 806 int chipNum) 807 { 808 PS_ASSERT_PTR_NON_NULL(fpa, false); 809 if ((fpa->chips == NULL) || (chipNum >= fpa->chips->n)) { 810 return(false); 811 } 812 psBool rc = true; 813 814 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 815 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 816 if (tmpChip == NULL) { 817 rc = false; 818 } else { 819 if (i == chipNum) { 820 tmpChip->valid = true; 821 } else { 822 tmpChip->valid = false; 823 } 824 } 825 } 826 827 return(rc); 828 } 829 830 831 /***************************************************************************** 832 XXX: The SDRS is ambiguous on a few things: 833 Whether or not the other chips should be set valid=true. 834 Should we return the number of chip valid=true before or after they're set, 835 *****************************************************************************/ 836 /** 837 * 838 * pmFPAExcludeChip shall set valid to false only for the specified chip 839 * number (chipNum). In the event that the specified chip number does not exist 840 * within the fpa, the function shall generate a warning, and perform no action. 841 * The function shall return the number of chips within the fpa that have valid 842 * set to true. 843 * 844 */ 845 int pmFPAExcludeChip( 846 pmFPA *fpa, 847 int chipNum) 848 { 849 PS_ASSERT_PTR_NON_NULL(fpa, false); 850 851 if (fpa->chips == NULL) { 852 psLogMsg(__func__, PS_LOG_WARN, "WARNING: fpa->chips == NULL\n"); 853 return(0); 854 } 855 if ((chipNum >= fpa->chips->n) || (NULL == (pmChip *) fpa->chips->data[chipNum])) { 856 psLogMsg(__func__, PS_LOG_WARN, "WARNING: the specified chip (%d) does not exist.\n", chipNum); 857 return(0); 858 } 859 860 psS32 numChips = 0; 861 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 862 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 863 if (tmpChip != NULL) { 864 if (i == chipNum) { 865 tmpChip->valid = false; 866 } else { 867 tmpChip->valid = true; 868 numChips++; 869 } 870 } 871 } 872 873 return(numChips); 874 } -
branches/rel9/psModules/src/astrom/pmAstrometry.h
r5681 r5768 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $11 * @date $Date: 2005-12- 05 21:28:55$10 * @version $Revision: 1.4.2.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-12-12 21:52:17 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 423 423 ); 424 424 425 /** 426 * 427 * pmFPASelectChip shall set valid to true for the specified chip number 428 * (chipNum), and all other chips shall have valid set to false. In the event 429 * that the specified chip number does not exist within the fpa, the function 430 * shall return false. 431 * 432 */ 433 bool pmFPASelectChip( 434 pmFPA *fpa, 435 int chipNum 436 ); 437 438 /** 439 * 440 * pmFPAExcludeChip shall set valid to false only for the specified chip 441 * number (chipNum). In the event that the specified chip number does not exist 442 * within the fpa, the function shall generate a warning, and perform no action. 443 * The function shall return the number of chips within the fpa that have valid 444 * set to true. 445 * 446 */ 447 int pmFPAExcludeChip( 448 pmFPA *fpa, 449 int chipNum 450 ); 451 452 425 453 #endif // #ifndef PS_ASTROMETRY_H 454 -
branches/rel9/psModules/src/config/pmConfig.c
r5516 r5768 3 3 * @author PAP, IfA 4 4 * 5 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $6 * @date $Date: 2005-1 1-15 20:09:03$5 * @version $Revision: 1.4.2.1 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2005-12-12 21:52:18 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 const char *description) // Description of file 29 29 { 30 int numBadLines = 0;30 unsigned int numBadLines = 0; 31 31 32 32 psLogMsg(__func__, PS_LOG_INFO, "Loading %s configuration from file %s\n", … … 359 359 } else if (cameraItem->type == PS_DATA_STRING) { 360 360 psTrace(__func__, 5, "Reading camera configuration for %s...\n", cameraItem->name); 361 int badLines = 0; // Number of bad lines in reading camera configuration361 unsigned int badLines = 0; // Number of bad lines in reading camera configuration 362 362 camera = psMetadataConfigParse(NULL, &badLines, cameraItem->data.V, true); 363 363 if (badLines > 0) { -
branches/rel9/psModules/src/imcombine/pmImageCombine.c
r5170 r5768 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $11 * @date $Date: 2005- 09-28 20:43:52$10 * @version $Revision: 1.1.10.1 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-12-12 21:52:20 $ 12 12 * 13 13 * XXX: pmRejectPixels() has a known bug with the pmImageTransform() call. … … 35 35 XXX: Allocate a dummy psStats structure so that we don't destroy away its data. 36 36 *****************************************************************************/ 37 psImage *pmCombineImages( psImage *combine, ///< Combined image (output)38 psArray **questionablePixels, ///< Array of rejection masks39 const psArray *images, ///< Array of input images40 const psArray *errors, ///< Array of input errorimages41 const psArray *masks, ///< Array of input masks42 psU32 maskVal, ///< Mask value43 const psPixels *pixels, ///< Pixels to combine44 psS32 numIter, ///< Number of rejection iterations45 psF32 sigmaClip, ///< Number of standard deviations at which to reject46 const psStats *stats ///< Statistics to use in the combination47 )37 psImage *pmCombineImages( 38 psImage *combine, ///< Combined image (output) 39 psArray **questionablePixels, ///< Array of rejection masks 40 const psArray *images, ///< Array of input images 41 const psArray *errors, ///< Array of input error images 42 const psArray *masks, ///< Array of input masks 43 psU32 maskVal, ///< Mask value 44 const psPixels *pixels, ///< Pixels to combine 45 psS32 numIter, ///< Number of rejection iterations 46 psF32 sigmaClip, ///< Number of standard deviations at which to reject 47 const psStats *stats) ///< Statistics to use in the combination 48 48 { 49 49 -
branches/rel9/psModules/src/objects/Makefile.am
r5307 r5768 8 8 pmPSFtry.c \ 9 9 pmModelGroup.c \ 10 psModulesUtils.c \11 psLibUtils.c \12 10 psEllipse.c 13 11 … … 24 22 pmPSFtry.h \ 25 23 pmModelGroup.h \ 26 psModulesUtils.h \27 psLibUtils.h \28 24 psEllipse.h -
branches/rel9/psModules/src/objects/pmObjects.c
r5435 r5768 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-20 23:06:24$8 * @version $Revision: 1.3.2.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-12-12 21:52:22 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 68 68 } 69 69 70 /******************************************************************************71 pmModelAlloc(): Allocate the pmModel structure, along with its parameters,72 and initialize the type member. Initialize the params to 0.0.73 XXX EAM: simplifying code with pmModelParameterCount74 *****************************************************************************/75 pmModel *pmModelAlloc(pmModelType type)76 {77 psTrace(__func__, 3, "---- %s() begin ----\n", __func__);78 pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel));79 80 tmp->type = type;81 tmp->chisq = 0.0;82 tmp->nIter = 0;83 psS32 Nparams = pmModelParameterCount(type);84 if (Nparams == 0) {85 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");86 return(NULL);87 }88 89 tmp->params = psVectorAlloc(Nparams, PS_TYPE_F32);90 tmp->dparams = psVectorAlloc(Nparams, PS_TYPE_F32);91 92 for (psS32 i = 0; i < tmp->params->n; i++) {93 tmp->params->data.F32[i] = 0.0;94 tmp->dparams->data.F32[i] = 0.0;95 }96 97 psMemSetDeallocator(tmp, (psFreeFunc) modelFree);98 psTrace(__func__, 3, "---- %s() end ----\n", __func__);99 return(tmp);100 }101 102 /******************************************************************************103 XXX EAM : we can now free these pixels - memory ref is incremented now104 *****************************************************************************/105 70 static void sourceFree(pmSource *tmp) 106 71 { … … 115 80 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 116 81 } 82 83 /****************************************************************************** 84 getRowVectorFromImage(): a private function which simply returns a 85 psVector containing the specified row of data from the psImage. 86 87 XXX: Is there a better way to do this? 88 XXX EAM: does this really need to alloc a new vector??? 89 *****************************************************************************/ 90 static psVector *getRowVectorFromImage(psImage *image, 91 psU32 row) 92 { 93 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 94 PS_ASSERT_IMAGE_NON_NULL(image, NULL); 95 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL); 96 97 psVector *tmpVector = psVectorAlloc(image->numCols, PS_TYPE_F32); 98 for (psU32 col = 0; col < image->numCols ; col++) { 99 tmpVector->data.F32[col] = image->data.F32[row][col]; 100 } 101 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 102 return(tmpVector); 103 } 104 105 /****************************************************************************** 106 myListAddPeak(): A private function which allocates a psArray, if the list 107 argument is NULL, otherwise it adds the peak to that list. 108 XXX EAM : changed the output to psArray 109 XXX EAM : Switched row, col args 110 XXX EAM : NOTE: this was changed in the call, so the new code is consistent 111 *****************************************************************************/ 112 static psArray *myListAddPeak(psArray *list, 113 psS32 row, 114 psS32 col, 115 psF32 counts, 116 pmPeakType type) 117 { 118 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 119 pmPeak *tmpPeak = pmPeakAlloc(col, row, counts, type); 120 121 if (list == NULL) { 122 list = psArrayAlloc(100); 123 list->n = 0; 124 } 125 psArrayAdd(list, 100, tmpPeak); 126 psFree (tmpPeak); 127 // XXX EAM : is this free appropriate? (does psArrayAdd increment memory counter?) 128 129 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 130 return(list); 131 } 132 133 134 /****************************************************************************** 135 bool checkRadius2(): private function which simply determines if the (x, y) 136 point is within the radius of the specified peak. 137 138 XXX: macro this for performance. 139 XXX: this is rather inefficient - at least compute and compare against radius^2 140 *****************************************************************************/ 141 static bool checkRadius2(psF32 xCenter, 142 psF32 yCenter, 143 psF32 radius, 144 psF32 x, 145 psF32 y) 146 { 147 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 148 /// XXX EAM should compare with hypot (x,y) for speed 149 if ((PS_SQR(x - xCenter) + PS_SQR(y - yCenter)) < PS_SQR(radius)) { 150 return(true); 151 } 152 153 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 154 return(false); 155 } 156 157 // XXX: Macro this. 158 static bool isItInThisRegion(const psRegion valid, 159 psS32 x, 160 psS32 y) 161 { 162 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 163 if ((x >= valid.x0) && 164 (x <= valid.x1) && 165 (y >= valid.y0) && 166 (y <= valid.y1)) { 167 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__); 168 return(true); 169 } 170 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__); 171 return(false); 172 } 173 174 /****************************************************************************** 175 findValue(source, level, row, col, dir): a private function which determines 176 the column coordinate of the model function which has the value "level". If 177 dir equals 0, then you loop leftwards from the peak pixel, otherwise, 178 rightwards. 179 180 XXX: reverse order of row,col args? 181 182 XXX: Input row/col are in image coords. 183 184 XXX: The result is returned in image coords. 185 *****************************************************************************/ 186 static psF32 findValue(pmSource *source, 187 psF32 level, 188 psU32 row, 189 psU32 col, 190 psU32 dir) 191 { 192 psTrace(__func__, 4, "---- %s() begin ----\n", __func__); 193 // 194 // Convert coords to subImage space. 195 // 196 psU32 subRow = row - source->pixels->row0; 197 psU32 subCol = col - source->pixels->col0; 198 199 // Ensure that the starting column is allowable. 200 if (!((0 <= subCol) && (subCol < source->pixels->numCols))) { 201 psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range"); 202 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__); 203 return(NAN); 204 } 205 if (!((0 <= subRow) && (subRow < source->pixels->numRows))) { 206 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__); 207 psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range"); 208 return(NAN); 209 } 210 211 // XXX EAM : i changed this to match pmModelEval above, but see 212 // XXX EAM the note below in pmSourceContour 213 psF32 oldValue = pmModelEval(source->modelFLT, source->pixels, subCol, subRow); 214 if (oldValue == level) { 215 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 216 return(((psF32) (subCol + source->pixels->col0))); 217 } 218 219 // 220 // We define variables incr and lastColumn so that we can use the same loop 221 // whether we are stepping leftwards, or rightwards. 222 // 223 psS32 incr; 224 psS32 lastColumn; 225 if (dir == 0) { 226 incr = -1; 227 lastColumn = -1; 228 } else { 229 incr = 1; 230 lastColumn = source->pixels->numCols; 231 } 232 subCol+=incr; 233 234 while (subCol != lastColumn) { 235 psF32 newValue = pmModelEval(source->modelFLT, source->pixels, subCol, subRow); 236 if (oldValue == level) { 237 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 238 return((psF32) (subCol + source->pixels->col0)); 239 } 240 241 if ((newValue <= level) && (level <= oldValue)) { 242 // This is simple linear interpolation. 243 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 244 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) ); 245 } 246 247 if ((oldValue <= level) && (level <= newValue)) { 248 // This is simple linear interpolation. 249 psTrace(__func__, 4, "---- %s() end ----\n", __func__); 250 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) ); 251 } 252 253 subCol+=incr; 254 } 255 256 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__); 257 return(NAN); 258 } 259 260 /****************************************************************************** 261 pmModelAlloc(): Allocate the pmModel structure, along with its parameters, 262 and initialize the type member. Initialize the params to 0.0. 263 XXX EAM: simplifying code with pmModelParameterCount 264 *****************************************************************************/ 265 pmModel *pmModelAlloc(pmModelType type) 266 { 267 psTrace(__func__, 3, "---- %s() begin ----\n", __func__); 268 pmModel *tmp = (pmModel *) psAlloc(sizeof(pmModel)); 269 270 tmp->type = type; 271 tmp->chisq = 0.0; 272 tmp->nIter = 0; 273 psS32 Nparams = pmModelParameterCount(type); 274 if (Nparams == 0) { 275 psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType"); 276 return(NULL); 277 } 278 279 tmp->params = psVectorAlloc(Nparams, PS_TYPE_F32); 280 tmp->dparams = psVectorAlloc(Nparams, PS_TYPE_F32); 281 282 for (psS32 i = 0; i < tmp->params->n; i++) { 283 tmp->params->data.F32[i] = 0.0; 284 tmp->dparams->data.F32[i] = 0.0; 285 } 286 287 psMemSetDeallocator(tmp, (psFreeFunc) modelFree); 288 psTrace(__func__, 3, "---- %s() end ----\n", __func__); 289 return(tmp); 290 } 291 292 /****************************************************************************** 293 XXX EAM : we can now free these pixels - memory ref is incremented now 294 *****************************************************************************/ 117 295 118 296 /****************************************************************************** … … 240 418 } 241 419 242 /******************************************************************************243 getRowVectorFromImage(): a private function which simply returns a244 psVector containing the specified row of data from the psImage.245 246 XXX: Is there a better way to do this?247 XXX EAM: does this really need to alloc a new vector???248 *****************************************************************************/249 static psVector *getRowVectorFromImage(psImage *image,250 psU32 row)251 {252 psTrace(__func__, 4, "---- %s() begin ----\n", __func__);253 PS_ASSERT_IMAGE_NON_NULL(image, NULL);254 PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL);255 256 psVector *tmpVector = psVectorAlloc(image->numCols, PS_TYPE_F32);257 for (psU32 col = 0; col < image->numCols ; col++) {258 tmpVector->data.F32[col] = image->data.F32[row][col];259 }260 psTrace(__func__, 4, "---- %s() end ----\n", __func__);261 return(tmpVector);262 }263 264 /******************************************************************************265 myListAddPeak(): A private function which allocates a psArray, if the list266 argument is NULL, otherwise it adds the peak to that list.267 XXX EAM : changed the output to psArray268 XXX EAM : Switched row, col args269 XXX EAM : NOTE: this was changed in the call, so the new code is consistent270 *****************************************************************************/271 static psArray *myListAddPeak(psArray *list,272 psS32 row,273 psS32 col,274 psF32 counts,275 pmPeakType type)276 {277 psTrace(__func__, 4, "---- %s() begin ----\n", __func__);278 pmPeak *tmpPeak = pmPeakAlloc(col, row, counts, type);279 280 if (list == NULL) {281 list = psArrayAlloc(100);282 list->n = 0;283 }284 psArrayAdd(list, 100, tmpPeak);285 psFree (tmpPeak);286 // XXX EAM : is this free appropriate? (does psArrayAdd increment memory counter?)287 288 psTrace(__func__, 4, "---- %s() end ----\n", __func__);289 return(list);290 }291 420 292 421 /****************************************************************************** … … 503 632 } 504 633 505 // XXX: Macro this.506 static bool isItInThisRegion(const psRegion valid,507 psS32 x,508 psS32 y)509 {510 psTrace(__func__, 4, "---- %s() begin ----\n", __func__);511 if ((x >= valid.x0) &&512 (x <= valid.x1) &&513 (y >= valid.y0) &&514 (y <= valid.y1)) {515 psTrace(__func__, 4, "---- %s(true) end ----\n", __func__);516 return(true);517 }518 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);519 return(false);520 }521 522 634 523 635 /****************************************************************************** … … 627 739 *****************************************************************************/ 628 740 629 630 631 632 633 634 635 636 637 741 bool pmSourceLocalSky( 638 742 pmSource *source, … … 673 777 psTrace(__func__, 3, "---- %s(true) end ----\n", __func__); 674 778 return (true); 675 }676 677 /******************************************************************************678 bool checkRadius2(): private function which simply determines if the (x, y)679 point is within the radius of the specified peak.680 681 XXX: macro this for performance.682 XXX: this is rather inefficient - at least compute and compare against radius^2683 *****************************************************************************/684 static bool checkRadius2(psF32 xCenter,685 psF32 yCenter,686 psF32 radius,687 psF32 x,688 psF32 y)689 {690 psTrace(__func__, 4, "---- %s() begin ----\n", __func__);691 /// XXX EAM should compare with hypot (x,y) for speed692 if ((PS_SQR(x - xCenter) + PS_SQR(y - yCenter)) < PS_SQR(radius)) {693 return(true);694 }695 696 psTrace(__func__, 4, "---- %s(false) end ----\n", __func__);697 return(false);698 779 } 699 780 … … 1107 1188 bool big = (sigX > (clump.X - clump.dX)) && (sigY > (clump.Y - clump.dY)); 1108 1189 if ((Nsatpix > 1) && big) { 1109 tmpSrc->type |= PM_SOURCE_SATSTAR;1190 tmpSrc->type = PM_SOURCE_SATSTAR; 1110 1191 Nsatstar ++; 1111 1192 continue; … … 1114 1195 // saturated object (not a star, eg bleed trails, hot pixels) 1115 1196 if (Nsatpix > 1) { 1116 tmpSrc->type |= PM_SOURCE_SATURATED;1197 tmpSrc->type = PM_SOURCE_SATURATED; 1117 1198 Nsat ++; 1118 1199 continue; … … 1123 1204 // only set candidate defects if 1124 1205 if ((sigX < 0.05) || (sigY < 0.05)) { 1125 tmpSrc->type |= PM_SOURCE_DEFECT;1206 tmpSrc->type = PM_SOURCE_DEFECT; 1126 1207 Ncr ++; 1127 1208 continue; … … 1130 1211 // likely unsaturated galaxy (too large to be stellar) 1131 1212 if ((sigX > (clump.X + 3*clump.dX)) || (sigY > (clump.Y + 3*clump.dY))) { 1132 tmpSrc->type |= PM_SOURCE_GALAXY;1213 tmpSrc->type = PM_SOURCE_GALAXY; 1133 1214 Ngal ++; 1134 1215 continue; … … 1143 1224 psF32 radius = hypot ((sigX-clump.X)/clump.dX, (sigY-clump.Y)/clump.dY); 1144 1225 if ((SN > PSF_SN_LIM) && (radius < 1.5)) { 1145 tmpSrc->type |= PM_SOURCE_PSFSTAR;1226 tmpSrc->type = PM_SOURCE_PSFSTAR; 1146 1227 Npsf ++; 1147 1228 continue; … … 1149 1230 1150 1231 // random type of star 1151 tmpSrc->type |= PM_SOURCE_OTHER;1232 tmpSrc->type = PM_SOURCE_OTHER; 1152 1233 } 1153 1234 … … 1350 1431 1351 1432 /****************************************************************************** 1352 findValue(source, level, row, col, dir): a private function which determines1353 the column coordinate of the model function which has the value "level". If1354 dir equals 0, then you loop leftwards from the peak pixel, otherwise,1355 rightwards.1356 1357 XXX: reverse order of row,col args?1358 1359 XXX: Input row/col are in image coords.1360 1361 XXX: The result is returned in image coords.1362 *****************************************************************************/1363 static psF32 findValue(pmSource *source,1364 psF32 level,1365 psU32 row,1366 psU32 col,1367 psU32 dir)1368 {1369 psTrace(__func__, 4, "---- %s() begin ----\n", __func__);1370 //1371 // Convert coords to subImage space.1372 //1373 psU32 subRow = row - source->pixels->row0;1374 psU32 subCol = col - source->pixels->col0;1375 1376 // Ensure that the starting column is allowable.1377 if (!((0 <= subCol) && (subCol < source->pixels->numCols))) {1378 psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range");1379 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__);1380 return(NAN);1381 }1382 if (!((0 <= subRow) && (subRow < source->pixels->numRows))) {1383 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__);1384 psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range");1385 return(NAN);1386 }1387 1388 // XXX EAM : i changed this to match pmModelEval above, but see1389 // XXX EAM the note below in pmSourceContour1390 psF32 oldValue = pmModelEval(source->modelFLT, source->pixels, subCol, subRow);1391 if (oldValue == level) {1392 psTrace(__func__, 4, "---- %s() end ----\n", __func__);1393 return(((psF32) (subCol + source->pixels->col0)));1394 }1395 1396 //1397 // We define variables incr and lastColumn so that we can use the same loop1398 // whether we are stepping leftwards, or rightwards.1399 //1400 psS32 incr;1401 psS32 lastColumn;1402 if (dir == 0) {1403 incr = -1;1404 lastColumn = -1;1405 } else {1406 incr = 1;1407 lastColumn = source->pixels->numCols;1408 }1409 subCol+=incr;1410 1411 while (subCol != lastColumn) {1412 psF32 newValue = pmModelEval(source->modelFLT, source->pixels, subCol, subRow);1413 if (oldValue == level) {1414 psTrace(__func__, 4, "---- %s() end ----\n", __func__);1415 return((psF32) (subCol + source->pixels->col0));1416 }1417 1418 if ((newValue <= level) && (level <= oldValue)) {1419 // This is simple linear interpolation.1420 psTrace(__func__, 4, "---- %s() end ----\n", __func__);1421 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) );1422 }1423 1424 if ((oldValue <= level) && (level <= newValue)) {1425 // This is simple linear interpolation.1426 psTrace(__func__, 4, "---- %s() end ----\n", __func__);1427 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) );1428 }1429 1430 subCol+=incr;1431 }1432 1433 psTrace(__func__, 4, "---- %s(NAN) end ----\n", __func__);1434 return(NAN);1435 }1436 1437 /******************************************************************************1438 1433 pmSourceContour(src, img, level, mode): For an input subImage, and model, this 1439 1434 routine returns a psArray of coordinates that evaluate to the specified level. … … 1933 1928 } 1934 1929 1935 1930 bool pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask) 1931 { 1932 1933 float obsSum = 0; 1934 float fitSum = 0; 1935 float sky = model->params->data.F32[0]; 1936 1937 pmModelFlux modelFluxFunc = pmModelFlux_GetFunction (model->type); 1938 fitSum = modelFluxFunc (model->params); 1939 1940 for (int ix = 0; ix < image->numCols; ix++) { 1941 for (int iy = 0; iy < image->numRows; iy++) { 1942 if (mask->data.U8[iy][ix]) 1943 continue; 1944 obsSum += image->data.F32[iy][ix] - sky; 1945 } 1946 } 1947 if (obsSum <= 0) 1948 return false; 1949 if (fitSum <= 0) 1950 return false; 1951 1952 *fitMag = -2.5*log10(fitSum); 1953 *obsMag = -2.5*log10(obsSum); 1954 return (true); 1955 } 1956 -
branches/rel9/psModules/src/objects/pmObjects.h
r5255 r5768 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $13 * @date $Date: 2005-1 0-10 19:53:40$12 * @version $Revision: 1.2.8.1 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-12-12 21:52:22 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 36 36 * values with specific meanings that other functions can add to or define? 37 37 */ 38 enum {38 typedef enum { 39 39 PSPHOT_MASK_CLEAR = 0x00, 40 40 PSPHOT_MASK_INVALID = 0x01, … … 620 620 ); 621 621 622 623 /** pmSourcePhotometry() 624 * 625 * XXX: Need descriptions 626 * 627 */ 628 bool pmSourcePhotometry( 629 float *fitMag, 630 float *obsMag, 631 pmModel *model, 632 psImage *image, 633 psImage *mask 634 ); 635 636 /** pmModelEval() 637 * 638 * XXX: Need descriptions 639 * 640 */ 641 psF32 pmModelEval( 642 pmModel *model, 643 psImage *image, 644 psS32 col, 645 psS32 row 646 ); 647 622 648 #endif -
branches/rel9/psModules/src/objects/pmPSF.c
r5255 r5768 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-10 19:53:40$8 * @version $Revision: 1.1.8.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-12-12 21:52:22 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 19 19 #include <pslib.h> 20 #include "psLibUtils.h"21 20 #include "pmObjects.h" 22 21 #include "pmPSF.h" … … 94 93 for (int i = 0; i < psf->params->n; i++) { 95 94 // XXX EAM : make this a user-defined value? 96 // XXX EAM : future version (0.7.0?) psf->params->data[i] = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, 1); 97 psf->params->data[i] = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, 1); 95 psf->params->data[i] = psPolynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD); 98 96 } 99 97 -
branches/rel9/psModules/src/objects/pmPSFtry.c
r5255 r5768 1 /** @file pmPSFtry.c 2 * 3 * XXX: need description of file purpose 4 * 5 * @author EAM, IfA 6 * 7 * @version $Revision: 1.1.8.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-12-12 21:52:22 $ 9 * 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 * 12 */ 13 1 14 # include <pslib.h> 2 # include "psLibUtils.h"3 15 # include "pmObjects.h" 4 # include "psModulesUtils.h"5 16 # include "pmPSF.h" 6 17 # include "pmPSFtry.h" … … 41 52 type = pmModelSetType (modelName); 42 53 test->psf = pmPSFAlloc (type); 43 test->sources = psMem Copy(sources);54 test->sources = psMemIncrRefCounter(sources); 44 55 test->modelFLT = psArrayAlloc (sources->n); 45 56 test->modelPSF = psArrayAlloc (sources->n); … … 79 90 int Npsf = 0; 80 91 81 pmPSFtry *try 82 = pmPSFtryAlloc (sources, modelName); 92 pmPSFtry *psfTry = pmPSFtryAlloc (sources, modelName); 83 93 84 94 // stage 1: fit an independent model (freeModel) to all sources 85 95 psTimerStart ("fit"); 86 for (int i = 0; i < try 87 ->sources->n; i++) { 88 89 pmSource *source = try 90 ->sources->data[i]; 91 pmModel *model = pmSourceModelGuess (source, try 92 ->psf->type); 93 x = source->peak->x; 94 y = source->peak->y; 95 96 // set temporary object mask and fit object 97 // fit model as FLT, not PSF 98 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PSPHOT_MASK_MARKED); 99 status = pmSourceFitModel (source, model, false); 100 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", ~PSPHOT_MASK_MARKED); 101 102 // exclude the poor fits 103 if (!status) { 104 try 105 ->mask->data.U8[i] = PSFTRY_MASK_FLT_FAIL; 106 psFree (model); 107 continue; 108 } 109 try 110 ->modelFLT->data[i] = model; 111 Nflt ++; 112 } 96 for (int i = 0; i < psfTry->sources->n; i++) { 97 98 pmSource *source = psfTry->sources->data[i]; 99 pmModel *model = pmSourceModelGuess (source, psfTry->psf->type); 100 x = source->peak->x; 101 y = source->peak->y; 102 103 // set temporary object mask and fit object 104 // fit model as FLT, not PSF 105 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PSPHOT_MASK_MARKED); 106 status = pmSourceFitModel (source, model, false); 107 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", ~PSPHOT_MASK_MARKED); 108 109 // exclude the poor fits 110 if (!status) { 111 psfTry->mask->data.U8[i] = PSFTRY_MASK_FLT_FAIL; 112 psFree (model); 113 continue; 114 } 115 psfTry->modelFLT->data[i] = model; 116 Nflt ++; 117 } 113 118 psLogMsg ("psphot.psftry", 4, "fit flt: %f sec for %d sources\n", psTimerMark ("fit"), sources->n); 114 119 psTrace ("psphot.psftry", 3, "keeping %d of %d PSF candidates (FLT)\n", Nflt, sources->n); 115 120 116 121 // make this optional? 117 // DumpModelFits ( try->modelFLT, "modelsFLT.dat");122 // DumpModelFits (psfTry->modelFLT, "modelsFLT.dat"); 118 123 119 124 // stage 2: construct a psf (pmPSF) from this collection of model fits 120 pmPSFFromModels (try 121 ->psf, try 122 ->modelFLT, try 123 ->mask); 125 pmPSFFromModels (psfTry->psf, psfTry->modelFLT, psfTry->mask); 124 126 125 127 // stage 3: refit with fixed shape parameters 126 128 psTimerStart ("fit"); 127 for (int i = 0; i < try 128 ->sources->n; i++) { 129 // masked for: bad model fit, outlier in parameters 130 if (try 131 ->mask->data.U8[i] & PSFTRY_MASK_ALL) continue; 132 133 pmSource *source = try 134 ->sources->data[i]; 135 pmModel *modelFLT = try 136 ->modelFLT->data[i]; 137 138 // set shape for this model based on PSF 139 pmModel *modelPSF = pmModelFromPSF (modelFLT, try 140 ->psf); 141 x = source->peak->x; 142 y = source->peak->y; 143 144 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PSPHOT_MASK_MARKED); 145 status = pmSourceFitModel (source, modelPSF, true); 146 147 // skip poor fits 148 if (!status) { 149 try 150 ->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL; 151 psFree (modelPSF); 152 goto next_source; 153 } 154 155 // otherwise, save the resulting model 156 try 157 ->modelPSF->data[i] = modelPSF; 158 159 // XXX : use a different aperture radius from the fit radius? 160 // XXX : use a different estimator for the local sky? 161 // XXX : pass 'source' as input? 162 if (!pmSourcePhotometry (&fitMag, &obsMag, modelPSF, source->pixels, source->mask)) { 163 try 164 ->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT; 165 goto next_source; 166 } 167 168 try 169 ->metric->data.F64[i] = obsMag - fitMag; 170 try 171 ->fitMag->data.F64[i] = fitMag; 172 Npsf ++; 129 for (int i = 0; i < psfTry->sources->n; i++) { 130 // masked for: bad model fit, outlier in parameters 131 if (psfTry->mask->data.U8[i] & PSFTRY_MASK_ALL) 132 continue; 133 134 pmSource *source = psfTry->sources->data[i]; 135 pmModel *modelFLT = psfTry->modelFLT->data[i]; 136 137 // set shape for this model based on PSF 138 pmModel *modelPSF = pmModelFromPSF (modelFLT, psfTry->psf); 139 x = source->peak->x; 140 y = source->peak->y; 141 142 psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PSPHOT_MASK_MARKED); 143 status = pmSourceFitModel (source, modelPSF, true); 144 145 // skip poor fits 146 if (!status) { 147 psfTry->mask->data.U8[i] = PSFTRY_MASK_PSF_FAIL; 148 psFree (modelPSF); 149 goto next_source; 150 } 151 152 // otherwise, save the resulting model 153 psfTry->modelPSF->data[i] = modelPSF; 154 155 // XXX : use a different aperture radius from the fit radius? 156 // XXX : use a different estimator for the local sky? 157 // XXX : pass 'source' as input? 158 if (!pmSourcePhotometry (&fitMag, &obsMag, modelPSF, source->pixels, source->mask)) { 159 psfTry->mask->data.U8[i] = PSFTRY_MASK_BAD_PHOT; 160 goto next_source; 161 } 162 163 psfTry->metric->data.F64[i] = obsMag - fitMag; 164 psfTry->fitMag->data.F64[i] = fitMag; 165 Npsf ++; 173 166 174 167 next_source: 175 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", ~PSPHOT_MASK_MARKED);176 177 }168 psImageKeepCircle (source->mask, x, y, RADIUS, "AND", ~PSPHOT_MASK_MARKED); 169 170 } 178 171 psLogMsg ("psphot.psftry", 4, "fit psf: %f sec for %d sources\n", psTimerMark ("fit"), sources->n); 179 172 psTrace ("psphot.psftry", 3, "keeping %d of %d PSF candidates (PSF)\n", Npsf, sources->n); 180 173 181 174 // make this optional 182 // DumpModelFits ( try->modelPSF, "modelsPSF.dat");175 // DumpModelFits (psfTry->modelPSF, "modelsPSF.dat"); 183 176 184 177 // XXX this function wants aperture radius for pmSourcePhotometry 185 pmPSFtryMetric (try 186 , RADIUS); 178 pmPSFtryMetric (psfTry, RADIUS); 187 179 psLogMsg ("psphot.pspsf", 3, "try model %s, ap-fit: %f +/- %f, sky bias: %f\n", 188 modelName, try 189 ->psf->ApResid, try 190 ->psf->dApResid, try 191 ->psf->skyBias); 192 193 return (try 194 ); 180 modelName, 181 psfTry->psf->ApResid, 182 psfTry->psf->dApResid, 183 psfTry->psf->skyBias); 184 185 return (psfTry); 195 186 } 196 187 197 188 198 bool pmPSFtryMetric (pmPSFtry *try 199 , float RADIUS) 189 bool pmPSFtryMetric (pmPSFtry *psfTry, float RADIUS) 200 190 { 201 191 … … 203 193 int nKeep, nSkip; 204 194 205 // the measured (aperture - fit) magnitudes (dA == try->metric)195 // the measured (aperture - fit) magnitudes (dA == psfTry->metric) 206 196 // depend on both the true ap-fit (dAo) and the bias in the sky measurement: 207 197 // dA = dAo + dsky/flux … … 213 203 214 204 // rflux = ten(0.4*fitMag); 215 psVector *rflux = psVectorAlloc (try 216 ->sources->n, PS_TYPE_F64); 217 for (int i = 0; i < try 218 ->sources->n; i++) { 219 if (try 220 ->mask->data.U8[i] & PSFTRY_MASK_ALL) continue; 221 rflux->data.F64[i] = pow(10.0, 0.4*try 222 ->fitMag->data.F64[i]); 223 } 205 psVector *rflux = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64); 206 for (int i = 0; i < psfTry->sources->n; i++) { 207 if (psfTry->mask->data.U8[i] & PSFTRY_MASK_ALL) 208 continue; 209 rflux->data.F64[i] = pow(10.0, 0.4*psfTry->fitMag->data.F64[i]); 210 } 224 211 225 212 // find min and max of (1/flux): 226 213 psStats *stats = psStatsAlloc (PS_STAT_MIN | PS_STAT_MAX); 227 psVectorStats (stats, rflux, NULL, try 228 ->mask, PSFTRY_MASK_ALL); 214 psVectorStats (stats, rflux, NULL, psfTry->mask, PSFTRY_MASK_ALL); 229 215 230 216 // build binned versions of rflux, metric … … 240 226 for (int i = 0; i < daBin->n; i++) { 241 227 242 psVector *tmp = psVectorAlloc (try 243 ->sources->n, PS_TYPE_F64); 228 psVector *tmp = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64); 244 229 tmp->n = 0; 245 230 246 231 // accumulate data within bin range 247 for (int j = 0; j < try 248 ->sources->n; j++) { 249 // masked for: bad model fit, outlier in parameters 250 if (try 251 ->mask->data.U8[j] & PSFTRY_MASK_ALL) continue; 252 253 // skip points with extreme dA values 254 if (fabs(try 255 ->metric->data.F64[j]) > 0.5) continue; 256 257 // skip points outside of this bin 258 if (rflux->data.F64[j] < rfBin->data.F64[i] - 0.5*dBin) 259 continue; 260 if (rflux->data.F64[j] > rfBin->data.F64[i] + 0.5*dBin) 261 continue; 262 263 tmp->data.F64[tmp->n] = try 264 ->metric->data.F64[j]; 265 tmp->n ++; 266 } 232 for (int j = 0; j < psfTry->sources->n; j++) { 233 // masked for: bad model fit, outlier in parameters 234 if (psfTry->mask->data.U8[j] & PSFTRY_MASK_ALL) 235 continue; 236 237 // skip points with extreme dA values 238 if (fabs(psfTry->metric->data.F64[j]) > 0.5) 239 continue; 240 241 // skip points outside of this bin 242 if (rflux->data.F64[j] < rfBin->data.F64[i] - 0.5*dBin) 243 continue; 244 if (rflux->data.F64[j] > rfBin->data.F64[i] + 0.5*dBin) 245 continue; 246 247 tmp->data.F64[tmp->n] = psfTry->metric->data.F64[j]; 248 tmp->n ++; 249 } 267 250 268 251 // is this a valid point? … … 319 302 stats = psVectorStats (stats, daResid, NULL, maskB, 1); 320 303 321 try 322 ->psf->ApResid = poly->coeff[0]; 323 try 324 ->psf->dApResid = stats->clippedStdev; 325 try 326 ->psf->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS)); 304 psfTry->psf->ApResid = poly->coeff[0]; 305 psfTry->psf->dApResid = stats->clippedStdev; 306 psfTry->psf->skyBias = poly->coeff[1] / (M_PI * PS_SQR(RADIUS)); 327 307 328 308 psFree (rflux); -
branches/rel9/psModules/src/objects/pmPSFtry.h
r5255 r5768 6 6 * @author EAM, IfA 7 7 * 8 * @version $Revision: 1.1 $ $Name: not supported by cvs2svn $9 * @date $Date: 2005-1 0-10 19:53:40$8 * @version $Revision: 1.1.8.1 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-12-12 21:52:22 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 105 105 */ 106 106 bool pmPSFtryMetric( 107 pmPSFtry *try 108 , ///< Add comment. 109 float RADIUS ///< Add comment. 107 pmPSFtry *psfTry, ///< Add comment. 108 float RADIUS ///< Add comment. 110 109 ); 111 110 -
branches/rel9/psModules/test/astrom/tst_pmAstrometry01.c
r5681 r5768 1 1 /** @file tst_psAstrometry01.c 2 * 3 * @brief This code will test the pmFPA hierarchy transform code in psAstrometry.[ch] 4 * 5 * @author GLG, MHPCC 6 * 7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-12-05 21:28:55 $ 9 * 10 * XXX: Add tests were the coordinate does not transform to any legitimate cell 11 * or chip, or FPA, or whatever. 12 * 13 * XXX: For each function, add tests for bad input parameters, as well as failed transforms. 14 * 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 16 */ 2 * 3 * @brief This code will test the pmFPA hierarchy transform code in psAstrometry.[ch] 4 * 5 * @author GLG, MHPCC 6 * 7 * @version $Revision: 1.2.2.1 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-12-12 21:52:24 $ 9 * 10 * XXX: Add tests were the coordinate does not transform to any legitimate cell 11 * or chip, or FPA, or whatever. 12 * 13 * XXX: For each function, add tests for bad input parameters, as well as failed transforms. 14 * 15 * XXX: Must test pmFPASelectChip() and pmFPAExcludeChip(). 16 * 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 18 */ 19 17 20 #include "config.h" 18 21 #include <math.h> … … 23 26 static psS32 test3( void ); 24 27 static psS32 test4( void ); 28 static psS32 test5( void ); 25 29 26 30 testDescription tests[] = { 27 31 {test3, -3, "pmAstrometry focal plane transformations", 0, false}, 28 32 {test4, -3, "pmCheckParents()", 0, false}, 33 {test5, -3, "pmFPASelectChip() and pmFPAExcludeChip()", 0, false}, 29 34 {NULL} 30 35 }; … … 584 589 return(testStatus); 585 590 } 591 592 /****************************************************************************** 593 test5(): This routine wil test the pmFPASelectChip() and pmFPAExcludeChip() 594 functions. We generate an pmFPA hierarchy, then set the ->valid members with 595 those routines, then verify. 596 *****************************************************************************/ 597 psS32 test5( void ) 598 { 599 psS32 testStatus = 0; 600 pmChip *tmpChip = NULL; 601 602 // 603 // Generate a pmFPA hierarchy. 604 // 605 pmFPA *tmpFPA = genSystem(); 606 607 // 608 // We test the ->valid member for each chip. 609 // 610 for (psS32 i = 0 ; i < tmpFPA->chips->n ; i++) { 611 tmpChip = (pmChip *) tmpFPA->chips->data[i]; 612 if ((tmpChip == NULL) || (tmpChip->valid != false)) { 613 printf("TEST ERROR: Could not properly generate an FPA hierarchy.\n"); 614 testStatus = 1; 615 } 616 } 617 618 // 619 // Exclude chip number 0, include all others, then test return value 620 // 621 psS32 numChips = pmFPAExcludeChip(tmpFPA, 0); 622 if (numChips != (NUM_CHIPS-1)) { 623 printf("TEST ERROR: pmFPAExcludeChip() did not return the correct number of chips.\n"); 624 testStatus = 2; 625 } 626 627 // 628 // We test the ->valid member for each chip. 629 // 630 tmpChip = (pmChip *) tmpFPA->chips->data[0]; 631 if (tmpChip->valid != false) { 632 printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valid to FALSE.\n"); 633 testStatus = 3; 634 } 635 for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) { 636 pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i]; 637 if (tmpChip->valid != true) { 638 printf("TEST ERROR: pmFPAExcludeChip() did not set the proper chip->valids to FALSE.\n"); 639 testStatus = 4; 640 } 641 } 642 643 644 // 645 // Include chip number 0, exclude all others, then test return value 646 // 647 psBool tmpBool = pmFPASelectChip(tmpFPA, 0); 648 if (tmpBool != true) { 649 printf("TEST ERROR: pmFPASelectChip() returned FALSE.\n"); 650 testStatus = 5; 651 } 652 653 // 654 // We test the ->valid member for each chip. 655 // 656 tmpChip = (pmChip *) tmpFPA->chips->data[0]; 657 if (tmpChip->valid != true) { 658 printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valid to FALSE.\n"); 659 testStatus = 6; 660 } 661 for (psS32 i = 1 ; i < tmpFPA->chips->n ; i++) { 662 pmChip *tmpChip = (pmChip *) tmpFPA->chips->data[i]; 663 if (tmpChip->valid != false) { 664 printf("TEST ERROR: pmFPASelectChip() did not set the proper chip->valids to FALSE.\n"); 665 testStatus = 7; 666 } 667 } 668 669 psFree(tmpFPA); 670 return(testStatus); 671 }
Note:
See TracChangeset
for help on using the changeset viewer.
