IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5628


Ignore:
Timestamp:
Nov 30, 2005, 7:04:58 AM (21 years ago)
Author:
eugene
Message:

adding break points and other features

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphot.c

    r5617 r5628  
    1010    psStats     *sky     = NULL;
    1111    pmPSFClump   psfClump;
     12    bool         status;
    1213
    1314    config = psphotArguments (&argc, argv);
     
    1718    // we have memory leaks here -- may be from psMetadata
    1819    imdata = psphotSetup (config);
     20    char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT");
     21    if (!status) {
     22      breakPt = psStringCopy ("NONE");
     23    }
    1924
    2025    // measure image stats for initial guess
     
    2328    // find the peaks in the image
    2429    peaks = pmPeaksSigmaLimit (imdata, config, sky);
     30    if (!strcasecmp (breakPt, "PEAKS")) exit (0);
    2531
    2632    // construct sources and measure basic stats
    2733    sources = psphotSourceStats (imdata, config, peaks);
     34    if (!strcasecmp (breakPt, "STATS")) exit (0);
    2835
    2936    // classify sources based on moments, brightness
    3037    // XXX - this has 1 leak
    3138    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);
    3439
    3540    // group into STAR, COSMIC, GALAXY, SATURATED
    3641    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);
    4743
    4844    // source analysis is done in S/N order (brightest first)
     
    5147    // use bright stellar objects to measure PSF
    5248    psf = psphotChoosePSF (config, sources, sky);
     49    if (!strcasecmp (breakPt, "PSFFIT")) exit (0);
    5350
    5451    // test PSF on all except SATURATE and DEFECT (artifacts)
    5552    psphotApplyPSF (imdata, config, sources, psf, sky);
     53    if (!strcasecmp (breakPt, "PSFSUB")) exit (0);
    5654
    5755    // fit extended objects with galaxy models
    5856    psphotFitGalaxies (imdata, config, sources, sky);
     57    if (!strcasecmp (breakPt, "GALSUB")) exit (0);
    5958
    6059    // write out data in appropriate format
  • trunk/psphot/src/psphotOutput.c

    r5617 r5628  
    364364        fprintf (f, "%5d %5d  %7.1f\n",
    365365                 peak->x, peak->y, peak->counts);
    366     }
    367     fclose (f);
    368     return true;
    369 }
    370 
    371 // write the moments to an output file
    372 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);
    394366    }
    395367    fclose (f);
Note: See TracChangeset for help on using the changeset viewer.