IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15400


Ignore:
Timestamp:
Oct 28, 2007, 3:41:13 PM (19 years ago)
Author:
eugene
Message:

adding extended source measurements

Location:
branches/eam_branch_20071023/psphot/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071023/psphot/src/Makefile.am

    r15040 r15400  
    4747        psphotModelWithPSF.c     \
    4848        psphotExtendedSources.c  \
     49        psphotRadialProfile.c    \
    4950        psphotPetrosian.c        \
    5051        psphotIsophotal.c        \
  • branches/eam_branch_20071023/psphot/src/psphot.h

    r15040 r15400  
    116116psKernel       *psphotKernelFromPSF (pmSource *source, int nPix);
    117117
     118bool            psphotRadialProfile (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    118119bool            psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal);
    119120bool            psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal);
  • branches/eam_branch_20071023/psphot/src/psphotAnnuli.c

    r15359 r15400  
    88  assert (source->extpars->profile->flux);
    99
     10  bool status;
     11
    1012  psVector *radius = source->extpars->profile->radius;
    1113  psVector *weight = source->extpars->profile->weight;
     
    1416  // XXX how do I define the radii?  we can put a vector in the recipe...
    1517  // radialBins defines the bounds or start and stop (we can skip some that way...
    16   psVector *radialBinsLower = psMetadataLookupVector (&status, recipe, RADIAL_ANNULAR_BINS_LOWER);
    17   psVector *radialBinsUpper = psMetadataLookupVector (&status, recipe, RADIAL_ANNULAR_BINS_UPPER);
     18  psVector *radialBinsLower = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER");
     19  psVector *radialBinsUpper = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER");
    1820  assert (radialBinsLower->n == radialBinsUpper->n);
    1921
  • branches/eam_branch_20071023/psphot/src/psphotIsophotal.c

    r15359 r15400  
    77  assert (source->extpars->profile->radius);
    88  assert (source->extpars->profile->flux);
     9
     10  bool status;
    911
    1012  psVector *radius = source->extpars->profile->radius;
     
    1921  // XXX do I need to worry about crazy outliers? 
    2022  // XXX should i be smoothing or fitting the curve?
    21   firstBelow = -1;
    22   lastAbove = -1;
     23  int firstBelow = -1;
     24  int lastAbove = -1;
    2325  for (int i = 0; i < flux->n; i++) {
    2426    if (flux->data.F32[i] > ISOPHOT_FLUX) lastAbove = i;
     
    3133  for (int i = 0; i <= PS_MAX(firstBelow, lastAbove); i++) {
    3234    if (i <= firstBelow) {
    33       isophotFluxFirst += flux->data.F32[i];
     35      isophotalFluxFirst += flux->data.F32[i];
    3436    }
    3537    if (i <= lastAbove) {
    36       isophotFluxLast += flux->data.F32[i];
     38      isophotalFluxLast += flux->data.F32[i];
    3739    }
    3840  }
    39   float isophotalFlux    = 0.5*(isophotFluxLast + isophotFluxFirst);
    40   float isophotalFluxErr = 0.5*fabs(isophotFluxLast - isophotFluxFirst);
     41  float isophotalFlux    = 0.5*(isophotalFluxLast + isophotalFluxFirst);
     42  float isophotalFluxErr = 0.5*fabs(isophotalFluxLast - isophotalFluxFirst);
    4143
    4244  float isophotalRad     = 0.5*(radius->data.F32[firstBelow] + radius->data.F32[lastAbove]);
     
    5759
    5860}
    59 
    60 # if (0)
    61   // XXX cache the tmpScalar
    62   psScalar fluxScalar;
    63   fluxScalar.type.type = PS_TYPE_F32;
    64   fluxScalar.data.F32  = ISOPHOT_FLUX;
    65 
    66   // radius and flux must be sorted by radius
    67 
    68   // XXX in general, flux decreases monotonically with radius.  however, since exceptions are
    69   // possible we need to do something to smooth or otherwise handle the flux variations
    70  
    71   // get the index of the flux-sorted vector
    72   psVector *fluxIndex = psVectorSortIndex (flux);
    73 
    74   // XXX need to write psVectorIndexBinaryDisect, which operates on a
    75 
    76   // use disection to get in the right vicinity
    77   binS = psVectorIndexBinaryDisect (&result, flux, fluxIndex, fluxScalar, PS_BISECT_FIRST);
    78   binE = psVectorIndexBinaryDisect (&result, flux, fluxIndex, fluxScalar, PS_BISECT_LAST);
    79 
    80   // find the min and max radius bins in this range
    81 
    82   // XXX do something to choose a more accurate radial bin
    83 
    84 # endif
  • branches/eam_branch_20071023/psphot/src/psphotMakeResiduals.c

    r15359 r15400  
    2828
    2929    float nSigma = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.NSIGMA");
     30    PS_ASSERT (status, false);
     31
     32    float pixelSN = psMetadataLookupF32(&status, recipe, "PSF.RESIDUALS.PIX.SN");
    3033    PS_ASSERT (status, false);
    3134
     
    195198                //resid->weight->data.F32[oy][ox] = fluxStats->sampleStdev;
    196199
    197                 // if value < NRESID_SIGMA*sigma, mask pixel in resid map
    198                 if (resid->Ro->data.F32[oy][ox] < NRESID_SIGMA*fluxStats->sampleStdev) {
    199                   resid->mask->data.U8[oy][ox] = RESID_SIG_MASK;
     200                if (resid->Ro->data.F32[oy][ox] < pixelSN*fluxStats->sampleStdev) {
     201                  resid->mask->data.U8[oy][ox] = 1;
    200202                }
    201203
     
    234236                resid->Ry->data.F32[oy][ox] = B->data.F64[2];
    235237
    236                 dRo = sqrt(A->data.F32[0][0]);
    237                 if (resid->Ro->data.F32[oy][ox] < NRESID_SIGMA*dRo) {
    238                   resid->mask->data.U8[oy][ox] = RESID_SIG_MASK;
     238                float dRo = sqrt(A->data.F32[0][0]);
     239                if (resid->Ro->data.F32[oy][ox] < pixelSN*dRo) {
     240                  resid->mask->data.U8[oy][ox] = 1;
    239241                }
    240242                //resid->weight->data.F32[oy][ox] = XXX;
  • branches/eam_branch_20071023/psphot/src/psphotPetrosian.c

    r15359 r15400  
    22
    33bool psphotPetrosian (pmSource *source, psMetadata *recipe, psMaskType maskVal) {
     4
     5  bool status;
    46
    57  assert (source->extpars);
     
    1719
    1820  // first find flux at R0
    19   firstBelow = -1;
    20   lastAbove = -1;
     21  int firstBelow = -1;
     22  int lastAbove = -1;
    2123  for (int i = 0; i < radius->n; i++) {
    2224    if (radius->data.F32[i] > PETROSIAN_R0) lastAbove = i;
     
    2527
    2628  // average flux in this range
    27   fluxR0 = 0.0;
    28   fluxRn = 0;
     29  float fluxR0 = 0.0;
     30  int fluxRn = 0;
    2931  for (int i = PS_MIN(firstBelow, lastAbove); i <= PS_MAX(firstBelow, lastAbove); i++) {
    3032    fluxR0 += flux->data.F32[i];
    3133    fluxRn ++;
    3234  }
    33   fluxR0 = fluxR0 / (float)(fluxRn);
     35  fluxR0 /= (float)(fluxRn);
    3436 
    3537  // target flux for petrosian radius
    36   fluxRP = fluxR0 * PETROSIAN_RF;
     38  float fluxRP = fluxR0 * PETROSIAN_RF;
    3739
    3840  // find the first bin below the flux level and the last above the level
     
    5860    }
    5961  }
    60   float flux    = 0.5*(fluxLast + fluxFirst);
    61   float fluxErr = 0.5*fabs(fluxLast - fluxFirst);
     62  float fluxRPSum    = 0.5*(fluxLast + fluxFirst);
     63  float fluxRPSumErr = 0.5*fabs(fluxLast - fluxFirst);
    6264  // XXX need to use the weight appropriately here...
    6365
     
    7072 
    7173  // these are uncalibrated: instrumental mags and pixel units
    72   source->extpars->petrosian->mag    = -2.5*log10(flux);
    73   source->extpars->petrosian->magErr = fluxErr / flux;
     74  source->extpars->petrosian->mag    = -2.5*log10(fluxRPSum);
     75  source->extpars->petrosian->magErr = fluxRPSumErr / fluxRPSum;
    7476
    7577  source->extpars->petrosian->rad    = rad;
  • branches/eam_branch_20071023/psphot/src/psphotRadialProfile.c

    r15357 r15400  
    55    // allocate pmSourceExtendedParameters, if not already defined
    66    if (!source->extpars) {
    7         source->extpars = pmSourceExtendedParametersAlloc ();
     7        source->extpars = pmSourceExtendedParsAlloc ();
    88    }
    99
    1010    if (!source->extpars->profile) {
    11         source->extpars->profile = pmSourceRadialProfile ();
     11        source->extpars->profile = pmSourceRadialProfileAlloc ();
    1212    }   
    1313   
     
    1919    psVector *radius = source->extpars->profile->radius;
    2020    psVector *flux   = source->extpars->profile->flux;
    21     psVector *weight = source->extpars->profile->radius;
     21    psVector *weight = source->extpars->profile->weight;
    2222
    2323    // XXX use the extended source model here for Xo, Yo?
     
    4040    flux->n = n;
    4141
    42     SortVectorsByRadius (radius, flux, weight);
     42    // XXX need to sort here
     43    // SortVectorsByRadius (radius, flux, weight);
    4344
    4445    return true;
Note: See TracChangeset for help on using the changeset viewer.