Changeset 24529
- Timestamp:
- Jun 23, 2009, 7:53:02 AM (17 years ago)
- Location:
- branches/eam_branches/20090522
- Files:
-
- 5 added
- 16 edited
-
ippconfig/recipes/psphot.config (modified) (2 diffs)
-
ppSim/src/ppSimArguments.c (modified) (1 diff)
-
ppSim/src/ppSimUtils.c (modified) (1 diff)
-
psModules/src/imcombine/pmPSFEnvelope.c (modified) (1 diff)
-
psModules/src/objects/pmSource.c (modified) (5 diffs)
-
psModules/src/objects/pmSource.h (modified) (1 diff)
-
psModules/src/objects/pmSourceGroup.h (added)
-
psModules/src/objects/pmSourceIO_RAW.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMoments.c (modified) (8 diffs)
-
psModules/src/objects/pmSourceUtils.c (modified) (1 diff)
-
psModules/test/objects/tap_pmSource.c (modified) (3 diffs)
-
psphot/doc/notes.20090523.txt (added)
-
psphot/doc/stack.txt (added)
-
psphot/src/Makefile.am (modified) (3 diffs)
-
psphot/src/psphotArguments.c (modified) (9 diffs)
-
psphot/src/psphotFitSourcesLinearStack.c (added)
-
psphot/src/psphotModelTest.c (modified) (1 diff)
-
psphot/src/psphotMomentsStudy.c (added)
-
psphot/src/psphotSourceFits.c (modified) (1 diff)
-
psphot/src/psphotSourceStats.c (modified) (6 diffs)
-
psphot/src/psphotVisual.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090522/ippconfig/recipes/psphot.config
r23301 r24529 11 11 SAVE.PLOTS BOOL FALSE 12 12 13 # format for output CMF files 14 OUTPUT.FORMAT STR PS1_V1 15 13 16 # the zero point is used to set a basic scale for DVO 14 17 # XXX it may not currently be read : double check this (EAM) 15 18 ZERO_POINT F32 25.000 # zero point used by DVO 16 19 ZERO_PT F32 25.000 # zero point used by DVO 17 18 OUTPUT.FORMAT STR PS1_V119 20 20 21 # these parameter govern how the background is measured … … 53 54 MOMENTS_SY_MAX F32 50.0 54 55 MOMENTS_AR_MAX F32 1.5 # maximum axial ratio: 1 / AR < (sx / sy) < AR 56 MOMENTS_MIN_PIXEL_SN F32 1.0 # XXX caution on this: too high and we will excessively clip 57 MOMENTS_GAUSS_SIGMA F32 2.0 # XXX TEST THIS: sigma in pixels (should be >> seeing equiv) 55 58 56 59 # basic object statistics -
branches/eam_branches/20090522/ppSim/src/ppSimArguments.c
r24099 r24529 169 169 } 170 170 ppSimType type = ppSimTypeFromString (typeStr); 171 // XXX handle error 171 172 172 173 ppSimArgToRecipeStr(&status, options, "FILTER", arguments, "-filter"); // Filter name -
branches/eam_branches/20090522/ppSim/src/ppSimUtils.c
r24099 r24529 117 117 if (!strcasecmp (typeStr, "OBJECT")) return PPSIM_TYPE_OBJECT; 118 118 psAbort("Should never get here."); 119 // XXX raise error instead of aborting 119 120 } 120 121 -
branches/eam_branches/20090522/psModules/src/imcombine/pmPSFEnvelope.c
r24212 r24529 298 298 } 299 299 300 if (!pmSourceMoments(source, maxRadius)) { 300 // measure the source moments: tophat windowing, pixel S/N > 1.0 301 if (!pmSourceMoments(source, maxRadius, 0.0, 1.0)) { 301 302 // Can't do anything about it; limp along as best we can 302 303 psErrorClear(); -
branches/eam_branches/20090522/psModules/src/objects/pmSource.c
r23989 r24529 291 291 292 292 bool status = true; // Status of MD lookup 293 float PSF_ CLUMP_SN_LIM = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_SN_LIM");293 float PSF_SN_LIM = psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); 294 294 if (!status) { 295 PSF_ CLUMP_SN_LIM = 0;295 PSF_SN_LIM = 0; 296 296 } 297 297 float PSF_CLUMP_GRID_SCALE = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_GRID_SCALE"); … … 342 342 } 343 343 344 if (src->moments->SN < PSF_ CLUMP_SN_LIM) {344 if (src->moments->SN < PSF_SN_LIM) { 345 345 psTrace("psModules.objects", 10, "Rejecting source from clump because of low S/N (%f)\n", 346 346 src->moments->SN); … … 450 450 if (tmpSrc->moments == NULL) 451 451 continue; 452 if (tmpSrc->moments->SN < PSF_ CLUMP_SN_LIM)452 if (tmpSrc->moments->SN < PSF_SN_LIM) 453 453 continue; 454 454 … … 534 534 bool status; 535 535 float PSF_SN_LIM = psMetadataLookupF32 (&status, recipe, "PSF_SN_LIM"); 536 if (!status) 537 PSF_SN_LIM = 20.0; 536 if (!status) PSF_SN_LIM = 20.0; 538 537 float PSF_CLUMP_NSIGMA = psMetadataLookupF32 (&status, recipe, "PSF_CLUMP_NSIGMA"); 539 if (!status) 540 PSF_CLUMP_NSIGMA = 1.5; 541 float INNER_RADIUS = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");538 if (!status) PSF_CLUMP_NSIGMA = 1.5; 539 540 // float INNER_RADIUS = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS"); 542 541 543 542 pmSourceMode noMoments = PM_SOURCE_MODE_MOMENTS_FAILURE | PM_SOURCE_MODE_SKYVAR_FAILURE | PM_SOURCE_MODE_SKY_FAILURE | PM_SOURCE_MODE_BELOW_MOMENTS_SN; … … 582 581 source->type = PM_SOURCE_TYPE_STAR; 583 582 source->mode |= PM_SOURCE_MODE_SATSTAR; 584 // recalculate moments here with larger box? 585 pmSourceMoments (source, INNER_RADIUS); 583 // why do we recalculate moments here? 584 // we already attempt to do this in psphotSourceStats 585 // pmSourceMoments (source, INNER_RADIUS); 586 586 Nsatstar ++; 587 587 continue; -
branches/eam_branches/20090522/psModules/src/objects/pmSource.h
r23487 r24529 213 213 */ 214 214 bool pmSourceMoments( 215 pmSource *source, ///< The input pmSource for which moments will be computed 216 float radius ///< Use a circle of pixels around the peak 215 pmSource *source, ///< The input pmSource for which moments will be computed 216 float radius, ///< Use a circle of pixels around the peak 217 float sigma, ///< size of Gaussian window function (<= 0.0 -> skip window) 218 float minSN ///< minimum pixel significance 217 219 ); 218 220 -
branches/eam_branches/20090522/psModules/src/objects/pmSourceIO_RAW.c
r20937 r24529 254 254 } 255 255 256 fprintf (f, "# %5s %5s %8s %7s %7s %6s %6s %10s %7s %7s %7s %4s %4s %5s\n", 257 "x", "y", "peak", "Mx", "My", "Mxx", "Myy", "Sum", "Peak", "Sky", "SN", "nPix", "type", "mode"); 258 256 259 for (i = 0; i < sources->n; i++) { 257 260 source = sources->data[i]; 258 261 if (source->moments == NULL) 259 262 continue; 260 fprintf (f, "%5d %5d % 7.1f %7.1f %7.1f %6.3f %6.3f %10.1f %7.1f %7.1f %7.1f %4d %2d %#5x\n",263 fprintf (f, "%5d %5d %8.1f %7.1f %7.1f %6.3f %6.3f %10.1f %7.1f %7.1f %7.1f %4d %2d %#5x\n", 261 264 source->peak->x, source->peak->y, source->peak->value, 262 265 source->moments->Mx, source->moments->My, -
branches/eam_branches/20090522/psModules/src/objects/pmSourceMoments.c
r21363 r24529 57 57 # define VALID_RADIUS(X,Y,RAD2) (((RAD2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0) 58 58 59 bool pmSourceMoments(pmSource *source, psF32 radius )59 bool pmSourceMoments(pmSource *source, psF32 radius, psF32 sigma, psF32 minSN) 60 60 { 61 61 PS_ASSERT_PTR_NON_NULL(source, false); … … 84 84 psF32 Y1 = 0.0; 85 85 psF32 R2 = PS_SQR(radius); 86 psF32 minSN2 = PS_SQR(minSN); 87 psF32 rsigma2 = 0.5 / PS_SQR(sigma); 86 88 87 89 // a note about coordinates: coordinates of objects throughout psphot refer to the primary … … 97 99 98 100 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 101 102 psF32 yDiff = row - yPeak; 103 if (fabs(yDiff) > radius) continue; 99 104 100 105 psF32 *vPix = source->pixels->data.F32[row]; … … 113 118 114 119 psF32 xDiff = col - xPeak; 115 psF32 yDiff = row - yPeak;120 if (fabs(xDiff) > radius) continue; 116 121 117 122 // radius is just a function of (xDiff, yDiff) … … 121 126 psF32 wDiff = *vWgt; 122 127 123 // XXX EAM : should this limit be user-defined? 124 if (PS_SQR(pDiff) < wDiff) continue; 125 126 Var += wDiff; 127 Sum += pDiff; 128 129 psF32 xWght = xDiff * pDiff; 130 psF32 yWght = yDiff * pDiff; 131 132 X1 += xWght; 133 Y1 += yWght; 128 // skip pixels below specified significance level 129 if (PS_SQR(pDiff) < minSN2*wDiff) continue; 130 if (pDiff < 0) continue; 131 132 if (sigma > 0.0) { 133 // apply a pseudo-gaussian weight 134 135 // XXX a lot of extra flops; can we do pre-calculate? 136 psF32 z = (PS_SQR(xDiff) + PS_SQR(yDiff))*rsigma2; 137 assert (z >= 0.0); 138 psF32 t = 1.0 + z*(1.0 + z/2.0*(1.0 + z/3.0)); 139 psF32 weight = 1.0 / t; 140 141 // fprintf (stderr, "%6.1f %6.1f %8.1f %8.1f %5.3f ", xDiff, yDiff, pDiff, wDiff, weight); 142 143 wDiff *= weight; 144 pDiff *= weight; 145 } 146 147 Var += wDiff; 148 Sum += pDiff; 149 150 psF32 xWght = xDiff * pDiff; 151 psF32 yWght = yDiff * pDiff; 152 153 X1 += xWght; 154 Y1 += yWght; 155 156 // fprintf (stderr, " : %6.1f %6.1f %8.1f %8.1f\n", X1, Y1, Sum, Var); 134 157 135 158 peakPixel = PS_MAX (*vPix, peakPixel); … … 188 211 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 189 212 213 psF32 yDiff = row - yCM; 214 if (fabs(yDiff) > radius) continue; 215 190 216 psF32 *vPix = source->pixels->data.F32[row]; 191 217 psF32 *vWgt = source->variance->data.F32[row]; … … 203 229 204 230 psF32 xDiff = col - xCM; 205 psF32 yDiff = row - yCM;231 if (fabs(xDiff) > radius) continue; 206 232 207 233 // radius is just a function of (xDiff, yDiff) … … 215 241 // XXX EAM : should this limit be user-defined? 216 242 217 if (PS_SQR(pDiff) < wDiff) continue;243 if (PS_SQR(pDiff) < minSN2*wDiff) continue; 218 244 if (pDiff < 0) continue; 245 246 if (sigma > 0.0) { 247 // apply a pseudo-gaussian weight 248 249 // XXX a lot of extra flops; can we do pre-calculate? 250 psF32 z = (PS_SQR(xDiff) + PS_SQR(yDiff))*rsigma2; 251 assert (z >= 0.0); 252 psF32 t = 1.0 + z*(1.0 + z/2.0*(1.0 + z/3.0)); 253 psF32 weight = 1.0 / t; 254 255 // fprintf (stderr, "%6.1f %6.1f %8.1f %8.1f %5.3f ", xDiff, yDiff, pDiff, wDiff, weight); 256 257 wDiff *= weight; 258 pDiff *= weight; 259 } 219 260 220 261 Sum += pDiff; -
branches/eam_branches/20090522/psModules/src/objects/pmSourceUtils.c
r23187 r24529 94 94 source->peak = pmPeakAlloc (xChip, yChip, Io, PM_PEAK_LONE); 95 95 96 int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 97 int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 98 int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY"); 99 int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY"); 96 float xReadout, yReadout; 100 97 101 // XXX fix the binning : currently not selected from concepts 102 // int xBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); // Binning in x and y 103 // int yBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.YBIN"); // Binning in x and y 104 int xBin = 1; 105 int yBin = 1; 98 // if we have information about the chip & cell, adjust the coordinates chip->cell->readout 99 // otherwise, assume 0,0 offset and 1,1 parity 100 if (cell) { 101 int x0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.X0"); 102 int y0Cell = psMetadataLookupS32(NULL, cell->concepts, "CELL.Y0"); 103 int xParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.XPARITY"); 104 int yParityCell = psMetadataLookupS32(NULL, cell->concepts, "CELL.YPARITY"); 106 105 107 // Position on the cell 108 float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, xBin); 109 float yCell = PM_CHIP_TO_CELL(yChip, y0Cell, yParityCell, yBin); 106 // XXX fix the binning : currently not selected from concepts 107 // int xBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.XBIN"); // Binning in x and y 108 // int yBin = psMetadataLookupS32(NULL, cell->concepts, "CELL.YBIN"); // Binning in x and y 109 int xBin = 1; 110 int yBin = 1; 110 111 111 // Position on the readout 112 // float xReadout = CELL_TO_READOUT(xCell, x0Readout); 113 // float yReadout = CELL_TO_READOUT(yCell, y0Readout); 112 // Position on the cell 113 float xCell = PM_CHIP_TO_CELL(xChip, x0Cell, xParityCell, xBin); 114 float yCell = PM_CHIP_TO_CELL(yChip, y0Cell, yParityCell, yBin); 115 116 // Position on the readout 117 // float xReadout = CELL_TO_READOUT(xCell, x0Readout); 118 // float yReadout = CELL_TO_READOUT(yCell, y0Readout); 119 xReadout = xCell; 120 yReadout = yCell; 121 } else { 122 xReadout = xChip; 123 yReadout = yChip; 124 } 114 125 115 pmSourceDefinePixels (source, readout, x Cell, yCell, radius);126 pmSourceDefinePixels (source, readout, xReadout, yReadout, radius); 116 127 117 128 return (source); -
branches/eam_branches/20090522/psModules/test/objects/tap_pmSource.c
r21471 r24529 432 432 psArray *sources = psArrayAlloc(NUM_SOURCES); 433 433 psMetadata *recipe = psMetadataAlloc(); 434 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_ CLUMP_SN_LIM", 0, NULL, 0.0);434 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_SN_LIM", 0, NULL, 0.0); 435 435 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SX_MAX", 0, NULL, 10.0); 436 436 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SY_MAX", 0, NULL, 10.0); … … 452 452 psArray *sources = psArrayAlloc(NUM_SOURCES); 453 453 psMetadata *recipe = psMetadataAlloc(); 454 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_ CLUMP_SN_LIM", 0, NULL, 0.0);454 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_SN_LIM", 0, NULL, 0.0); 455 455 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SX_MAX", 0, NULL, 10.0); 456 456 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SY_MAX", 0, NULL, 10.0); … … 490 490 } 491 491 psMetadata *recipe = psMetadataAlloc(); 492 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_ CLUMP_SN_LIM", 0, NULL, 0.0);492 bool rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "PSF_SN_LIM", 0, NULL, 0.0); 493 493 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SX_MAX", 0, NULL, 10.0); 494 494 rc = psMetadataAddF32(recipe, PS_LIST_HEAD, "MOMENTS_SY_MAX", 0, NULL, 10.0); -
branches/eam_branches/20090522/psphot/src/Makefile.am
r23808 r24529 16 16 17 17 # Force recompilation of psphotVersion.c, since it gets the version information 18 psphotVersion.c: psphotVersionDefinitions.h19 psphotVersionDefinitions.h: psphotVersionDefinitions.h.in FORCE20 -$(RM) psphotVersionDefinitions.h21 $(SED) -e "s|@PSPHOT_VERSION@|\"$(PSPHOT_VERSION)\"|" -e "s|@PSPHOT_BRANCH@|\"$(PSPHOT_BRANCH)\"|" -e "s|@PSPHOT_SOURCE@|\"$(PSPHOT_SOURCE)\"|" psphotVersionDefinitions.h.in > psphotVersionDefinitions.h22 FORCE: ;18 # psphotVersion.c: psphotVersionDefinitions.h 19 # psphotVersionDefinitions.h: psphotVersionDefinitions.h.in FORCE 20 # -$(RM) psphotVersionDefinitions.h 21 # $(SED) -e "s|@PSPHOT_VERSION@|\"$(PSPHOT_VERSION)\"|" -e "s|@PSPHOT_BRANCH@|\"$(PSPHOT_BRANCH)\"|" -e "s|@PSPHOT_SOURCE@|\"$(PSPHOT_SOURCE)\"|" psphotVersionDefinitions.h.in > psphotVersionDefinitions.h 22 # FORCE: ; 23 23 24 24 libpsphot_la_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 25 25 libpsphot_la_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 26 26 27 bin_PROGRAMS = psphot psphotTest 27 bin_PROGRAMS = psphot psphotTest psphotMomentsStudy 28 28 29 29 psphot_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) … … 34 34 psphotTest_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 35 35 psphotTest_LDADD = libpsphot.la 36 37 psphotMomentsStudy_CFLAGS = $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) 38 psphotMomentsStudy_LDFLAGS = $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 39 psphotMomentsStudy_LDADD = libpsphot.la 36 40 37 41 psphot_SOURCES = \ … … 54 58 psphotTest_SOURCES = \ 55 59 psphotTest.c 60 61 psphotMomentsStudy_SOURCES = \ 62 psphotMomentsStudy.c 56 63 57 64 libpsphot_la_SOURCES = \ -
branches/eam_branches/20090522/psphot/src/psphotArguments.c
r24144 r24529 105 105 pmConfig *config = pmConfigRead(&argc, argv, PSPHOT_RECIPE); 106 106 if (config == NULL) { 107 psError(PSPHOT_ERR_CONFIG, false, "Can't read site configuration");107 psErrorStackPrint(stderr, "Can't read site configuration"); 108 108 exit(PS_EXIT_CONFIG_ERROR); 109 109 } … … 121 121 if ((N = psArgumentGet (argc, argv, "-modeltest"))) { 122 122 if (argc<=N+2) { 123 psError(PSPHOT_ERR_ARGUMENTS, true, 124 "Expected to see 2 more arguments; saw %d", argc - 1); 123 psErrorStackPrint(stderr, "Expected to see 2 more arguments; saw %d", argc - 1); 125 124 exit(PS_EXIT_CONFIG_ERROR); 126 125 } … … 137 136 if ((N = psArgumentGet (argc, argv, "-model"))) { 138 137 if (argc<=N+1) { 139 psError(PSPHOT_ERR_ARGUMENTS, true, 140 "Expected to see 1 more argument; saw %d", argc - 1); 138 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 141 139 exit(PS_EXIT_CONFIG_ERROR); 142 140 } … … 149 147 if ((N = psArgumentGet (argc, argv, "-fitmode"))) { 150 148 if (argc<=N+1) { 151 psError(PSPHOT_ERR_ARGUMENTS, true, 152 "Expected to see 1 more argument; saw %d", argc - 1); 149 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 153 150 exit(PS_EXIT_CONFIG_ERROR); 154 151 } … … 159 156 if ((N = psArgumentGet (argc, argv, "-fitset"))) { 160 157 if (argc<=N+1) { 161 psError(PSPHOT_ERR_ARGUMENTS, true, 162 "Expected to see 1 more argument; saw %d", argc - 1); 158 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 163 159 exit(PS_EXIT_CONFIG_ERROR); 164 160 } … … 172 168 if ((N = psArgumentGet (argc, argv, "-photcode"))) { 173 169 if (argc<=N+1) { 174 psError(PSPHOT_ERR_ARGUMENTS, true, 175 "Expected to see 1 more argument; saw %d", argc - 1); 170 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 176 171 exit(PS_EXIT_CONFIG_ERROR); 177 172 } … … 190 185 if ((N = psArgumentGet (argc, argv, "-break"))) { 191 186 if (argc<=N+1) { 192 psError(PSPHOT_ERR_ARGUMENTS, true, 193 "Expected to see 1 more argument; saw %d", argc - 1); 187 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 194 188 exit(PS_EXIT_CONFIG_ERROR); 195 189 } … … 202 196 if ((N = psArgumentGet (argc, argv, "-region"))) { 203 197 if (argc<=N+1) { 204 psError(PSPHOT_ERR_ARGUMENTS, true, 205 "Expected to see 1 more argument; saw %d", argc - 1); 198 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 206 199 exit(PS_EXIT_CONFIG_ERROR); 207 200 } … … 214 207 if ((N = psArgumentGet (argc, argv, "-chip"))) { 215 208 if (argc<=N+1) { 216 psError(PSPHOT_ERR_ARGUMENTS, true, 217 "Expected to see 1 more argument; saw %d", argc - 1); 209 psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1); 218 210 exit(PS_EXIT_CONFIG_ERROR); 219 211 } -
branches/eam_branches/20090522/psphot/src/psphotModelTest.c
r21183 r24529 139 139 140 140 // get the source moments 141 status = pmSourceMoments (source, mRADIUS );141 status = pmSourceMoments (source, mRADIUS, 0.0, 1.0); 142 142 if (!status) psAbort("psSourceMoments error"); 143 143 source->peak->value = source->moments->Peak; -
branches/eam_branches/20090522/psphot/src/psphotSourceFits.c
r24188 r24529 224 224 225 225 // recalculate the source moments using the larger extended-source moments radius 226 if (!pmSourceMoments (source, EXT_MOMENTS_RAD)) return false; 226 // at this stage, skip Gaussian windowing, and allow pixels with S/N > 0.5 227 if (!pmSourceMoments (source, EXT_MOMENTS_RAD, 0.0, 0.5)) return false; 227 228 228 229 psTrace ("psphot", 5, "trying blob...\n"); -
branches/eam_branches/20090522/psphot/src/psphotSourceStats.c
r23219 r24529 89 89 90 90 if (!psThreadJobAddPending(job)) { 91 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");91 psError(PS_ERR_UNKNOWN, false, "Unable to launch thread job PSPHOT_SOURCE_STATS"); 92 92 psFree (job); 93 93 return NULL; 94 94 } 95 95 psFree(job); 96 97 # if (0)98 int nfail = 0;99 int nmoments = 0;100 if (!psphotSourceStats_Unthreaded (&nfail, &nmoments, cells->data[j], recipe)) {101 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");102 return NULL;103 }104 Nfail += nfail;105 Nmoments += nmoments;106 # endif107 96 } 108 97 109 98 // wait for the threads to finish and manage results 110 99 if (!psThreadPoolWait (false)) { 111 psError(PS_ERR_UNKNOWN, false, " Unable to guess model.");100 psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS"); 112 101 return NULL; 113 102 } … … 149 138 psMetadata *recipe = job->args->data[1]; 150 139 151 float INNER = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS"); 152 if (!status) return false; 153 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN"); 154 if (!status) return false; 155 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS"); 140 float INNER = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS"); 141 if (!status) return false; 142 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN"); 143 if (!status) return false; 144 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS"); 145 if (!status) return false; 146 float MIN_PIXEL_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_MIN_PIXEL_SN"); 147 if (!status) return false; 148 float SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA"); 156 149 if (!status) return false; 157 150 … … 202 195 203 196 // measure basic source moments 204 status = pmSourceMoments (source, RADIUS );197 status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN); 205 198 if (status) { 206 199 Nmoments ++; … … 212 205 BIG_RADIUS = PS_MIN (INNER, 3*RADIUS); 213 206 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 214 status = pmSourceMoments (source, BIG_RADIUS );207 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN); 215 208 if (status) { 216 209 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; … … 292 285 293 286 // measure basic source moments 294 status = pmSourceMoments (source, RADIUS );287 status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN); 295 288 if (status) { 296 289 Nmoments ++; … … 302 295 BIG_RADIUS = PS_MIN (INNER, 3*RADIUS); 303 296 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 304 status = pmSourceMoments (source, BIG_RADIUS );297 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN); 305 298 if (status) { 306 299 Nmoments ++; -
branches/eam_branches/20090522/psphot/src/psphotVisual.c
r23259 r24529 471 471 bool status; 472 472 Graphdata graphdata; 473 474 if (!pmVisualIsVisual()) return true; 473 KapaSection section; 474 475 // if (!pmVisualIsVisual()) return true; 475 476 476 477 if (kapa3 == -1) { … … 485 486 KapaClearPlots (kapa3); 486 487 KapaInitGraph (&graphdata); 487 488 // there are N regions: use the first (guaranteed to exist) to get the overall limits 489 psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, "PSF.CLUMP.REGION.000"); 490 491 float psfX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X"); 492 float psfY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y"); 493 494 // examine sources to set data range 495 graphdata.xmin = -0.05; 496 graphdata.ymin = -0.05; 497 graphdata.xmax = 2.0*psfX; 498 graphdata.ymax = 2.0*psfY; 499 KapaSetLimits (kapa3, &graphdata); 500 501 KapaSetFont (kapa3, "helvetica", 14); 502 KapaBox (kapa3, &graphdata); 503 KapaSendLabel (kapa3, "&ss&h_x| (pixels)", KAPA_LABEL_XM); 504 KapaSendLabel (kapa3, "&ss&h_y| (pixels)", KAPA_LABEL_YM); 505 488 KapaSetFont (kapa3, "courier", 14); 489 490 float SN_LIM = psMetadataLookupF32(&status, recipe, "PSF_SN_LIM"); 491 492 // select the max psfX,Y values for the plot limits 493 float Xmin = 0.0, Xmax = 0.0; 494 float Ymin = 0.0, Ymax = 0.0; 495 { 496 int nRegions = psMetadataLookupS32 (&status, recipe, "PSF.CLUMP.NREGIONS"); 497 for (int n = 0; n < nRegions; n++) { 498 499 char regionName[64]; 500 snprintf (regionName, 64, "PSF.CLUMP.REGION.%03d", n); 501 psMetadata *regionMD = psMetadataLookupPtr (&status, recipe, regionName); 502 503 float psfX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.X"); 504 float psfY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.Y"); 505 float psfdX = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DX"); 506 float psfdY = psMetadataLookupF32 (&status, regionMD, "PSF.CLUMP.DY"); 507 508 float X0 = psfX - 4.0*psfdX; 509 float X1 = psfX + 4.0*psfdX; 510 float Y0 = psfY - 4.0*psfdY; 511 float Y1 = psfY + 4.0*psfdY; 512 513 if (isfinite(X0)) { Xmin = PS_MAX(Xmin, X0); } 514 if (isfinite(X1)) { Xmax = PS_MAX(Xmax, X1); } 515 if (isfinite(Y0)) { Ymin = PS_MAX(Ymin, Y0); } 516 if (isfinite(Y1)) { Ymax = PS_MAX(Ymax, Y1); } 517 } 518 } 519 520 // storage vectors for data to be plotted 506 521 psVector *xBright = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 507 522 psVector *yBright = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 523 psVector *mBright = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 508 524 psVector *xFaint = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 509 525 psVector *yFaint = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 526 psVector *mFaint = psVectorAllocEmpty (sources->n, PS_TYPE_F32); 510 527 511 528 // construct the vectors … … 519 536 xFaint->data.F32[nF] = source->moments->Mxx; 520 537 yFaint->data.F32[nF] = source->moments->Myy; 538 mFaint->data.F32[nF] = -2.5*log10(source->moments->Sum); 521 539 nF++; 522 540 523 541 // XXX make this a user-defined cutoff 524 if (source->moments->SN < 50)542 if (source->moments->SN < SN_LIM) 525 543 continue; 526 544 527 545 xBright->data.F32[nB] = source->moments->Mxx; 528 546 yBright->data.F32[nB] = source->moments->Myy; 547 mBright->data.F32[nB] = -2.5*log10(source->moments->Sum); 529 548 nB++; 530 549 } 531 550 xFaint->n = nF; 532 551 yFaint->n = nF; 552 mFaint->n = nF; 533 553 534 554 xBright->n = nB; 535 555 yBright->n = nB; 556 mBright->n = nB; 557 558 // three sections: MxxMyy, MagMxx, MagMyy 559 560 // first section: MxxMyy 561 section.dx = 0.75; 562 section.dy = 0.75; 563 section.x = 0.00; 564 section.y = 0.00; 565 section.name = psStringCopy ("MxxMyy"); 566 KapaSetSection (kapa3, §ion); 567 psFree (section.name); 568 569 graphdata.color = KapaColorByName ("black"); 570 graphdata.xmin = Xmin; 571 graphdata.ymin = Ymin; 572 graphdata.xmax = Xmax; 573 graphdata.ymax = Ymax; 574 KapaSetLimits (kapa3, &graphdata); 575 576 KapaBox (kapa3, &graphdata); 577 KapaSendLabel (kapa3, "M_xx| (pixels)", KAPA_LABEL_XM); 578 KapaSendLabel (kapa3, "M_yy| (pixels)", KAPA_LABEL_YM); 536 579 537 580 graphdata.color = KapaColorByName ("black"); … … 551 594 KapaPlotVector (kapa3, nB, yBright->data.F32, "y"); 552 595 553 // XXX draw N circles to outline the clumps 596 // second section: MagMyy 597 section.dx = 0.75; 598 section.dy = 0.25; 599 section.x = 0.00; 600 section.y = 0.80; 601 section.name = psStringCopy ("MagMyy"); 602 KapaSetSection (kapa3, §ion); 603 psFree (section.name); 604 605 graphdata.color = KapaColorByName ("black"); 606 graphdata.xmin = -17.1; 607 graphdata.xmax = -7.9; 608 graphdata.ymin = Ymin; 609 graphdata.ymax = Ymax; 610 KapaSetLimits (kapa3, &graphdata); 611 612 strcpy (graphdata.labels, "0210"); 613 KapaBox (kapa3, &graphdata); 614 KapaSendLabel (kapa3, "inst mag", KAPA_LABEL_XP); 615 KapaSendLabel (kapa3, "M_yy| (pixels)", KAPA_LABEL_YM); 616 617 graphdata.color = KapaColorByName ("black"); 618 graphdata.ptype = 0; 619 graphdata.size = 0.3; 620 graphdata.style = 2; 621 KapaPrepPlot (kapa3, nF, &graphdata); 622 KapaPlotVector (kapa3, nF, mFaint->data.F32, "x"); 623 KapaPlotVector (kapa3, nF, yFaint->data.F32, "y"); 624 625 graphdata.color = KapaColorByName ("red"); 626 graphdata.ptype = 2; 627 graphdata.size = 0.5; 628 graphdata.style = 2; 629 KapaPrepPlot (kapa3, nB, &graphdata); 630 KapaPlotVector (kapa3, nB, mBright->data.F32, "x"); 631 KapaPlotVector (kapa3, nB, yBright->data.F32, "y"); 632 633 // third section: MagMxx 634 section.dx = 0.25; 635 section.dy = 0.75; 636 section.x = 0.80; 637 section.y = 0.00; 638 section.name = psStringCopy ("MagMxx"); 639 KapaSetSection (kapa3, §ion); 640 psFree (section.name); 641 642 graphdata.color = KapaColorByName ("black"); 643 graphdata.xmin = Xmin; 644 graphdata.xmax = Xmax; 645 graphdata.ymin = -7.9; 646 graphdata.ymax = -17.1; 647 KapaSetLimits (kapa3, &graphdata); 648 649 strcpy (graphdata.labels, "2001"); 650 KapaBox (kapa3, &graphdata); 651 KapaSendLabel (kapa3, "M_xx| (pixels)", KAPA_LABEL_XM); 652 KapaSendLabel (kapa3, "inst mag", KAPA_LABEL_YP); 653 654 graphdata.color = KapaColorByName ("black"); 655 graphdata.ptype = 0; 656 graphdata.size = 0.3; 657 graphdata.style = 2; 658 KapaPrepPlot (kapa3, nF, &graphdata); 659 KapaPlotVector (kapa3, nF, xFaint->data.F32, "x"); 660 KapaPlotVector (kapa3, nF, mFaint->data.F32, "y"); 661 662 graphdata.color = KapaColorByName ("red"); 663 graphdata.ptype = 2; 664 graphdata.size = 0.5; 665 graphdata.style = 2; 666 KapaPrepPlot (kapa3, nB, &graphdata); 667 KapaPlotVector (kapa3, nB, xBright->data.F32, "x"); 668 KapaPlotVector (kapa3, nB, mBright->data.F32, "y"); 669 670 // draw N circles to outline the clumps 554 671 { 672 KapaSelectSection (kapa3, "MxxMyy"); 673 555 674 // draw a circle centered on psfX,Y with size of the psf limit 556 675 psVector *xLimit = psVectorAlloc (120, PS_TYPE_F32); … … 562 681 graphdata.color = KapaColorByName ("blue"); 563 682 graphdata.style = 0; 683 684 graphdata.xmin = Xmin; 685 graphdata.ymin = Ymin; 686 graphdata.xmax = Xmax; 687 graphdata.ymax = Ymax; 688 KapaSetLimits (kapa3, &graphdata); 564 689 565 690 for (int n = 0; n < nRegions; n++) { … … 626 751 psFree (xBright); 627 752 psFree (yBright); 753 psFree (mBright); 628 754 psFree (xFaint); 629 755 psFree (yFaint); 756 psFree (mFaint); 630 757 631 758 // pause and wait for user input:
Note:
See TracChangeset
for help on using the changeset viewer.
