IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9897


Ignore:
Timestamp:
Nov 7, 2006, 12:55:40 PM (20 years ago)
Author:
jhoblitt
Message:

move pmGrowthCurveGenerate() from pmGrowthCurve.c -> pmPSF.c

Location:
trunk/psModules/src/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmGrowthCurve.c

    r9879 r9897  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-11-07 09:04:08 $
     7 *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-11-07 22:55:40 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#include <pslib.h>
    1919#include "pmFPA.h"
    20 #include "pmFPAMaskWeight.h"
    2120#include "pmPeaks.h"
    2221#include "pmMoments.h"
     
    2625#include "pmPSF.h"
    2726#include "psVectorBracket.h"
    28 #include "pmSourcePhotometry.h"
    2927
    3028static void pmGrowthCurveFree (pmGrowthCurve *growth)
     
    6462    return apCor;
    6563}
    66 
    67 // we generate the growth curve for the center of the image with the specified psf model
    68 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore)
    69 {
    70 
    71     // bool status;
    72     float xc, yc, dx, dy;
    73     float fitMag, apMag;
    74     float radius;
    75 
    76     // create template model
    77     pmModel *modelRef = pmModelAlloc(psf->type);
    78 
    79     // use the center of the center pixel of the image
    80     xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;
    81     yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;
    82     dx = psf->growth->maxRadius + 1;
    83     dy = psf->growth->maxRadius + 1;
    84 
    85     // assign the x and y coords to the image center
    86     // create an object with center intensity of 1000
    87     modelRef->params->data.F32[PM_PAR_SKY] = 0;
    88     modelRef->params->data.F32[PM_PAR_I0] = 1000;
    89     modelRef->params->data.F32[PM_PAR_XPOS] = xc;
    90     modelRef->params->data.F32[PM_PAR_YPOS] = yc;
    91 
    92     // create modelPSF from this model
    93     pmModel *model = pmModelFromPSF (modelRef, psf);
    94 
    95     // measure the fitMag for this model
    96     pmSourcePhotometryModel (&fitMag, model);
    97     psf->growth->fitMag = fitMag;
    98 
    99     // generate working image for this source
    100     psRegion region = {xc - dx, xc + dx, yc - dy, yc + dy};
    101     psImage *view = psImageSubset (readout->image, region);
    102     psImage *image = psImageCopy (NULL, view, PS_TYPE_F32);
    103     psImage *mask = psImageCopy (NULL, view, PS_TYPE_U8);
    104 
    105     psImageInit (image, 0.0);
    106     psImageInit (mask, 0);
    107 
    108     // place the reference object in the image center
    109     // no need to mask the source here
    110     pmModelAdd (image, NULL, model, false, false);
    111 
    112     // loop over a range of source fluxes
    113     // no need to interpolate since we have forced the object center
    114     // to 0.5, 0.5 above
    115     for (int i = 0; i < psf->growth->radius->n; i++) {
    116 
    117         radius = psf->growth->radius->data.F32[i];
    118 
    119         // mask the given aperture and measure the apMag
    120         psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);
    121         pmSourcePhotometryAper (&apMag, model, image, mask);
    122         psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(PM_MASK_MARK));
    123 
    124         // the 'ignore' mode is for testing
    125         if (ignore) {
    126             psf->growth->apMag->data.F32[i] = fitMag;
    127         } else {
    128             psf->growth->apMag->data.F32[i] = apMag;
    129         }
    130     }
    131 
    132     psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
    133     psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
    134 
    135     psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f\n", psf->growth->apLoss);
    136 
    137     psFree (view);
    138     psFree (image);
    139     psFree (mask);
    140     psFree (model);
    141     psFree (modelRef);
    142 
    143     return true;
    144 }
  • trunk/psModules/src/objects/pmGrowthCurve.h

    r9879 r9897  
    1717pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius);
    1818psF32 pmGrowthCurveCorrect (pmGrowthCurve *growth, psF32 radius);
    19 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore);
    2019
    2120# endif /* PM_GROWTH_CURVE_H */
  • trunk/psModules/src/objects/pmPSF.c

    r9882 r9897  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-11-07 09:08:59 $
     8 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-11-07 22:55:40 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3232#include "pmPSF.h"
    3333#include "pmModelGroup.h"
     34#include "pmSourcePhotometry.h"
     35#include "pmFPAMaskWeight.h"
     36#include "psVectorBracket.h"
    3437
    3538/*****************************************************************************/
     
    364367}
    365368
     369// we generate the growth curve for the center of the image with the specified psf model
     370bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore)
     371{
     372
     373    // bool status;
     374    float xc, yc, dx, dy;
     375    float fitMag, apMag;
     376    float radius;
     377
     378    // create template model
     379    pmModel *modelRef = pmModelAlloc(psf->type);
     380
     381    // use the center of the center pixel of the image
     382    xc = 0.5*readout->image->numCols + readout->image->col0 + 0.5;
     383    yc = 0.5*readout->image->numRows + readout->image->row0 + 0.5;
     384    dx = psf->growth->maxRadius + 1;
     385    dy = psf->growth->maxRadius + 1;
     386
     387    // assign the x and y coords to the image center
     388    // create an object with center intensity of 1000
     389    modelRef->params->data.F32[PM_PAR_SKY] = 0;
     390    modelRef->params->data.F32[PM_PAR_I0] = 1000;
     391    modelRef->params->data.F32[PM_PAR_XPOS] = xc;
     392    modelRef->params->data.F32[PM_PAR_YPOS] = yc;
     393
     394    // create modelPSF from this model
     395    pmModel *model = pmModelFromPSF (modelRef, psf);
     396
     397    // measure the fitMag for this model
     398    pmSourcePhotometryModel (&fitMag, model);
     399    psf->growth->fitMag = fitMag;
     400
     401    // generate working image for this source
     402    psRegion region = {xc - dx, xc + dx, yc - dy, yc + dy};
     403    psImage *view = psImageSubset (readout->image, region);
     404    psImage *image = psImageCopy (NULL, view, PS_TYPE_F32);
     405    psImage *mask = psImageCopy (NULL, view, PS_TYPE_U8);
     406
     407    psImageInit (image, 0.0);
     408    psImageInit (mask, 0);
     409
     410    // place the reference object in the image center
     411    // no need to mask the source here
     412    pmModelAdd (image, NULL, model, false, false);
     413
     414    // loop over a range of source fluxes
     415    // no need to interpolate since we have forced the object center
     416    // to 0.5, 0.5 above
     417    for (int i = 0; i < psf->growth->radius->n; i++) {
     418
     419        radius = psf->growth->radius->data.F32[i];
     420
     421        // mask the given aperture and measure the apMag
     422        psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);
     423        pmSourcePhotometryAper (&apMag, model, image, mask);
     424        psImageKeepCircle (mask, xc, yc, radius, "AND", PS_NOT_U8(PM_MASK_MARK));
     425
     426        // the 'ignore' mode is for testing
     427        if (ignore) {
     428            psf->growth->apMag->data.F32[i] = fitMag;
     429        } else {
     430            psf->growth->apMag->data.F32[i] = apMag;
     431        }
     432    }
     433
     434    psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
     435    psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
     436
     437    psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f\n", psf->growth->apLoss);
     438
     439    psFree (view);
     440    psFree (image);
     441    psFree (mask);
     442    psFree (model);
     443    psFree (modelRef);
     444
     445    return true;
     446}
  • trunk/psModules/src/objects/pmPSF.h

    r9882 r9897  
    9393double pmPSF_SXYtoModel (psF32 *fittedPar);
    9494
     95bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore);
     96
    9597# endif
Note: See TracChangeset for help on using the changeset viewer.