Changeset 31438
- Timestamp:
- May 4, 2011, 4:44:43 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110404/psModules/src/objects
- Files:
-
- 12 edited
-
models/pmModel_DEV.c (modified) (1 diff)
-
models/pmModel_EXP.c (modified) (1 diff)
-
models/pmModel_PGAUSS.c (modified) (1 diff)
-
models/pmModel_PS1_V1.c (modified) (1 diff)
-
models/pmModel_QGAUSS.c (modified) (1 diff)
-
models/pmModel_RGAUSS.c (modified) (1 diff)
-
models/pmModel_SERSIC.c (modified) (1 diff)
-
pmGrowthCurve.c (modified) (3 diffs)
-
pmGrowthCurve.h (modified) (1 diff)
-
pmGrowthCurveGenerate.c (modified) (5 diffs)
-
pmPCMdata.c (modified) (2 diffs)
-
pmSource.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_DEV.c
r31153 r31438 268 268 float f0 = 1.0; 269 269 float f1, f2; 270 for (z = DZ; z < 50; z += DZ) {270 for (z = DZ; z < 150; z += DZ) { 271 271 f1 = exp(-pow(z,ALPHA)); 272 272 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_EXP.c
r31153 r31438 255 255 float f0 = 1.0; 256 256 float f1, f2; 257 for (z = DZ; z < 50; z += DZ) {257 for (z = DZ; z < 150; z += DZ) { 258 258 f1 = exp(-sqrt(z)); 259 259 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_PGAUSS.c
r31153 r31438 239 239 float f0 = 1.0; 240 240 float f1, f2; 241 for (z = DZ; z < 50; z += DZ) {241 for (z = DZ; z < 150; z += DZ) { 242 242 f1 = 1.0 / (1 + z + z*z/2.0 + z*z*z/6.0); 243 243 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_PS1_V1.c
r31153 r31438 261 261 float f0 = 1.0; 262 262 float f1, f2; 263 for (z = DZ; z < 50; z += DZ) {263 for (z = DZ; z < 150; z += DZ) { 264 264 f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, ALPHA)); 265 265 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_QGAUSS.c
r31153 r31438 262 262 float f0 = 1.0; 263 263 float f1, f2; 264 for (z = DZ; z < 50; z += DZ) {264 for (z = DZ; z < 150; z += DZ) { 265 265 f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, ALPHA)); 266 266 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_RGAUSS.c
r31153 r31438 251 251 float f0 = 1.0; 252 252 float f1, f2; 253 for (z = DZ; z < 50; z += DZ) {253 for (z = DZ; z < 150; z += DZ) { 254 254 f1 = 1.0 / (1 + z + pow(z, PAR[PM_PAR_7])); 255 255 z += DZ; -
branches/eam_branches/ipp-20110404/psModules/src/objects/models/pmModel_SERSIC.c
r31153 r31438 316 316 float f0 = 1.0; 317 317 float f1, f2; 318 for (z = DZ; z < 50; z += DZ) {318 for (z = DZ; z < 150; z += DZ) { 319 319 // f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25)); 320 320 f1 = exp(-pow(z,PAR[PM_PAR_7])); -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmGrowthCurve.c
r31384 r31438 73 73 // Fractional pixel radii are not well defined; use integer pixel radii. Use 1 pixel steps 74 74 // until the scaling factor steps in intervals larger than 1 pixel 75 float Rlin = 1.0 / (fR - 1.0);75 // float Rlin = 1.0 / (fR - 1.0); 76 76 77 77 growth->radius = psVectorAllocEmpty (NPTS, PS_DATA_F32); … … 79 79 // there will be NPTS radii + a few extras 80 80 float radius = minRadius; 81 while (radius < Rlin) {81 while (radius < refRadius) { 82 82 // fprintf (stderr, "r: %f\n", radius); 83 83 psVectorAppend (growth->radius, radius - 0.001); 84 84 radius += 1.0; 85 85 } 86 growth->refBin = growth->radius->n - 1; 86 87 while (radius < maxRadius) { 87 88 // fprintf (stderr, "r: %f\n", radius); … … 97 98 growth->maxRadius = maxRadius; 98 99 growth->fitMag = NAN; 100 growth->refMag = NAN; 99 101 growth->apRef = NAN; 100 102 growth->apLoss = NAN; -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmGrowthCurve.h
r15562 r31438 22 22 psF32 maxRadius; 23 23 psF32 fitMag; 24 psF32 refMag; 24 25 psF32 apRef; // apMag[refRadius] 25 26 psF32 apLoss; // fitMag - apRef 27 int refBin; 26 28 } 27 29 pmGrowthCurve; -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmGrowthCurveGenerate.c
r31361 r31438 226 226 } 227 227 228 # define DEBUG 0 229 # if (DEBUG) 230 static FILE *fgr = NULL; 231 # endif 232 228 233 // we generate the growth curve for the center of the image with the specified psf model 229 234 bool pmGrowthCurveGenerateFromSources (pmReadout *readout, pmPSF *psf, psArray *sources, bool INTERPOLATE_AP, psImageMaskType maskVal, psImageMaskType markVal) … … 240 245 psArray *growths = psArrayAllocEmpty (100); 241 246 247 # if (DEBUG) 248 fgr = fopen ("growth.mags.dat", "w"); 249 # endif 250 242 251 for (int i = 0; i < sources->n; i++) { 243 252 … … 254 263 psAssert (growths->n, "cannot build growth curve (no valid PSF stars?)"); 255 264 256 # if (0) 257 FILE *f = fopen ("growth.dat", "w"); 258 assert (f); 259 260 for (int j = 0; j < psf->growth->radius->n; j++) { 261 262 fprintf (f, "%f : ", psf->growth->radius->data.F32[j]); 263 264 // XXX dump the growth curves: 265 for (int i = 0; i < growths->n; i++) { 266 267 pmGrowthCurve *growth = growths->data[i]; 268 if (!growth) continue; 269 270 fprintf (f, "%8.4f ", growth->apMag->data.F32[j]); 271 } 272 fprintf (f, "\n"); 273 } 274 fclose (f); 265 # if (DEBUG) 266 fclose (fgr); 275 267 # endif 276 268 … … 290 282 pmGrowthCurve *growth = growths->data[j]; 291 283 if (!isfinite(growth->apMag->data.F32[i])) continue; 292 psVectorAppend (values, growth->apMag->data.F32[i] - growth-> fitMag);284 psVectorAppend (values, growth->apMag->data.F32[i] - growth->refMag); 293 285 } 294 286 if (values->n == 0) { … … 354 346 growth->apMag->data.F32[i] = source->apMag; 355 347 } 348 psAssert(growth->refBin >= 0, "invalid growth reference bin"); 349 psAssert(growth->refBin < growth->apMag->n, "invalid growth reference bin"); 350 growth->refMag = growth->apMag->data.F32[growth->refBin]; 351 352 // Loop over the range of radii 353 # if (DEBUG) 354 for (int i = 0; i < growth->radius->n; i++) { 355 fprintf (fgr, "%f %f %f %f %f %f\n", xc, yc, growth->radius->data.F32[i], growth->apMag->data.F32[i], growth->fitMag, growth->refMag); 356 } 357 # endif 358 356 359 return growth; 357 360 } 358 359 # if (0)360 // solve for the best growth and the offsets per star to minimize the scatter361 362 // generate the per-star and per-radius sums363 int Nradius = psf->growth->radius->n;364 int Nstar = growths->n;365 366 psVector *Mstar = psVectorAlloc (Nstar, PS_DATA_F32);367 psVector *Mradius = psVectorAlloc (Nradius, PS_DATA_F32);368 369 psVectorInit (Mstar, 0.0);370 psVectorInit (Mradius, 0.0);371 372 for (int i = 0; i < Nstar; i++) {373 pmGrowthCurve *growth = growths->data[i];374 for (int j = 0; j < Nradius; j++) {375 Mstar->data.F32[i] += growth->apMag->data.F32[j];376 Mradius->data.F32[j] += growth->apMag->data.F32[j];377 }378 }379 380 psImage *A = psImageAlloc(Nstar + Nradius, Nstar + Nradius, PS_DATA_F32);381 psVector *B = psVectorAlloc(Nstar + Nradius, PS_DATA_F32);382 383 psImageInit (A, 0.0);384 psVectorInit (B, 0.0);385 386 for (int i = 0; i < Nstar; i++) {387 A->data.F32[i][i] = Nradius;388 B->data.F32[i] = Mstar->data.F32[i];389 }390 for (int i = 0; i < Nradius; i++) {391 int j = i + Nstar;392 A->data.F32[j][j] = Nstar;393 B->data.F32[j] = Mradius->data.F32[i];394 }395 396 if (!psMatrixGJSolve(A, B)) {397 psAbort("GJ failure");398 }399 400 for (int i = 0; i < Nradius; i++) {401 psf->growth->apMag->data.F32[i] = B->data.F32[Nstar+i];402 }403 404 // XXX this analysis produces a biased growth curve: points with small radius are more405 // likely to err on the side of being too faint (bacause of mis-aligned aperture), while on406 // the bright side the tend to be too bright (because of contaminating neighbors). Bright407 // stars are less likely to be biased,408 409 // XXX at this point, we could iterate and exclude some of the stars with low data quality410 // XXX we could also weight the above by flux or something411 412 # endif -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmPCMdata.c
r31153 r31438 263 263 bool pmPCMupdate(pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, pmModel *model) { 264 264 265 bool newWindow = (source->pixels->numRows != pcm->modelFlux->numRows) || (source->pixels->numCols != pcm->modelFlux->numCols); 265 bool sameWindow = (source->pixels->numRows == pcm->modelFlux->numRows); 266 sameWindow &= (source->pixels->numCols == pcm->modelFlux->numCols); 267 sameWindow &= (source->pixels->col0 == pcm->modelFlux->col0); 268 sameWindow &= (source->pixels->row0 == pcm->modelFlux->row0); 266 269 267 270 // re-count the number of unmasked pixels: 268 if ( newWindow) {271 if (!sameWindow) { 269 272 for (psS32 i = 0; i < source->pixels->numRows; i++) { 270 273 for (psS32 j = 0; j < source->pixels->numCols; j++) { … … 346 349 347 350 // has the source pixel window changed? 348 if ( newWindow) {351 if (!sameWindow) { 349 352 350 353 // adjust all supporting images: -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmSource.c
r31384 r31438 285 285 extend |= (mySource->maskObj == NULL); 286 286 extend |= (mySource->maskView == NULL); 287 288 // if ((fabs(x - 2020) < 5) && (fabs(y - 366) < 5)) { 289 // if (extend) { 290 // fprintf (stderr, "extend T, %f, %f : %f, %f vs %f, %f : %f, %f\n", 291 // newRegion.x0, newRegion.y0, newRegion.x1, newRegion.y1, 292 // mySource->region.x0, mySource->region.y0, mySource->region.x1, mySource->region.y1); 293 // } else { 294 // fprintf (stderr, "extend F, %f, %f : %f, %f vs %f, %f : %f, %f\n", 295 // newRegion.x0, newRegion.y0, newRegion.x1, newRegion.y1, 296 // mySource->region.x0, mySource->region.y0, mySource->region.x1, mySource->region.y1); 297 // } 298 // } 287 299 288 300 if (extend) {
Note:
See TracChangeset
for help on using the changeset viewer.
