Changeset 4116
- Timestamp:
- Jun 5, 2005, 8:41:28 PM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 5 edited
-
apply_psf_model.c (modified) (3 diffs)
-
mark_psf_source.c (modified) (2 diffs)
-
psPolynomials.c (modified) (1 diff)
-
pspsf.c (modified) (1 diff)
-
subtract_psf_source.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/apply_psf_model.c
r4115 r4116 1 1 # include "psphot.h" 2 2 3 // fit psf model to all objects not already fitted (modelPSF == NULL) 3 // fit psf model to all objects 4 // PSFSTAR objects will be refitted 4 5 // run this function to a specific flux limit? 6 5 7 6 8 bool apply_psf_model (psImage *image, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky) … … 35 37 psSource *source = sources->data[i]; 36 38 37 // skip the existing PSF stars38 // XXX drop this -- refit?39 if (source->modelPSF != NULL) continue;40 41 39 // skip non-astronomical objects (very likely defects) 42 40 if (source->type == PS_SOURCE_DEFECT) continue; … … 54 52 if (isnan(model->radius)) { 55 53 fprintf (stderr, "error in radius\n"); 54 continue; 56 55 } 57 56 -
trunk/psphot/src/mark_psf_source.c
r4115 r4116 22 22 if (source->modelPSF == NULL) return (false); 23 23 24 if (source->type == PS_SOURCE_PSFSTAR) return (true);24 // SATSTAR objects are fitted with PSF regardless 25 25 if (source->type == PS_SOURCE_SATSTAR) return (true); 26 26 … … 36 36 // assign PS_SOURCE_BRIGHTSTAR to bright objects within PSF region of dparams[] 37 37 if ((fabs(nSx) < shapeNsigma) && (fabs(nSy) < shapeNsigma)) { 38 if (source->type == PS_SOURCE_PSFSTAR) return (true); 38 39 source->type = PS_SOURCE_BRIGHTSTAR; 39 40 return (true); 40 41 } 41 42 43 if (source->type == PS_SOURCE_PSFSTAR) { 44 psLogMsg ("psphot", 3, "PSFSTAR demoted based on dSx, dSy\n"); 45 } 46 42 47 if ((nSx >= shapeNsigma) || (nSy >= shapeNsigma)) { 43 48 source->type = PS_SOURCE_GALAXY; -
trunk/psphot/src/psPolynomials.c
r4115 r4116 453 453 const psVector* dz) 454 454 { 455 PS_VECTOR_CHECK_NULL(mask, NULL); 456 PS_VECTOR_CHECK_NULL(x, NULL); 457 PS_VECTOR_CHECK_NULL(y, NULL); 458 PS_VECTOR_CHECK_NULL(z, NULL); 459 PS_VECTOR_CHECK_NULL(dz, NULL); 460 455 461 psVector *zFit = NULL; 456 psVector *zResid = NULL;457 psStats *stats = NULL;462 psVector *zResid = psVectorAlloc (x->n, PS_TYPE_F64); 463 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEAN | PS_STAT_SAMPLE_STDEV); 458 464 459 465 for (int N = 0; N < 3; N++) { 460 466 poly = VectorFitPolynomial2DOrd_EAM (poly, mask, x, y, z, dz); 461 467 zFit = Polynomial2DEvalVectorD (poly, x, y); 462 zResid = (psVector *) psBinaryOp (NULL, (void *) z, "-", (void *) zFit); 463 464 stats = psStatsAlloc (PS_STAT_CLIPPED_MEAN | PS_STAT_CLIPPED_STDEV); 468 zResid = (psVector *) psBinaryOp (zResid, (void *) z, "-", (void *) zFit); 469 465 470 stats = psVectorStats (stats, zResid, NULL, mask, 1); 466 psTrace (".psphot.RobustFit", 4, "residual stats for robust fit: %g +/- %g (%d pts)\n",467 stats-> clippedMean, stats->clippedStdev, stats->clippedNvalues);471 psTrace (".psphot.RobustFit", 4, "residual stats for robust fit: %g +/- %g\n", 472 stats->sampleMean, stats->sampleStdev); 468 473 469 474 // set mask if pts are not valid 470 int n = 0; 475 // we are masking out any point which is out of range 476 // recovery is not allowed with this scheme 471 477 for (int i = 0; i < zResid->n; i++) { 472 if (fabs(zResid->data.F64[i] - stats->clippedMean) > 3*stats->clippedStdev) { 473 mask->data.U8[i] = 1; 474 continue; 475 } else { 476 mask->data.U8[i] = 0; 477 } 478 n++; 479 } 480 } 478 if (mask->data.U8[i]) continue; 479 if (fabs(zResid->data.F64[i] - stats->sampleMean) > 3*stats->sampleStdev) { 480 mask->data.U8[i] = 1; 481 continue; 482 } 483 } 484 psFree (zFit); 485 } 486 psFree (zResid); 487 psFree (stats); 481 488 return (poly); 482 489 } -
trunk/psphot/src/pspsf.c
r4115 r4116 172 172 // we are doing a robust fit. after each pass, we drop points which are 173 173 // more deviant than three sigma. 174 // mask is currently updated for each pass. this is inconsistent 174 // mask is currently updated for each pass. this is inconsistent? 175 175 176 176 for (int i = 0; i < psf->params->n; i++) { -
trunk/psphot/src/subtract_psf_source.c
r4115 r4116 9 9 psSource *source = sources->data[i]; 10 10 11 // non-stellar sources are ignored 11 12 if (source->type == PS_SOURCE_GALAXY) return (false); 12 13 if (source->type == PS_SOURCE_DEFECT) return (false);
Note:
See TracChangeset
for help on using the changeset viewer.
