IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 13, 2006, 9:02:53 PM (20 years ago)
Author:
magnier
Message:

change ApTrend to 4D poly, included model->radius correction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_rel9_p0/psModules/src/objects/pmPSFtry.c

    r5958 r5985  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.3.4.1 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-01-10 04:46:03 $
     7 *  @version $Revision: 1.3.4.2 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-01-14 07:02:53 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    192192    //   we use an outlier rejection to avoid this bias
    193193
    194     // rflux = ten(0.4*fitMag);
    195     psVector *rflux = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64);
     194    // r2rflux = radius^2 * ten(0.4*fitMag);
     195    psVector *r2rflux = psVectorAlloc (psfTry->sources->n, PS_TYPE_F64);
    196196    for (int i = 0; i < psfTry->sources->n; i++) {
    197197        if (psfTry->mask->data.U8[i] & PSFTRY_MASK_ALL)
    198198            continue;
    199         rflux->data.F64[i] = pow(10.0, 0.4*psfTry->fitMag->data.F64[i]);
    200     }
    201 
    202     // use 3hi/1lo sigma clipping on the rflux vs metric fit
     199        r2rflux->data.F64[i] = PS_SQR(RADIUS) * pow(10.0, 0.4*psfTry->fitMag->data.F64[i]);
     200    }
     201
     202    // use 3hi/1lo sigma clipping on the r2rflux vs metric fit
    203203    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    204204    stats->min = 1.0;
     
    206206    stats->clipIter = 3;
    207207
    208     // fit ApResid only to rflux, ignore x,y variations for now
    209     // linear clipped fit of ApResid to rflux
     208    // fit ApTrend only to r2rflux, ignore x,y,flux variations for now
     209    // linear clipped fit of ApResid to r2rflux
    210210    psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD);
    211     poly = psVectorClipFitPolynomial1D (poly, stats, psfTry->mask, PSFTRY_MASK_ALL, psfTry->metric, NULL, rflux);
     211    poly = psVectorClipFitPolynomial1D (poly, stats, psfTry->mask, PSFTRY_MASK_ALL, psfTry->metric, NULL, r2rflux);
    212212    psLogMsg ("pmPSFtryMetric", 4, "fit stats: %f +/- %f\n", stats->sampleMedian, stats->sampleStdev);
    213213
    214     psfTry->psf->ApTrend->coeff[0][0][0] = poly->coeff[0];
    215     psfTry->psf->ApTrend->coeff[0][0][1] = 0;
    216 
    217     psfTry->psf->skyBias  = poly->coeff[1] / (M_PI * PS_SQR(RADIUS));
     214    pmPSF_MaskApTrend (psfTry->psf, PM_PSF_SKYBIAS);
     215    psfTry->psf->ApTrend->coeff[0][0][0][0] = poly->coeff[0];
     216    psfTry->psf->ApTrend->coeff[0][0][1][0] = 0;
     217
     218    psfTry->psf->skyBias  = poly->coeff[1];
    218219    psfTry->psf->ApResid  = poly->coeff[0];
    219220    psfTry->psf->dApResid = stats->sampleStdev;
    220221
    221     psFree (rflux);
     222    psFree (r2rflux);
    222223    psFree (poly);
    223224    psFree (stats);
Note: See TracChangeset for help on using the changeset viewer.