IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5986


Ignore:
Timestamp:
Jan 13, 2006, 9:03:34 PM (21 years ago)
Author:
eugene
Message:

file cleanups, function renames

Location:
trunk/psphot/src
Files:
3 added
2 deleted
9 edited

Legend:

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

    r5980 r5986  
    11# include "psphot.h"
    22
     3// XXX need a better structure for handling optional sequence
    34int main (int argc, char **argv) {
    45
     
    910    pmPSF       *psf     = NULL;
    1011    psStats     *sky     = NULL;
    11     pmPSFClump   psfClump;
    1212    bool         status;
    1313
    1414    psTimerStart ("complete");
    1515
    16     psphotModelGroupInit ();
    17 
     16    // load command-line arguments and options
    1817    config = psphotArguments (&argc, argv);
    1918
    2019    // load input data (config and images (signal, noise, mask)
    21     // XXX we have memory leaks here -- may be from psMetadata
    2220    imdata = psphotSetup (config);
    2321
    24     char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT");
    25     if (!status) breakPt = psStringCopy ("NONE");
    26 
    27     int FITMODE = psMetadataLookupS32 (&status, config, "FIT_MODE");
    28     if (!status) FITMODE = 2;
    29 
    30     // run model fitting tests on a single source
    31     if (psMetadataLookupBool (&status, config, "TEST_FIT")) {
    32         psphotModelTest (imdata, config);
    33         exit (0);
    34     }
     22    // run a single-model test if desired
     23    psphotModelTest (imdata, config);
    3524
    3625    // measure image stats for initial guess
     
    4231
    4332    // find the peaks in the image
    44     peaks = pmPeaksSigmaLimit (imdata, config, sky);
    45     if (!strcasecmp (breakPt, "PEAKS")) exit (0);
     33    peaks = psphotFindPeaks (imdata, config, sky);
    4634
    4735    // construct sources and measure basic stats
    4836    sources = psphotSourceStats (imdata, config, peaks);
    49     if (!strcasecmp (breakPt, "STATS")) exit (0);
    5037
    5138    // classify sources based on moments, brightness
    52     // XXX - this has 1 leak
    53     psfClump = pmSourcePSFClump (sources, config);
    54 
    55     // group into STAR, COSMIC, GALAXY, SATURATED, etc.
    56     pmSourceRoughClass (sources, config, psfClump);
     39    psphotRoughClass (sources, config);
    5740
    5841    // mark blended peaks PS_SOURCE_BLEND
    5942    psphotBasicDeblend (sources, config, sky);
    60     if (!strcasecmp (breakPt, "DEBLEND")) exit (0);
    61 
    62     // source analysis is done in S/N order (brightest first)
    63     sources = psArraySort (sources, psphotSortBySN);
    64     psphotDumpMoments (config, sources);
    65     if (!strcasecmp (breakPt, "CLASS")) exit (0);
    6643
    6744    // use bright stellar objects to measure PSF
    6845    psf = psphotChoosePSF (config, sources, sky);
    69     if (!strcasecmp (breakPt, "PSFFIT")) exit (0);
    7046
     47    // XXX change FITMODE to a string
     48    int FITMODE = psMetadataLookupS32 (&status, config, "FIT_MODE");
    7149    switch (FITMODE) {
    7250      case 0:
     
    10179
    10280    // write out data in appropriate format
    103     psphotSamplePSFs (config, psf, imdata->image);
    10481    psphotOutput (imdata, config, sources, psf, sky);
    10582    psLogMsg ("psphot", 3, "wrote output: %f sec\n", psTimerMark ("psphot"));
  • trunk/psphot/src/psphot.h

    r5980 r5986  
    2525eamReadout     *psphotSetup (psMetadata *config);
    2626psStats        *psphotImageStats (eamReadout *imdata, psMetadata *config);
     27psArray        *psphotFindPeaks (eamReadout *imdata, psMetadata *config, psStats *sky);
    2728psArray        *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks);
     29bool            psphotRoughClass (psArray *sources, psMetadata *config);
    2830pmPSF          *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky);
    2931bool            psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
     
    4244
    4345bool            pmSourceFitFixed (pmSource *source, pmModel *model);
    44 psArray        *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky);
    4546pmModel        *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius);
    4647pmModel        *pmSourceSelectModel (pmSource *source);
  • trunk/psphot/src/psphotArguments.c

    r5980 r5986  
    117117    psMetadata *config = psMetadataAlloc ();
    118118
     119    // add default values
     120    psMetadataAddStr (config, PS_LIST_TAIL, "BREAK_POINT", 0, "", "NONE");
     121    psMetadataAddS32 (config, PS_LIST_TAIL, "FIT_MODE", 0, "", 2);
     122
    119123    psMetadataAdd (config, PS_LIST_TAIL, "PSF_MODEL", PS_DATA_METADATA_MULTI, "folder for psf model entries", NULL);
     124
    120125    config = psMetadataConfigParse (config, &Nfail, argv[3], FALSE);
    121126
  • trunk/psphot/src/psphotBasicDeblend.c

    r5828 r5986  
    132132    }
    133133    psLogMsg ("psphot.deblend", 3, "identified %d blended objects (%f sec)\n", Nblend, psTimerMark ("psphot"));
     134
     135    char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT");
     136    if (!strcasecmp (breakPt, "DEBLEND")) exit (0);
     137
    134138    return true;
    135139}
  • trunk/psphot/src/psphotChoosePSF.c

    r5828 r5986  
    1212
    1313    psTimerStart ("psphot");
     14
     15    // examine PSF sources in S/N order (brightest first)
     16    sources = psArraySort (sources, psphotSortBySN);
    1417
    1518    // array to store candidate PSF stars
     
    8891    psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid);
    8992
     93    char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT");
     94    if (!strcasecmp (breakPt, "PSFFIT")) exit (0);
     95
    9096    return (psf);
    9197}
  • trunk/psphot/src/psphotModelTest.c

    r5837 r5986  
    1111
    1212    psMetadataItem *item  = NULL;
     13
     14    // run model fitting tests on a single source
     15    if (!psMetadataLookupBool (&status, config, "TEST_FIT")) return false;
    1316
    1417    // what fitting mode to use?
     
    166169    psphotSaveImage (NULL, source->pixels, "resid.fits");
    167170    psphotSaveImage (NULL, source->mask, "mask.fits");
    168     return true;
     171
     172    exit (0);
    169173}
  • trunk/psphot/src/psphotOutput.c

    r5980 r5986  
    1515    if (residImage != NULL) psphotSaveImage (imdata->header, imdata->image, residImage);
    1616    if (psfFile != NULL) psphotWritePSF (psf, psfFile);
     17    psphotSamplePSFs (config, psf, imdata->image);
    1718
    1819    if (outputFile == NULL) {
  • trunk/psphot/src/psphotSetup.c

    r5828 r5986  
    1717
    1818    psTimerStart ("psphot");
     19
     20    // load implementation-specific models
     21    psphotModelGroupInit ();
    1922
    2023    // setup header template, specify COMMENT and HISTORY as MULTI
  • trunk/psphot/src/psphotSourceStats.c

    r5802 r5986  
    6161     
    6262    psLogMsg ("psphot", 3, "%d moments: %f sec\n", sources->n, psTimerMark ("psphot"));
     63
     64    char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT");
     65    if (!strcasecmp (breakPt, "STATS")) exit (0);
     66
    6367    return (sources);
    6468}
Note: See TracChangeset for help on using the changeset viewer.