IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 19, 2013, 6:40:03 AM (13 years ago)
Author:
eugene
Message:

replace ad-hoc code for central pixel with pmModelCP call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130711/psModules/src/objects/models/pmModel_DEV.c

    r35961 r35966  
    4848#include "pmPSFtry.h"
    4949#include "pmDetections.h"
     50#include "pmModel_CentralPixel.h"
    5051
    5152#include "pmModel_DEV.h"
     
    8990static bool limitsApply = true;         // Apply limits?
    9091
    91 // # include "pmModel_SERSIC.CP.h"
    92 
    9392psF32 PM_MODEL_FUNC (psVector *deriv,
    9493                     const psVector *params,
     
    129128    // For DELTA = 0.02 & Rmin/Rmaj = 0.25, I'm over flux by 0.15 mags (due to the central pixel)
    130129    psF32 radius = hypot(X, Y);
    131     if (radius < 1.0) {
    132       // subdivide the central 2,3,4 pixels by Nx,Ny
    133       float Npix = 0.0;
    134       float Fpix = 0.0;
    135       float Xpix = floor(pixcoord->data.F32[0]) - PAR[PM_PAR_XPOS];
    136       float Ypix = floor(pixcoord->data.F32[1]) - PAR[PM_PAR_YPOS];
    137       # define DELTA 0.02
    138       for (float ix = 0.1; ix <= 0.9; ix += DELTA) {
    139         for (float iy = 0.1; iy <= 0.9; iy += DELTA) {
    140           psF32 X  = Xpix + ix;
    141           psF32 Y  = Ypix + iy;
    142           psF32 px = X / PAR[PM_PAR_SXX];
    143           psF32 py = Y / PAR[PM_PAR_SYY];
    144           psF32 z  = PS_SQR(px) + PS_SQR(py) + PAR[PM_PAR_SXY]*X*Y;
    145          
    146           // sqrt(z) is r
    147           float q = kappa*pow(z,ALPHA);
    148           psF32 f0 = exp(-q);
    149          
    150           psF32 f1 = PAR[PM_PAR_I0]*f0;
    151           psF32 fx = PAR[PM_PAR_SKY] + f1;
    152           Fpix += fx;
    153           Npix += 1.0;
    154         }
    155       }
    156       f = Fpix / Npix;
     130    if (radius <= 1.5) {
     131        // Nsub ~ 10*index^2 + 1
     132        psEllipseAxes axes = pmPSF_ModelToAxes(PAR, pmModelClassGetType ("PS_MODEL_DEV"));
     133        int Nsub = 2 * ((int)(25 / axes.minor)) + 1;
     134        Nsub = PS_MIN (Nsub, 121);
     135        Nsub = PS_MAX (Nsub, 11);
     136        f0 = pmModelCP_SersicSubpix (X, Y, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], 4.0, Nsub);
     137        f1 = PAR[PM_PAR_I0]*f0;
     138        f = PAR[PM_PAR_SKY] + f1;
    157139    }   
    158140
Note: See TracChangeset for help on using the changeset viewer.