IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2006, 11:08:05 AM (20 years ago)
Author:
eugene
Message:

more cleanups, more work on files and views

File:
1 edited

Legend:

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

    r6715 r6727  
    11# include "psphot.h"
    22
    3 // XXX 2006.02.07 : no leaks!
    4 // XXX change 'config' to 'recipe' eventually
     3// XXX 2006.03.28 : no leaks!
    54bool psphotReadout (pmConfig *config, pmFPAview *view) {
    65
     
    1514    pmReadout  *readout = pmFPAviewThisReadout (view, input->fpa);
    1615
    17     sources = psphotFakeSources();
    18     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES",   PS_DATA_ARRAY,   "psphot sources", sources);
    19     psFree (sources);
    20     return true;
    21 
    2216    // XXX does this need to invoke I/O?
    2317    pmReadoutSetWeights (readout);
     
    2519    // I have a valid mask, now mask in the analysis region of interest
    2620    psphotMaskReadout (readout, recipe);
     21
     22    // run a single-model test if desired
     23    psphotModelTest (readout, recipe);
    2724
    2825    // generate a background model (median, smoothed image)
     
    5552    psphotReplaceUnfit (sources);
    5653
    57     // find remaining peaks after first source subtraction pass
     54    // XXX find remaining peaks after first source subtraction pass
    5855    // psphotFindPeaks ();
    5956
     
    6764    psphotMagnitudes (sources, recipe, psf);
    6865
    69     // update the header with stats results
    70     // XXX need to do this conditionally?
    71     // XXX psMetadata *header = pmReadoutGetHeader (readout);
    72     // XXX psphotUpdateHeader (header, config);
     66    // create an output header with stats results
     67    psMetadata *header = psphotDefineHeader (recipe);
    7368
    74     // XXX make this an option?
    7569    // replace background in residual image
    7670    psphotSkyReplace (config, view);
    7771
    78     // need to do something with the sources, psf, and sky
    79     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES",   PS_DATA_ARRAY,   "psphot sources", sources);
    80     status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF",       PS_DATA_UNKNOWN, "psphot psf", psf);
    81     // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.MEAN",  PS_DATA_F32,     "psphot sky mean", sky->sampleMean);
    82     // XXX : replace? status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SKY.SIGMA", PS_DATA_F32,     "psphot sky stdev", sky->sampleStdev);
     72    // save the results of the analysis
     73    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY,    "psphot sources", sources);
     74    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER",  PS_DATA_METADATA, "header stats", header);
     75    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF",     PS_DATA_UNKNOWN,  "psphot psf", psf);
    8376
    8477    // free up the local copies of the data
    8578    psFree (psf);
     79    psFree (header);
    8680    psFree (sources);
    8781    psFree (peaks);
     
    8983}
    9084
    91 
    92 // XXX Deprecate or allow these versions?
    93 # if (0)
    94     // select analysis method
    95     char *FITMODE = psMetadataLookupStr (&status, config, "FITMODE");
    96     if (!strcasecmp(FITMODE, "ENSEMBLE")) {
    97         psphotEnsemblePSF (readout, config, sources, psf);
    98     }
    99 
    100     if (!strcasecmp(FITMODE, "FULL")) {
    101         psphotEnsemblePSF (readout, config, sources, psf);
    102         psphotFullFit (readout, config, sources, psf);
    103         psphotReplaceUnfit (sources);
    104         psphotApResid (readout, sources, config, psf);
    105     }
    106 
    107     if (!strcasecmp(FITMODE, "BASIC")) {
    108         psphotApplyPSF (readout, config, sources, psf);
    109         psphotFitExtended (readout, config, sources);
    110     }
    111 
    112 
    113 
    114     psphotSaveImage (NULL, readout->image,  "pixels.fits");
    115     psphotSaveImage (NULL, readout->weight, "weight.fits");
    116     psphotSaveImage (NULL, readout->mask,   "mask.fits");
    117     exit (1);
    118 
    119 # endif
     85    # if (1)
     86    fprintf (stderr, "making fake sources\n");
     87    sources = psphotFakeSources ();
     88    psMetadata *tmp = psMetadataAlloc ();
     89    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY,    "psphot sources", sources);
     90    status = psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER",  PS_DATA_METADATA, "header stats", tmp);
     91    psFree (sources);
     92    psFree (tmp);
     93    return true;
     94    # endif
Note: See TracChangeset for help on using the changeset viewer.