IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 8, 2008, 8:36:06 AM (18 years ago)
Author:
eugene
Message:

merging from eam_branch_20080324 : psphot work on extended source fitting and related I/O functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotIsophotal.c

    r15562 r17396  
    1 # include "psphot.h"
     1# include "psphotInternal.h"
     2
     3static float ISOPHOT_FLUX = NAN;
    24
    35bool psphotIsophotal (pmSource *source, psMetadata *recipe, psMaskType maskVal) {
     
    1416
    1517  // flux at which to measure isophotal parameters
    16   // XXX cache this?
    17   float ISOPHOT_FLUX = psMetadataLookupF32 (&status, recipe, "ISOPHOTAL_FLUX");
     18  if (!isfinite(ISOPHOT_FLUX)) {
     19    // XXX ISOPHOTAL_FLUX should be specified in mags, need the zero point to get counts/sec
     20    ISOPHOT_FLUX = psMetadataLookupF32 (&status, recipe, "ISOPHOTAL_FLUX");
     21    assert (status);
     22  }
    1823
    1924  // find the first bin below the flux level and the last above the level
    20   // XXX can this be done faster with disection?
     25  // XXX can this be done faster with bisection?
    2126  // XXX do I need to worry about crazy outliers? 
    2227  // XXX should i be smoothing or fitting the curve?
     
    2732    if ((firstBelow < 0) && (flux->data.F32[i] < ISOPHOT_FLUX)) firstBelow = i;
    2833  }
    29 
     34  // if we don't go out far enough, we have a problem...
     35  if (lastAbove == flux->n - 1) {
     36    psTrace ("psphot", 5, "did not go out far enough to reach isophotal magnitude");
     37    // XXX raise a flag ?
     38    return false;
     39  }
     40  if (firstBelow < 0) {
     41    psTrace ("psphot", 5, "did not go out far enough to bound isophotal magnitude: error unmeasured");
     42    // XXX raise a flag ?
     43    lastAbove = firstBelow;
     44    return false;
     45  }
     46 
    3047  // need to examine pixels in this vicinity
    3148  float isophotalFluxFirst = 0;
     
    5673  source->extpars->isophot->radErr = isophotalRadErr;
    5774
     75  psTrace ("psphot", 5, "Isophot flux:%f +/- %f @ %f +/- %f for %f, %f\n",
     76           source->extpars->isophot->mag, source->extpars->isophot->magErr,
     77           source->extpars->isophot->rad, source->extpars->isophot->radErr,
     78           source->peak->xf, source->peak->yf);
     79
    5880  return true;
    5981
Note: See TracChangeset for help on using the changeset viewer.