IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35967


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

add pmModelCP_SersicSubpix to calculate the central pixel flux (direct, no interpolation)

Location:
branches/eam_branches/ipp-20130711/psModules/src/objects
Files:
2 edited

Legend:

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

    r35961 r35967  
    687687}
    688688
     689// this is a test function which generates a full sersic model evaluation with sub-pixel sampling
     690// Nsub is the number of sub-pixel samplings and must be odd
     691// dx,dy are the centroid offset
     692float pmModelCP_SersicSubpix (float dx, float dy, float Rxx, float Rxy, float Ryy, float Sindex, int Nsub) {
     693
     694    float flux = 0.0;
     695    int   npix = 0;
     696
     697    float kappa = -0.275552 + 1.972625*Sindex + 0.003487 * PS_SQR(Sindex);
     698    float rindex = 0.5 / Sindex;
     699
     700    // have the resolution be a user-parameter?
     701    psAssert (Nsub % 2 == 1, "Nsub is not odd");
     702    int Nsub2 = (Nsub - 1) / 2;
     703
     704    float delta = 1.0 / (float) Nsub;
     705    float off = -Nsub2 * delta;
     706    for (float ix = off; ix < 0.5; ix += delta) {
     707        for (float iy = off; iy < 0.5; iy += delta) {
     708
     709            float dX = dx + ix;
     710            float dY = dy + iy;
     711            float z = PS_SQR(dX / Rxx) + PS_SQR(dY / Ryy) + dX * dY * Rxy;
     712
     713            float q = pow (z, rindex);
     714            float f = exp(-kappa*q);
     715
     716            flux += f;
     717            npix ++;
     718        }
     719    }
     720    float normFlux = flux / npix;
     721    // fprintf (stderr, "full : %f %f %f\n", flux, (float) npix, normFlux);
     722    return normFlux;
     723}
     724
    689725# if (0)
    690726// create a vector containing only the unique entries in the input vector
  • branches/eam_branches/ipp-20130711/psModules/src/objects/pmModel_CentralPixel.h

    r35947 r35967  
    6262float pmModelCP_GetFlux_Old (pmModelCP *cp, float dx, float dy, float theta);
    6363
     64float pmModelCP_SersicSubpix (float dx, float dy, float Rxx, float Rxy, float Ryy, float Sindex, int Nsub);
     65
    6466# endif
Note: See TracChangeset for help on using the changeset viewer.