IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2009, 3:12:47 PM (17 years ago)
Author:
eugene
Message:

check in changes from gene@development branch : extensive changes to moments calculation, psf model generation, aperture residuals; improvements to extended source analysis

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src

    • Property svn:ignore
      •  

        old new  
        1818psphotVersionDefinitions.h
        1919psphotMomentsStudy
         20psphotPetrosianStudy
  • trunk/psphot/src/psphotRadialProfile.c

    r21366 r25755  
    11# include "psphotInternal.h"
    22
    3 # define COMPARE_RADIUS(A,B) (radius->data.F32[A] < radius->data.F32[B])
    4 # define SWAP_RADIUS(TYPE,A,B) { \
    5   float tmp; \
    6   if (A != B) { \
    7     tmp = radius->data.F32[A]; \
    8     radius->data.F32[A] = radius->data.F32[B]; \
    9     radius->data.F32[B] = tmp; \
    10     tmp = flux->data.F32[A]; \
    11     flux->data.F32[A] = flux->data.F32[B]; \
    12     flux->data.F32[B] = tmp; \
    13     tmp = variance->data.F32[A]; \
    14     variance->data.F32[A] = variance->data.F32[B]; \
    15     variance->data.F32[B] = tmp; \
    16   } \
    17 }
    18 
    19 bool psphotRadialProfile (pmSource *source, psMetadata *recipe, psImageMaskType maskVal) {
     3bool psphotRadialProfile (pmSource *source, psMetadata *recipe, float skynoise, psImageMaskType maskVal) {
    204
    215    // allocate pmSourceExtendedParameters, if not already defined
     
    2812    }
    2913
    30     int nPts = source->pixels->numRows * source->pixels->numCols;
    31     source->extpars->profile->radius = psVectorAllocEmpty (nPts, PS_TYPE_F32);
    32     source->extpars->profile->flux   = psVectorAllocEmpty (nPts, PS_TYPE_F32);
    33     source->extpars->profile->variance = psVectorAllocEmpty (nPts, PS_TYPE_F32);
     14    // XXX these need to go into recipe values
     15    int Nsec = 24;
     16    float Rmax = 200;
     17    float fluxMin = 0.0;
     18    float fluxMax = source->peak->flux;
    3419
    35     psVector *radius = source->extpars->profile->radius;
    36     psVector *flux   = source->extpars->profile->flux;
    37     psVector *variance = source->extpars->profile->variance;
     20    // generate a series of radial profiles at Nsec evenly spaced angles.  the profile flux
     21    // is measured by interpolation for small radii; for large radii, the pixels in a box
     22    // are averaged to increase the S/N
     23    if (!psphotRadialProfilesByAngles (source, Nsec, Rmax)) {
     24        psError (PS_ERR_UNKNOWN, false, "failed to measure radial profile for petrosian");
     25        return false;
     26    }
    3827
    39     // XXX use the extended source model here for Xo, Yo?
    40     // XXX define a radius scaled to the elliptical contour?
     28    // use the radial profiles to determine the radius of a given isophote.  this isophote
     29    // is used to determine the elliptical shape of the object, so it has a relatively high
     30    // value (nominally 50% of the peak)
     31    if (!psphotRadiiFromProfiles (source, fluxMin, fluxMax)) {
     32        psError (PS_ERR_UNKNOWN, false, "failed to measure isophotal radii from profiles");
     33        return false;
     34    }
    4135
    42     int n = 0;
    43 
    44     float Xo = 0.0;
    45     float Yo = 0.0;
    46 
    47     if (source->modelEXT) {
    48       Xo = source->modelEXT->params->data.F32[PM_PAR_XPOS] - source->pixels->col0;
    49       Yo = source->modelEXT->params->data.F32[PM_PAR_YPOS] - source->pixels->row0;
    50     } else {
    51       Xo = source->peak->xf - source->pixels->col0;
    52       Yo = source->peak->yf - source->pixels->row0;
     36    // convert the isophotal radius vs angle measurements to an elliptical contour
     37    if (!psphotEllipticalContour (source)) {
     38        psLogMsg ("psphot", 3, "failed to measure elliptical contour");
     39        return false;
    5340    }
    54     for (int iy = 0; iy < source->pixels->numRows; iy++) {
    55         for (int ix = 0; ix < source->pixels->numCols; ix++) {
    56             if (source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix]) continue;
    57             radius->data.F32[n] = hypot (ix - Xo, iy - Yo) ;
    58             flux->data.F32[n]   = source->pixels->data.F32[iy][ix];
    59             variance->data.F32[n] = source->variance->data.F32[iy][ix];
    60             n++;
    61         }
     41 
     42    // generate a single, normalized radial profile following the elliptical contours.
     43    // the radius is normalized by the axis ratio so that on the major axis, 1 pixel = 1 pixel
     44    if (!psphotEllipticalProfile (source)) {
     45        psError (PS_ERR_UNKNOWN, false, "failed to generate elliptical profile");
     46        return false;
    6247    }
    63     radius->n = n;
    64     variance->n = n;
    65     flux->n = n;
    66 
    67     // sort the vector set by the radius
    68     PSSORT (radius->n, COMPARE_RADIUS, SWAP_RADIUS, NONE);
    69 
     48 
    7049    return true;
    7150}
Note: See TracChangeset for help on using the changeset viewer.