IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6751


Ignore:
Timestamp:
Mar 31, 2006, 4:47:20 PM (20 years ago)
Author:
magnier
Message:

fixed up low-level issues with sky levels, sky bias

Location:
branches/rel10_ifa/psModules/src/objects
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/objects/pmGrowthCurve.c

    r6556 r6751  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.1.4.2 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-03-09 03:14:23 $
     7 *  @version $Revision: 1.1.4.3 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-04-01 02:47:20 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2626}
    2727
    28 pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 dRadius)
     28pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius)
    2929{
    3030
     
    3232    psMemSetDeallocator(growth, (psFreeFunc) pmGrowthCurveFree);
    3333
    34     growth->radius = psVectorCreate (NULL, minRadius, maxRadius, dRadius, PS_TYPE_F32);
     34    // fractional pixel radii are not well defined; use integer steps
     35    growth->radius = psVectorCreate (NULL, minRadius, maxRadius, 1.0, PS_TYPE_F32);
    3536    growth->apMag  = psVectorAlloc (growth->radius->n, PS_TYPE_F32);
    3637
    3738    // XXX may want to extend this to allow for a different refRadius;
    38     growth->refRadius = maxRadius;
     39    growth->refRadius = refRadius;
    3940    growth->maxRadius = maxRadius;
    4041    growth->apLoss = 0.0;
     
    111112
    112113    if (n1 == 0) {
    113         int n0 = psVectorBracket (index, key, FALSE);
     114        n0 = psVectorBracket (index, key, FALSE);
    114115        n1 = n0 + 1;
    115116    }
  • branches/rel10_ifa/psModules/src/objects/pmGrowthCurve.h

    r6556 r6751  
    1515pmGrowthCurve;
    1616
    17 pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 dRadius);
     17pmGrowthCurve *pmGrowthCurveAlloc (psF32 minRadius, psF32 maxRadius, psF32 refRadius);
    1818int psVectorBracket (psVector *index, psF32 key, bool above);
    1919psF32 psVectorInterpolate (psVector *index, psVector *value, psF32 key);
  • branches/rel10_ifa/psModules/src/objects/pmModel.c

    r6556 r6751  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-03-09 03:14:23 $
     8 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-01 02:47:20 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    tmp->chisq = 0.0;
    5151    tmp->nIter = 0;
    52     tmp->radius = 0;
     52    tmp->radiusTMP = 0;
    5353    tmp->status = PM_MODEL_UNTRIED;
    5454
     
    8282    new->nIter  = model->nIter;
    8383    new->status = model->status;
    84     new->radius = model->radius;
     84    new->radiusTMP = model->radiusTMP;
    8585
    8686    for (int i = 0; i < new->params->n; i++) {
  • branches/rel10_ifa/psModules/src/objects/pmModel.h

    r6556 r6751  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-03-09 03:14:23 $
     8 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-01 02:47:20 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4545    int nIter;    ///< number of iterations to reach min
    4646    pmModelStatus status;  ///< fit status
    47     float radius;   ///< fit radius actually used
     47    float radiusTMP;   ///< fit radius actually used
    4848}
    4949pmModel;
  • branches/rel10_ifa/psModules/src/objects/pmSourceFitModel.c

    r6556 r6751  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-03-09 03:14:23 $
     8 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-04-01 02:47:20 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    117117    psMinConstrain *constrain = psMinConstrainAlloc();
    118118
    119     // PSF model only fits first 4 parameters, EXT model fits all
     119    // PSF model only fits x,y,Io, EXT model fits all (both skip sky)
     120    paramMask = psVectorAlloc (params->n, PS_TYPE_U8);
     121    paramMask->data.U8[0] = 1;
    120122    if (PSF) {
    121         paramMask = psVectorAlloc (params->n, PS_TYPE_U8);
    122         for (int i = 0; i < 4; i++) {
     123        for (int i = 1; i < 4; i++) {
    123124            paramMask->data.U8[i] = 0;
    124125        }
    125126        for (int i = 4; i < paramMask->n; i++) {
    126127            paramMask->data.U8[i] = 1;
     128        }
     129    } else {
     130        for (int i = 1; i < paramMask->n; i++) {
     131            paramMask->data.U8[i] = 0;
    127132        }
    128133    }
  • branches/rel10_ifa/psModules/src/objects/pmSourceFitSet.c

    r6556 r6751  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-01 02:47:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    150150    constrain->paramMin->data.F32[0]   = oneParMin->data.F32[0];
    151151    constrain->paramMax->data.F32[0]   = oneParMax->data.F32[0];
    152     constrain->paramMask->data.U8[0]   = 0;
     152
     153    // XXX all models skip the sky
     154    constrain->paramMask->data.U8[0]   = 1;
    153155    for (int i = 0; i < nSrc; i++) {
    154156        model = modelSet->data[i];
  • branches/rel10_ifa/psModules/src/objects/pmSourceIO_RAW.c

    r6712 r6751  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-28 02:14:56 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-01 02:47:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9595                 log10(model[0].chisq/model[0].nDOF),
    9696                 source[0].moments->SN,
    97                  model[0].radius,
     97                 model[0].radiusTMP,
    9898                 model[0].nDOF,
    9999                 model[0].nIter);
     
    125125        if (source->type != PM_SOURCE_TYPE_EXTENDED)
    126126            continue;
    127         model = pmSourceMagnitudes (source, NULL, 0.0);
     127        model = pmSourceMagnitudes (source, NULL, false, false);
    128128        if (model == NULL)
    129129            continue;
     
    151151                 log10(model[0].chisq/model[0].nDOF),
    152152                 source[0].moments->SN,
    153                  model[0].radius,
     153                 model[0].radiusTMP,
    154154                 model[0].nDOF,
    155155                 model[0].nIter);
  • branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.c

    r6556 r6751  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-01 02:47:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555// XXX EAM : masked region should be (optionally) elliptical
    5656// XXX curve of growth is corrected to
    57 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius)
     57pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr)
    5858{
    5959
     
    6262    float x, y;
    6363    float rflux;
    64     float radius;
    6564    float SN;
    6665    pmModel *model;
     
    7170        if (model == NULL)
    7271            return NULL;
    73         radius = (apRadius > 0) ? apRadius : model->radius;
    7472        isPSF = true;
    7573        break;
     
    7977        if (model == NULL)
    8078            return NULL;
    81         radius = model->radius;
    8279        isPSF = false;
    8380        break;
     
    10198    pmModelAdd (source->pixels, source->mask, model, false, false);
    10299
    103     // set aperture mask circle to scaled radius
    104     psImageKeepCircle (source->mask, x, y, model->radius, "OR", PM_SOURCE_MASK_MARKED);
     100    // set aperture mask circle to model radius
     101    psImageKeepCircle (source->mask, x, y, model->radiusTMP, "OR", PM_SOURCE_MASK_MARKED);
    105102
    106103    // measure object model photometry
     
    110107    // measure object aperture photometry
    111108    if (SN > AP_MIN_SN) {
    112         status = pmSourcePhotometryAper  (&source->apMag,  model, source->pixels, source->mask);
     109        status = pmSourcePhotometryAper  (&source->apMag, model, source->pixels, source->mask);
    113110    } else {
    114111        source->apMag = 99.0;
     
    118115    if (isPSF && (psf != NULL)) {
    119116        if (SN > AP_MIN_SN) {
    120             if (psf->growth != NULL) {
    121                 source->apMag += pmGrowthCurveCorrect (psf->growth, radius);
     117            if ((psf->growth != NULL) && growthCorr) {
     118                source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP);
    122119            }
    123             rflux   = pow (10.0, 0.4*source->psfMag);
    124             source->apMag  -= PS_SQR(model->radius)*rflux * psf->skyBias + psf->skySat / rflux;
    125         }
    126         source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     120            if (apTrendCorr) {
     121                rflux   = pow (10.0, 0.4*source->psfMag);
     122                source->apMag  -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux;
     123            }
     124        }
     125        if (apTrendCorr) {
     126            source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     127        }
    127128    }
    128129
    129130    // unmask aperture
    130     psImageKeepCircle (source->mask, x, y, model->radius, "AND", ~PM_SOURCE_MASK_MARKED);
     131    psImageKeepCircle (source->mask, x, y, model->radiusTMP, "AND", ~PM_SOURCE_MASK_MARKED);
    131132
    132133    // subtract object, leave local sky
     
    168169}
    169170
     171# define DO_SKY 0
    170172// return source aperture magnitude
    171173bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask)
    172174{
    173 
    174175    float apSum = 0;
     176    float sky = 0;
    175177    *apMag = 99.0;
    176178
     
    179181    }
    180182
    181     float sky = model->params->data.F32[0];
     183    if (DO_SKY) {
     184        sky = model->params->data.F32[0];
     185    } else {
     186        sky = 0;
     187    }
    182188
    183189    // measure apMag
     
    191197    if (apSum <= 0)
    192198        return false;
     199
    193200    *apMag = -2.5*log10(apSum);
    194 
    195201    return (true);
    196202}
  • branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.h

    r6556 r6751  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-01 02:47:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131
    3232bool pmSourcePhotometryAper(
    33     float *apMag,                       ///< aperture flux magnitude
     33    float   *apMag,                     ///< aperture flux magnitude
    3434    pmModel *model,                     ///< model used for photometry
    3535    psImage *image,                     ///< image pixels to be used
     
    3737);
    3838
    39 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius);
     39pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr);
    4040float pmSourceCrossProduct (pmSource *Mi, pmSource *Mj);
    4141float pmSourceCrossWeight (pmSource *Mi, pmSource *Mj);
Note: See TracChangeset for help on using the changeset viewer.