IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5049


Ignore:
Timestamp:
Sep 13, 2005, 4:06:55 PM (21 years ago)
Author:
eugene
Message:

changed noise to weight, psImageData to eamReadout

Location:
trunk/psphot/src
Files:
17 edited

Legend:

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

    r5048 r5049  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-09-14 01:35:20 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-09-14 02:06:55 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    102102    psFree(tmp->peak);
    103103    psFree(tmp->pixels);
    104     psFree(tmp->noise);
     104    psFree(tmp->weight);
    105105    psFree(tmp->mask);
    106106    psFree(tmp->moments);
     
    118118    tmp->peak = NULL;
    119119    tmp->pixels = NULL;
    120     tmp->noise = NULL;
     120    tmp->weight = NULL;
    121121    tmp->mask = NULL;
    122122    tmp->moments = NULL;
     
    662662    pmSource->peak
    663663    pmSource->pixels
    664     pmSource->noise
     664    pmSource->weight
    665665    pmSource->mask
    666666 
     
    678678    // PS_PTR_CHECK_NULL(source->peak, NULL);
    679679    // PS_PTR_CHECK_NULL(source->pixels, NULL);
    680     // PS_PTR_CHECK_NULL(source->noise, NULL);
     680    // PS_PTR_CHECK_NULL(source->weight, NULL);
    681681    PS_FLOAT_COMPARE(0.0, radius, NULL);
    682682
     
    736736            // XXX EAM : check for valid S/N in pixel
    737737            // XXX EAM : should this limit be user-defined?
    738             if (pDiff / sqrt(source->noise->data.F32[row][col]) < 1) continue;
     738            if (pDiff / sqrt(source->weight->data.F32[row][col]) < 1) continue;
    739739           
    740740            Sum += pDiff;
     
    14611461    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    14621462    PS_ASSERT_PTR_NON_NULL(source->mask, false);
    1463     PS_ASSERT_PTR_NON_NULL(source->noise, false);
     1463    PS_ASSERT_PTR_NON_NULL(source->weight, false);
    14641464    psBool fitStatus = true;
    14651465    psBool onPic     = true;
    14661466    psBool rc        = true;
    14671467
    1468     // XXX EAM : is it necessary for the mask & noise to exist?  the
     1468    // XXX EAM : is it necessary for the mask & weight to exist?  the
    14691469    //           tests below could be conditions (!NULL)
    14701470
     
    15081508                x->data[tmpCnt] = (psPtr *) coord;
    15091509                y->data.F32[tmpCnt] = source->pixels->data.F32[i][j];
    1510                 yErr->data.F32[tmpCnt] = sqrt (source->noise->data.F32[i][j]);
     1510                yErr->data.F32[tmpCnt] = sqrt (source->weight->data.F32[i][j]);
    15111511                // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then
    15121512                //           the minimization function calculates sq()
     
    15761576}
    15771577
    1578 // XXX EAM : new version with parameter range limits and noise enhancement
     1578// XXX EAM : new version with parameter range limits and weight enhancement
    15791579bool pmSourceFitModel (pmSource *source,
    15801580                       pmModel *model,
     
    15861586    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    15871587    PS_ASSERT_PTR_NON_NULL(source->mask, false);
    1588     PS_ASSERT_PTR_NON_NULL(source->noise, false);
    1589 
    1590     // XXX EAM : is it necessary for the mask & noise to exist?  the
     1588    PS_ASSERT_PTR_NON_NULL(source->weight, false);
     1589
     1590    // XXX EAM : is it necessary for the mask & weight to exist?  the
    15911591    //           tests below could be conditions (!NULL)
    15921592
     
    16021602    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
    16031603
    1604     // XXX EAM : I need to use the sky value to constrain the noise model
     1604    // XXX EAM : I need to use the sky value to constrain the weight model
    16051605    int nParams = PSF ? params->n - 4 : params->n;
    16061606    psF32 So = params->data.F32[0];
     
    16411641                ymodel = modelFunc (NULL, model->params, coord);
    16421642               
    1643                 // this test enhances the noise based on deviation from the model flux
     1643                // this test enhances the weight based on deviation from the model flux
    16441644                Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So));
    16451645
    1646                 // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then
    1647                 //           the minimization function calculates sq().
    1648                 //           should psMinimizeLMChi2 take dY^2?
    1649                 yErr->data.F32[tmpCnt] = sqrt (source->noise->data.F32[i][j] * Ro);
     1646                // psMinimizeLMChi2_EAM takes wt = 1/dY^2
     1647                if (source->weight->data.F32[i][j] == 0) {
     1648                  yErr->data.F32[tmpCnt] = 0.0;
     1649                } else {
     1650                  yErr->data.F32[tmpCnt] = 1.0 / (source->weight->data.F32[i][j] * Ro);
     1651                }
    16501652                tmpCnt++;
    16511653            }
     
    17081710    if (paramMask != NULL) {
    17091711        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    1710         psMinimizeGaussNewtonDelta (delta, params, NULL, x, y, yErr, modelFunc);
     1712        psMinimizeGaussNewtonDelta_EAM (delta, params, NULL, x, y, yErr, modelFunc);
    17111713        for (int i = 0; i < dparams->n; i++) {
    17121714            if (!paramMask->data.U8[i]) continue;
  • trunk/psphot/src/pmObjects_EAM.h

    r5048 r5049  
    55 *  @author GLG, MHPCC
    66 *
    7  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2005-09-14 01:35:20 $
     7 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2005-09-14 02:06:55 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    156156    pmPeak *peak;                       ///< Description of peak pixel.
    157157    psImage *pixels;                    ///< Rectangular region including object pixels.
    158     psImage *noise;                     ///< Mask which marks pixels associated with objects.
     158    psImage *weight;                    ///< Image variance.
    159159    psImage *mask;                      ///< Mask which marks pixels associated with objects.
    160160    pmMoments *moments;                 ///< Basic moments measure for the object.
  • trunk/psphot/src/pmPeaksSigmaLimit.c

    r4954 r5049  
    11# include "psphot.h"
    22
    3 psArray *pmPeaksSigmaLimit (psImageData *imdata, psMetadata *config, psStats *sky)
     3psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky)
    44{
    55    bool  status = false;
  • trunk/psphot/src/psImageData.c

    r4954 r5049  
    11# include "psphot.h"
    22
    3 static void psImageDataFree (psImageData *imdata) {
     3static void eamReadoutFree (eamReadout *imdata) {
    44
    55  if (imdata == NULL) return;
     
    77  psFree (imdata->image);
    88  psFree (imdata->header);
    9   psFree (imdata->noise);
     9  psFree (imdata->weight);
    1010  psFree (imdata->mask);
    1111  return;
    1212}
    1313
    14 psImageData *psImageDataAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header) {
     14eamReadout *eamReadoutAlloc (psImage *image, psImage *weight, psImage *mask, psMetadata *header) {
    1515 
    16     psImageData *imdata = psAlloc(sizeof(psImageData));
     16    eamReadout *imdata = psAlloc(sizeof(eamReadout));
    1717    imdata->image = image;
    1818    imdata->header = header;
    19     imdata->noise = noise;
     19    imdata->weight = weight;
    2020    imdata->mask = mask;
    2121
    22     psMemSetDeallocator(imdata, (psFreeFunc) psImageDataFree);
     22    psMemSetDeallocator(imdata, (psFreeFunc) eamReadoutFree);
    2323    return (imdata);
    2424}
  • trunk/psphot/src/psLibUtils.h

    r5048 r5049  
    2323                                 const psVector *yErr,
    2424                                 psMinimizeLMChi2Func func);
     25
     26bool psMinimizeGaussNewtonDelta_EAM (psVector *delta,
     27                                     const psVector *params,
     28                                     const psVector *paramMask,
     29                                     const psArray  *x,
     30                                     const psVector *y,
     31                                     const psVector *yErr,
     32                                     psMinimizeLMChi2Func func);
    2533
    2634// minimize
  • trunk/psphot/src/psMinimize.c

    r5048 r5049  
    33
    44// XXX EAM : this file contains my alternate implementations of psMinimizeLMChi2
    5 
    65// XXX EAM this implementation of MinLM includes limits on params & dparams
     6
    77psBool psMinimizeLMChi2_EAM(psMinimization *min,
    88                            psImage *covar,
     
    1111                            const psArray *x,
    1212                            const psVector *y,
    13                             const psVector *yErr,
     13                            const psVector *yWt,
    1414                            psMinimizeLMChi2Func func)
    1515{
     
    6060    // the user provides the error or NULL.  we need to convert
    6161    // to appropriate weights
    62     dy = psVectorAlloc (y->n, PS_TYPE_F32);
    63     if (yErr != NULL) {
    64         for (int i = 0; i < dy->n; i++) {
    65             if (yErr->data.F32[i] == 0.0) {
    66                 dy->data.F32[i] = 1.0;
    67                 // mask this?  bad pixel, obviously...
    68             } else {
    69                 dy->data.F32[i] = 1.0 / PS_SQR (yErr->data.F32[i]);
    70             }
    71         }
     62    if (yWt != NULL) {
     63        dy = (psVector *) yWt;
    7264    } else {
    73         for (int i = 0; i < dy->n; i++) {
    74             dy->data.F32[i] = 1.0;
    75         }
     65        dy = psVectorAlloc (y->n, PS_TYPE_F32);
     66        psVectorInit (dy, 1.0);
     67//      for (int i = 0; i < dy->n; i++) {
     68//            dy->data.F32[i] = 1.0;
     69//        }
    7670    }
    7771
     
    8276        return (false);
    8377    }
    84     # ifndef PS_NO_TRACE
     78# ifndef PS_NO_TRACE
    8579    // dump some useful info if trace is defined
    8680    if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) {
     
    9286        p_psVectorPrintRow (psTraceGetDestination(), Params, "params guess");
    9387    }
    94     # endif /* PS_NO_TRACE */
     88# endif /* PS_NO_TRACE */
    9589
    9690    // iterate until the tolerance is reached, or give up
     
    10397        psF64 dLinear = p_psMinLM_dLinear (Beta, beta, lambda);
    10498
    105         # ifndef PS_NO_TRACE
     99# ifndef PS_NO_TRACE
    106100        // dump some useful info if trace is defined
    107101        if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) {
     
    113107            p_psVectorPrintRow (psTraceGetDestination(), Params, "params guess");
    114108        }
    115         # endif /* PS_NO_TRACE */
     109# endif /* PS_NO_TRACE */
    116110
    117111        // calculate Chisq for new guess, update Alpha & Beta
     
    125119
    126120        psTrace (".psLib.dataManip.psMinimizeLMChi2", 4, "last chisq: %f, new chisq %f, delta: %f, rho: %f\n", min->value, Chisq, min->lastDelta, rho);
    127         # ifndef PS_NO_TRACE
     121# ifndef PS_NO_TRACE
    128122        // dump some useful info if trace is defined
    129123        if (psTraceGetLevel (".psLib.dataManip.psMinimizeLMChi2") >= 5) {
     
    132126            p_psVectorPrint (psTraceGetDestination(), Params, "params guess");
    133127        }
    134         # endif /* PS_NO_TRACE */
     128# endif /* PS_NO_TRACE */
    135129
    136130        /* if (Chisq < min->value) {  */
     
    151145    // construct & return the covariance matrix (if requested)
    152146    if (covar != NULL) {
    153       p_psMinLM_GuessABP_EAM (covar, Beta, Params, alpha, beta, params, paramMask, beta_lim, param_min, param_max, 0.0);
     147        p_psMinLM_GuessABP_EAM (covar, Beta, Params, alpha, beta, params, paramMask, beta_lim, param_min, param_max, 0.0);
    154148    }     
    155149
     
    160154    psFree (Beta);
    161155    psFree (Params);
    162     psFree (dy);
     156    if (yWt == NULL) {
     157        psFree (dy);
     158    }
    163159
    164160    if (min->iter == min->maxIter) {
    165       return (false);
     161        return (false);
    166162    }
    167163    return (true);
     
    182178{
    183179
    184     # define USE_LU_DECOMP 1
    185     # if (USE_LU_DECOMP)
     180# define USE_LU_DECOMP 1
     181# if (USE_LU_DECOMP)
    186182    psVector *LUv = NULL;
    187183    psImage  *LUm = NULL;
     
    205201    Alpha = psMatrixInvert (Alpha, A, &det);
    206202
    207     # else
     203# else
    208204    // gauss-jordan version
    209205    psTrace (".psLib.dataManip.psMinLM_GuessABP", 5, "using Gauss-J version");
     
    218214
    219215    psGaussJordan (Alpha, Beta);
    220     # endif
     216# endif
    221217
    222218    // apply Beta to get new Params values
     
    241237    }
    242238
    243     # if (USE_LU_DECOMP)
     239# if (USE_LU_DECOMP)
    244240    psFree (A);
    245241    psFree (LUm);
    246242    psFree (LUv);
    247     # endif
     243# endif
    248244
    249245    return true;
    250246}
    251247
     248bool psMinimizeGaussNewtonDelta_EAM (psVector *delta,
     249                                     const psVector *params,
     250                                     const psVector *paramMask,
     251                                     const psArray  *x,
     252                                     const psVector *y,
     253                                     const psVector *yWt,
     254                                     psMinimizeLMChi2Func func)
     255{
     256
     257    // allocate internal arrays (current vs Guess)
     258    psImage  *alpha  = psImageAlloc  (params->n, params->n, PS_TYPE_F64);
     259    psImage  *Alpha  = psImageAlloc  (params->n, params->n, PS_TYPE_F64);
     260    psVector *beta   = psVectorAlloc (params->n, PS_TYPE_F64);
     261    psVector *Params = psVectorAlloc (params->n, PS_TYPE_F64);
     262    psVector *dy     = NULL;
     263
     264    // the user provides the error or NULL.  we need to convert
     265    // to appropriate weights
     266    if (yWt != NULL) {
     267        dy = (psVector *) yWt;
     268    } else {
     269        dy = psVectorAlloc (y->n, PS_TYPE_F32);
     270        psVectorInit (dy, 1.0);
     271//        for (int i = 0; i < dy->n; i++) {
     272//            dy->data.F32[i] = 1.0;
     273//        }
     274    }
     275
     276    p_psMinLM_SetABX (alpha, beta, params, paramMask, x, y, dy, func);
     277    p_psMinLM_GuessABP (Alpha, delta, Params, alpha, beta, params, paramMask, 0.0);
     278
     279    psFree (alpha);
     280    psFree (Alpha);
     281    psFree (beta);
     282    psFree (Params);
     283    if (yWt == NULL) {
     284        psFree (dy);
     285    }
     286    return (true);
     287}
     288
     289
  • trunk/psphot/src/psphot.c

    r4946 r5049  
    44
    55    psMetadata  *config  = NULL;
    6     psImageData *imdata  = NULL;
     6    eamReadout *imdata  = NULL;
    77    psArray     *sources = NULL;
    88    psArray     *peaks   = NULL;
     
    1414
    1515    // load input data (image and config)
    16     // create or load mask and noise images
     16    // create or load mask and weight images
    1717    // we have memory leaks here -- may be from psMetadata
    1818    imdata = psphotSetup (config);
  • trunk/psphot/src/psphot.h

    r4977 r5049  
    1313    psImage *image;
    1414    psImage *mask;
    15     psImage *noise;
     15    psImage *weight;
    1616    psMetadata *header;
    17 } psImageData;
     17} eamReadout;
    1818
    1919// top-level psphot functions
    2020psMetadata  *psphotArguments (int *argc, char **argv);
    21 psImageData *psphotSetup (psMetadata *config);
    22 psStats     *psphotImageStats (psImageData *imdata, psMetadata *config);
    23 psArray     *pmPeaksSigmaLimit (psImageData *imdata, psMetadata *config, psStats *sky);
    24 psArray     *psphotSourceStats (psImageData *imdata, psMetadata *config, psArray *allpeaks);
     21eamReadout *psphotSetup (psMetadata *config);
     22psStats     *psphotImageStats (eamReadout *imdata, psMetadata *config);
     23psArray     *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky);
     24psArray     *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks);
    2525pmPSF       *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky);
    26 bool         psphotApplyPSF (psImageData *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
    27 bool         psphotFitGalaxies (psImageData *imdata, psMetadata *config, psArray *sources, psStats *skyStats);
    28 void         psphotOutput (psImageData *imdata, psMetadata *config, psArray *sources);
     26bool         psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky);
     27bool         psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats);
     28void         psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources);
    2929
    3030bool         psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE);
     
    3232int          psphotSortBySN (const void **a, const void **b);
    3333int          psphotSaveImage (psMetadata *header, psImage *image, char *filename);
    34 bool         psphotDefinePixels (pmSource *mySource, const psImageData *imdata, psF32 x, psF32 y, psF32 Radius);
     34bool         psphotDefinePixels (pmSource *mySource, const eamReadout *imdata, psF32 x, psF32 y, psF32 Radius);
    3535
    36 // psImageData functions
    37 psImageData *psImageDataAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header);
     36// eamReadout functions
     37eamReadout *eamReadoutAlloc (psImage *image, psImage *noise, psImage *mask, psMetadata *header);
    3838
    3939// output functions
    40 bool         pmSourcesWriteText (psImageData *imdata, char *filename, psArray *sources);
    41 bool         pmSourcesWriteOBJ (psImageData *imdata, char *filename, psArray *sources);
    42 bool         pmSourcesWriteCMP (psImageData *imdata, char *filename, psArray *sources);
    43 bool         pmSourcesWriteCMF (psImageData *imdata, char *filename, psArray *sources);
    44 bool         pmSourcesWriteSX (psImageData *imdata, char *filename, psArray *sources);
     40bool         pmSourcesWriteText (eamReadout *imdata, char *filename, psArray *sources);
     41bool         pmSourcesWriteOBJ (eamReadout *imdata, char *filename, psArray *sources);
     42bool         pmSourcesWriteCMP (eamReadout *imdata, char *filename, psArray *sources);
     43bool         pmSourcesWriteCMF (eamReadout *imdata, char *filename, psArray *sources);
     44bool         pmSourcesWriteSX (eamReadout *imdata, char *filename, psArray *sources);
    4545int          pmSourcesDophotType (pmSource *source);
    4646bool         pmPeaksWriteText (psArray *sources, char *filename);
  • trunk/psphot/src/psphotApplyPSF.c

    r5048 r5049  
    55// run this function to a specific flux limit?
    66
    7 bool psphotApplyPSF (psImageData *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky)
     7bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky)
    88{
    99    bool  status;
     
    6161        // XXX EAM : a better test would examine the source pixels
    6262        if (model->radius > OUTER_RADIUS) {
    63           // (re)-allocate image, noise, mask arrays for each peak (square of radius OUTER)
     63          // (re)-allocate image, weight, mask arrays for each peak (square of radius OUTER)
    6464            psphotDefinePixels (source, imdata, x, y, model->radius);
    6565        }
  • trunk/psphot/src/psphotArguments.c

    r4977 r5049  
    2222  }
    2323
    24   // optional noise image - add to config
    25   char *noise = NULL;
    26   if ((N = psArgumentGet (*argc, argv, "-noise"))) {
     24  // optional weight image - add to config
     25  char *weight = NULL;
     26  if ((N = psArgumentGet (*argc, argv, "-weight"))) {
    2727    psArgumentRemove (N, argc, argv);
    28     noise = psStringCopy (argv[N]);
     28    weight = psStringCopy (argv[N]);
    2929    psArgumentRemove (N, argc, argv);
    3030  }
     
    4646  fprintf (stderr, "loaded config...\n");
    4747
    48   // identify input image & optional noise & mask images
     48  // identify input image & optional weight & mask images
    4949  // command-line entries override config-file entries
    5050  psMetadataAdd (config, PS_LIST_HEAD, "IMAGE",       mode, "", argv[1]);
     
    5454    psMetadataAdd (config, PS_LIST_HEAD, "MASK_IMAGE", mode, "", mask);
    5555  }
    56   if (noise != NULL) {
    57     psMetadataAdd (config, PS_LIST_HEAD, "NOISE_IMAGE", mode, "", noise);
     56  if (weight != NULL) {
     57    psMetadataAdd (config, PS_LIST_HEAD, "WEIGHT_IMAGE", mode, "", weight);
    5858  }
    5959  if (resid != NULL) {
     
    6868    fprintf (stderr, "options: \n");
    6969    fprintf (stderr, "  -mask  (filename)\n");
    70     fprintf (stderr, "  -noise (filename)\n");
     70    fprintf (stderr, "  -weight (filename)\n");
    7171    fprintf (stderr, "  -resid (filename)\n");
    7272    exit (2);
  • trunk/psphot/src/psphotDefinePixels.c

    r4977 r5049  
    22
    33bool psphotDefinePixels(pmSource *mySource,
    4                         const psImageData *imdata,
     4                        const eamReadout *imdata,
    55                        psF32 x,
    66                        psF32 y,
     
    1414
    1515    mySource->pixels = psImageSubset(imdata->image, srcRegion);
    16     mySource->noise  = psImageSubset(imdata->noise, srcRegion);
     16    mySource->weight = psImageSubset(imdata->weight, srcRegion);
    1717    mySource->mask   = psImageSubset(imdata->mask,  srcRegion);
    1818
  • trunk/psphot/src/psphotFitGalaxies.c

    r5048 r5049  
    11# include "psphot.h"
    22
    3 bool psphotFitGalaxies (psImageData *imdata, psMetadata *config, psArray *sources, psStats *skyStats)
     3bool psphotFitGalaxies (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats)
    44{
    55    bool  status, goodfit;
     
    6969        // XXX EAM : a better test would examine the source pixels
    7070        if (model->radius > OUTER_RADIUS) {
    71           // (re)-allocate image, noise, mask arrays for each peak (square of radius OUTER)
     71          // (re)-allocate image, weight, mask arrays for each peak (square of radius OUTER)
    7272          psphotDefinePixels (source, imdata, x, y, model->radius);
    7373        }
  • trunk/psphot/src/psphotImageStats.c

    r4946 r5049  
    11# include "psphot.h"
    22
    3 psStats *psphotImageStats (psImageData *imdata, psMetadata *config)
     3psStats *psphotImageStats (eamReadout *imdata, psMetadata *config)
    44{
    55    psStats *stats = NULL;
  • trunk/psphot/src/psphotOutput.c

    r5048 r5049  
    22
    33// output functions: we have several fixed modes (sx, obj, cmp)
    4 void psphotOutput (psImageData *imdata, psMetadata *config, psArray *sources) {
     4void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources) {
    55
    66    bool status;
     
    4747}
    4848
    49 bool pmSourcesWriteText (psImageData *imdata, char *filename, psArray *sources) {
     49bool pmSourcesWriteText (eamReadout *imdata, char *filename, psArray *sources) {
    5050
    5151    char *name = (char *) psAlloc (strlen(filename) + 10);
     
    6868
    6969// dophot-style output list with fixed line width
    70 bool pmSourcesWriteOBJ (psImageData *imdata, char *filename, psArray *sources) {
     70bool pmSourcesWriteOBJ (eamReadout *imdata, char *filename, psArray *sources) {
    7171
    7272    int i, type, status;
     
    159159
    160160// elixir/sextractor-style output list with fixed line width
    161 bool pmSourcesWriteSX (psImageData *imdata, char *filename, psArray *sources) {
     161bool pmSourcesWriteSX (eamReadout *imdata, char *filename, psArray *sources) {
    162162
    163163    int i, status, flags;
     
    257257
    258258// elixir-style pseudo FITS table (header + ascii list)
    259 bool pmSourcesWriteCMP (psImageData *imdata, char *filename, psArray *sources) {
     259bool pmSourcesWriteCMP (eamReadout *imdata, char *filename, psArray *sources) {
    260260
    261261    int i, type, status;
     
    360360
    361361// elixir-style FITS table output (header + table in 1st extension)
    362 bool pmSourcesWriteCMF (psImageData *imdata, char *filename, psArray *sources) {
     362bool pmSourcesWriteCMF (eamReadout *imdata, char *filename, psArray *sources) {
    363363
    364364    // write imdata->header to file
  • trunk/psphot/src/psphotSetup.c

    r4954 r5049  
    55//   apply X/Y border info
    66//   apply the SATURATE mask?
    7 // load or construct the noise
     7// load or construct the weight
    88
    9 psImageData *psphotSetup (psMetadata *config)
     9eamReadout *psphotSetup (psMetadata *config)
    1010{
    1111    psMetadata *header = NULL;
    1212    psImage *image = NULL;
    13     psImage *noise = NULL;
     13    psImage *weight = NULL;
    1414    psImage *mask = NULL;
    1515    psRegion region = {0,0,0,0};        // a region representing the entire array
     
    3939    psMetadataAdd (config, PS_LIST_TAIL, "GAIN",    PS_META_F32 | PS_META_REPLACE, "gain value used", GAIN);
    4040
    41     // load the noise image if it is supplied, otherwise build from input
    42     char *noiseName = psMetadataLookupPtr (&status, config, "NOISE");
     41    // load the weight image if it is supplied, otherwise build from input
     42    // by 'weight' we really mean variance image
     43    char *weightName = psMetadataLookupPtr (&status, config, "WEIGHT");
    4344    if (status == true) {
    44         file = psFitsAlloc (noiseName);
    45         noise = psFitsReadImage  (NULL, file, region, 0);
     45        file = psFitsAlloc (weightName);
     46        weight = psFitsReadImage  (NULL, file, region, 0);
    4647        psFree (file);
    47         // psFree (noiseName); XXX - see psFree (input)
     48        // psFree (weightName); XXX - see psFree (input)
    4849    } else {
    49         // build the noise image from the input image, RDNOISE, and GAIN
    50         noise = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
     50        // build the weight image from the input image, RDNOISE, and GAIN
     51        weight = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    5152        for (int iy = 0; iy < image->numRows; iy++) {
    5253            for (int ix = 0; ix < image->numCols; ix++) {
    53                 noise->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN);
     54                weight->data.F32[iy][ix] = image->data.F32[iy][ix] / GAIN + PS_SQR(RDNOISE/GAIN);
    5455            }
    5556        }
     
    9293
    9394    // save the image data & return it
    94     psImageData *imdata = psImageDataAlloc(image, noise, mask, header);
     95    eamReadout *imdata = eamReadoutAlloc(image, weight, mask, header);
    9596    return (imdata);
    9697}
  • trunk/psphot/src/psphotSourceStats.c

    r5048 r5049  
    11# include "psphot.h"
    22
    3 psArray *psphotSourceStats (psImageData *imdata, psMetadata *config, psArray *peaks)
     3psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *peaks)
    44{
    55    bool     status  = false;
     
    2222        source->peak = (pmPeak *)psMemCopy(peaks->data[i]);
    2323
    24         // allocate image, noise, mask arrays for each peak (square of radius OUTER)
     24        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
    2525        // XXX EAM : this has 12 leaks (v.5)
    2626        psphotDefinePixels (source, imdata, source->peak->x, source->peak->y, OUTER);
  • trunk/psphot/src/psphotSubtractPSF.c

    r5048 r5049  
    3131  model->params->data.F32[0] = sky;
    3232
    33   // XXX EAM : amplify the noise matrix a la dophot?
     33  // XXX EAM : amplify the weight matrix a la dophot?
    3434
    3535  return (true);
Note: See TracChangeset for help on using the changeset viewer.