IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15040


Ignore:
Timestamp:
Sep 26, 2007, 5:35:47 PM (19 years ago)
Author:
eugene
Message:

various cleanups of I/O operations

Location:
trunk/psphot/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/Makefile.am

    r15023 r15040  
    4242        psphotSourceFits.c       \
    4343        psphotRadiusChecks.c     \
    44         psphotSortBySN.c         \
    4544        psphotOutput.c           \
    4645        psphotGrowthCurve.c      \
  • trunk/psphot/src/psphot.h

    r15023 r15040  
    5454// basic support functions
    5555void            psphotModelClassInit (void);
    56 int             pmPeakSortBySN (const void **a, const void **b);
    57 int             pmPeakSortByY (const void **a, const void **b);
    58 int             pmSourceSortBySN (const void **a, const void **b);
    59 int             pmSourceSortByY (const void **a, const void **b);
    6056bool            psphotGrowthCurve (pmReadout *readout, pmPSF *psf, bool ignore, psMaskType maskVal);
    6157bool            psphotMaskReadout (pmReadout *readout, psMetadata *recipe, psMaskType maskVal);
     
    116112bool            psphotMakeResiduals (psArray *sources, psMetadata *recipe, pmPSF *psf, psMaskType maskVal);
    117113
    118 bool psphotExtendedSources (pmReadout *readout, psArray *sources, psMetadata *recipe, psMaskType maskVal);
    119 bool psphotPSFConvModel (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    120 psKernel *psphotKernelFromPSF (pmSource *source, int nPix);
     114bool            psphotExtendedSources (pmReadout *readout, psArray *sources, psMetadata *recipe, psMaskType maskVal);
     115bool            psphotPSFConvModel (pmSource *source, psMetadata *recipe, psMaskType maskVal);
     116psKernel       *psphotKernelFromPSF (pmSource *source, int nPix);
    121117
    122 bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    123 bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    124 bool psphotAnnuli (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    125 bool psphotKron (pmSource *source, psMetadata *recipe, psMaskType maskVal);
     118bool            psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal);
     119bool            psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal);
     120bool            psphotAnnuli (pmSource *source, psMetadata *recipe, psMaskType maskVal);
     121bool            psphotKron (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    126122
    127123// structures & functions to support psf-convolved model fitting
  • trunk/psphot/src/psphotReadout.c

    r14943 r15040  
    171171
    172172    // XXX test the CR/EXT measurement
    173     // psphotSourceSize (readout, sources, recipe);
     173    // XXX we need to call this here and after the second pass: option for starting number?
     174    psphotSourceSize (readout, sources, recipe);
    174175
    175176    if (!strcasecmp (breakPt, "ENSEMBLE")) {
     
    259260    // plot positive sources
    260261    if (!havePSF) {
    261         psphotSourcePlots (readout, sources, recipe, maskVal);
     262        // psphotSourcePlots (readout, sources, recipe, maskVal);
    262263    }
    263264
  • trunk/psphot/src/psphotSortBySN.c

    r13006 r15040  
    1 # include "psphotInternal.h"
    21
    3 
    4 // sort by SN (descending)
    5 int pmPeakSortBySN (const void **a, const void **b)
    6 {
    7     pmPeak *A = *(pmPeak **)a;
    8     pmPeak *B = *(pmPeak **)b;
    9 
    10     psF32 fA = A->SN;
    11     psF32 fB = B->SN;
    12     if (isnan (fA)) fA = 0;
    13     if (isnan (fB)) fB = 0;
    14 
    15     psF32 diff = fA - fB;
    16     if (diff > FLT_EPSILON) return (-1);
    17     if (diff < FLT_EPSILON) return (+1);
    18     return (0);
    19 }
    20 
    21 // sort by Y (ascending)
    22 int pmPeakSortByY (const void **a, const void **b)
    23 {
    24     pmPeak *A = *(pmPeak **)a;
    25     pmPeak *B = *(pmPeak **)b;
    26 
    27     psF32 fA = A->y;
    28     psF32 fB = B->y;
    29 
    30     psF32 diff = fA - fB;
    31     if (diff > FLT_EPSILON) return (+1);
    32     if (diff < FLT_EPSILON) return (-1);
    33     return (0);
    34 }
    35 
    36 // sort by SN (descending)
    37 int pmSourceSortBySN (const void **a, const void **b)
    38 {
    39     pmSource *A = *(pmSource **)a;
    40     pmSource *B = *(pmSource **)b;
    41 
    42     psF32 fA = (A->peak == NULL) ? 0 : A->peak->SN;
    43     psF32 fB = (B->peak == NULL) ? 0 : B->peak->SN;
    44     if (isnan (fA)) fA = 0;
    45     if (isnan (fB)) fB = 0;
    46 
    47     psF32 diff = fA - fB;
    48     if (diff > FLT_EPSILON) return (-1);
    49     if (diff < FLT_EPSILON) return (+1);
    50     return (0);
    51 }
    52 
    53 // sort by Y (ascending)
    54 int pmSourceSortByY (const void **a, const void **b)
    55 {
    56     pmSource *A = *(pmSource **)a;
    57     pmSource *B = *(pmSource **)b;
    58 
    59     psF32 fA = (A->peak == NULL) ? 0 : A->peak->y;
    60     psF32 fB = (B->peak == NULL) ? 0 : B->peak->y;
    61 
    62     psF32 diff = fA - fB;
    63     if (diff > FLT_EPSILON) return (+1);
    64     if (diff < FLT_EPSILON) return (-1);
    65     return (0);
    66 }
    67 
  • trunk/psphot/src/psphotSourceSize.c

    r13086 r15040  
    77
    88bool psphotSourceSize (pmReadout *readout, psArray *sources, psMetadata *recipe) {
    9 
    10     FILE *f = fopen ("srcsize.dat", "w");
    119
    1210    // loop over all source
     
    5351        // P(chisq > chisq_obs; Ndof) = gamma_Q (Ndof/2, chisq/2)
    5452        // Ndof = 4 ? (four measurements, no free parameters)
    55         float Ppsf = gsl_sf_gamma_inc_Q (2, 0.5*chisq);
     53        // XXX this value is going to be biased low because of systematic errors.
     54        // we need to calibrate it somehow
     55        source->psfProb = gsl_sf_gamma_inc_Q (2, 0.5*chisq);
    5656
    5757        float fCR = 0.0;
     
    8787            nEXT ++;
    8888        }
    89         fCR = (nCR > 0) ? fCR / nCR : 0.0;
    90         fEXT = (nEXT > 0) ? fEXT / nEXT : 0.0;
    91 
    92         // XXX plot this as a function of flux / magnitude?
    93         // XXX overlay outliers on an image?
    94        
    95         fprintf (f, "%f %f %f   %f %f   %f %f\n", source->peak->xf, source->peak->yf, source->peak->flux,
    96                  chisq, Ppsf, fCR, fEXT);
     89        source->crNsigma  = (nCR > 0)  ? fCR / nCR : 0.0;
     90        source->extNsigma = (nEXT > 0) ? fEXT / nEXT : 0.0;
    9791    }
    98     fclose (f);
    9992    return true;
    10093}
Note: See TracChangeset for help on using the changeset viewer.