Changeset 5628
- Timestamp:
- Nov 30, 2005, 7:04:58 AM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 edited
-
psphot.c (modified) (4 diffs)
-
psphotOutput.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphot.c
r5617 r5628 10 10 psStats *sky = NULL; 11 11 pmPSFClump psfClump; 12 bool status; 12 13 13 14 config = psphotArguments (&argc, argv); … … 17 18 // we have memory leaks here -- may be from psMetadata 18 19 imdata = psphotSetup (config); 20 char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT"); 21 if (!status) { 22 breakPt = psStringCopy ("NONE"); 23 } 19 24 20 25 // measure image stats for initial guess … … 23 28 // find the peaks in the image 24 29 peaks = pmPeaksSigmaLimit (imdata, config, sky); 30 if (!strcasecmp (breakPt, "PEAKS")) exit (0); 25 31 26 32 // construct sources and measure basic stats 27 33 sources = psphotSourceStats (imdata, config, peaks); 34 if (!strcasecmp (breakPt, "STATS")) exit (0); 28 35 29 36 // classify sources based on moments, brightness 30 37 // XXX - this has 1 leak 31 38 psfClump = pmSourcePSFClump (sources, config); 32 // psLogMsg ("psphot", 4, "clump X, Y: %f, %f\n", psfClump.X, psfClump.Y);33 // psLogMsg ("psphot", 4, "clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY);34 39 35 40 // group into STAR, COSMIC, GALAXY, SATURATED 36 41 pmSourceRoughClass (sources, config, psfClump); 37 38 // optional dump of all rough source data 39 { 40 bool status; 41 char *output = psMetadataLookupPtr (&status, config, "MOMENTS_OUTPUT_FILE"); 42 if (status && (output != NULL) && (output[0])) { 43 pmMomentsWriteText (sources, output); 44 psFree (output); 45 } 46 } 42 if (!strcasecmp (breakPt, "CLASS")) exit (0); 47 43 48 44 // source analysis is done in S/N order (brightest first) … … 51 47 // use bright stellar objects to measure PSF 52 48 psf = psphotChoosePSF (config, sources, sky); 49 if (!strcasecmp (breakPt, "PSFFIT")) exit (0); 53 50 54 51 // test PSF on all except SATURATE and DEFECT (artifacts) 55 52 psphotApplyPSF (imdata, config, sources, psf, sky); 53 if (!strcasecmp (breakPt, "PSFSUB")) exit (0); 56 54 57 55 // fit extended objects with galaxy models 58 56 psphotFitGalaxies (imdata, config, sources, sky); 57 if (!strcasecmp (breakPt, "GALSUB")) exit (0); 59 58 60 59 // write out data in appropriate format -
trunk/psphot/src/psphotOutput.c
r5617 r5628 364 364 fprintf (f, "%5d %5d %7.1f\n", 365 365 peak->x, peak->y, peak->counts); 366 }367 fclose (f);368 return true;369 }370 371 // write the moments to an output file372 bool pmMomentsWriteText (psArray *sources, char *filename) {373 374 int i;375 FILE *f;376 pmSource *source;377 378 f = fopen (filename, "w");379 if (f == NULL) {380 psLogMsg ("pmMomentsWriteText", 3, "can't open output file for moments%s\n", filename);381 return false;382 }383 384 for (i = 0; i < sources->n; i++) {385 source = (pmSource *) sources->data[i];386 if (source->moments == NULL) continue;387 fprintf (f, "%5d %5d %7.1f %7.1f %7.1f %6.3f %6.3f %8.1f %7.1f %7.1f %7.1f %4d %2d\n",388 source->peak->x, source->peak->y, source->peak->counts,389 source->moments->x, source->moments->y,390 source->moments->Sx, source->moments->Sy,391 source->moments->Sum, source->moments->Peak,392 source->moments->Sky, source->moments->SN,393 source->moments->nPixels, source->type);394 366 } 395 367 fclose (f);
Note:
See TracChangeset
for help on using the changeset viewer.
