IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 28, 2009, 2:51:53 PM (17 years ago)
Author:
Paul Price
Message:

Convering 'weight' to 'variance' where appropriate. Mostly just propagating changes from psModules.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090128/psphot/src/psphotOutput.c

    r21183 r21213  
    1818
    1919pmReadout *psphotSelectBackgroundStdev (pmConfig *config,
    20                                         const pmFPAview *view) {
     20                                        const pmFPAview *view) {
    2121
    2222    bool status;
     
    7777                continue;
    7878            }
    79             // skip zero-weight points
    80             if (source->weight->data.F32[i][j] == 0) {
     79            // skip zero-variance points
     80            if (source->variance->data.F32[i][j] == 0) {
    8181                continue;
    8282            }
     
    8686                     (i + source->pixels->row0),
    8787                     source->pixels->data.F32[i][j],
    88                      1.0 / source->weight->data.F32[i][j],
     88                     1.0 / source->variance->data.F32[i][j],
    8989                     source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j]);
    9090        }
     
    124124        if (model == NULL)
    125125            continue;
    126         if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
    127             nEXT ++;
    128         }
    129         if (source->mode & PM_SOURCE_MODE_CR_LIMIT) {
    130             nCR ++;
    131         }
     126        if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {
     127            nEXT ++;
     128        }
     129        if (source->mode & PM_SOURCE_MODE_CR_LIMIT) {
     130            nCR ++;
     131        }
    132132        nSrc ++;
    133133    }
     
    242242
    243243    for (int i = 0; i < try->sources->n; i++) {
    244         // masked for: bad model fit, outlier in parameters
    245         if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL)
    246             continue;
    247 
    248         pmSource *source = try->sources->data[i];
    249         float x = source->modelPSF->params->data.F32[PM_PAR_XPOS];
    250         float y = source->modelPSF->params->data.F32[PM_PAR_YPOS];
    251 
    252         // set the mask and subtract the PSF model
    253         // XXX should we be using maskObj? should we be unsetting the mask?
    254         // use pmModelSub because modelFlux has not been generated
    255         assert (source->maskObj);
    256         psImageKeepCircle (source->maskObj, x, y, radius, "OR", markVal);
    257         pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal);
    258         psImageKeepCircle (source->maskObj, x, y, radius, "AND", PS_NOT_IMAGE_MASK(markVal));
     244        // masked for: bad model fit, outlier in parameters
     245        if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL)
     246            continue;
     247
     248        pmSource *source = try->sources->data[i];
     249        float x = source->modelPSF->params->data.F32[PM_PAR_XPOS];
     250        float y = source->modelPSF->params->data.F32[PM_PAR_YPOS];
     251
     252        // set the mask and subtract the PSF model
     253        // XXX should we be using maskObj? should we be unsetting the mask?
     254        // use pmModelSub because modelFlux has not been generated
     255        assert (source->maskObj);
     256        psImageKeepCircle (source->maskObj, x, y, radius, "OR", markVal);
     257        pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal);
     258        psImageKeepCircle (source->maskObj, x, y, radius, "AND", PS_NOT_IMAGE_MASK(markVal));
    259259    }
    260260
    261261    FILE *f = fopen ("shapes.dat", "w");
    262262    for (int i = 0; i < try->sources->n; i++) {
    263         psF32 inPar[10];  // must be psF32 to pmPSF_FitToModel
    264 
    265         // masked for: bad model fit, outlier in parameters
    266         if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue;
    267 
    268         pmSource *source = try->sources->data[i];
    269         psF32 *outPar = source->modelEXT->params->data.F32;
    270 
    271         psEllipseShape shape;
    272 
    273         shape.sx  = outPar[PM_PAR_SXX] / M_SQRT2;
    274         shape.sy  = outPar[PM_PAR_SYY] / M_SQRT2;
    275         shape.sxy = outPar[PM_PAR_SXY];
    276 
    277         psEllipsePol pol = pmPSF_ModelToFit (outPar);
    278         inPar[PM_PAR_E0] = pol.e0;
    279         inPar[PM_PAR_E1] = pol.e1;
    280         inPar[PM_PAR_E2] = pol.e2;
    281         pmPSF_FitToModel (inPar, 0.1);
    282 
    283         psEllipseAxes axes1 = psEllipseShapeToAxes (shape, 20.0);
    284         psEllipseAxes axes2 = psEllipsePolToAxes(pol, 0.1);
    285 
    286         psEllipsePol pol2 = psEllipseAxesToPol (axes1);
    287 
    288         fprintf (f, "%3d  %7.2f %7.2f  %7.4f %7.4f %7.4f  --  %7.4f %7.4f %7.4f  :  %7.4f %7.4f %7.4f  --  %7.4f %7.4f %7.4f : %7.4f %7.4f %6.1f : %7.4f %7.4f %6.1f\n",
    289                 i, outPar[PM_PAR_XPOS], outPar[PM_PAR_YPOS],
    290                 outPar[PM_PAR_SXX], outPar[PM_PAR_SXY], outPar[PM_PAR_SYY],
    291                 pol.e0, pol.e1, pol.e2,
    292                 pol2.e0, pol2.e1, pol2.e2,
    293                 inPar[PM_PAR_SXX], inPar[PM_PAR_SXY], inPar[PM_PAR_SYY],
    294                 axes1.major, axes1.minor, axes1.theta*PM_DEG_RAD,
    295                 axes2.major, axes2.minor, axes2.theta*PM_DEG_RAD
    296             );
     263        psF32 inPar[10];  // must be psF32 to pmPSF_FitToModel
     264
     265        // masked for: bad model fit, outlier in parameters
     266        if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue;
     267
     268        pmSource *source = try->sources->data[i];
     269        psF32 *outPar = source->modelEXT->params->data.F32;
     270
     271        psEllipseShape shape;
     272
     273        shape.sx  = outPar[PM_PAR_SXX] / M_SQRT2;
     274        shape.sy  = outPar[PM_PAR_SYY] / M_SQRT2;
     275        shape.sxy = outPar[PM_PAR_SXY];
     276
     277        psEllipsePol pol = pmPSF_ModelToFit (outPar);
     278        inPar[PM_PAR_E0] = pol.e0;
     279        inPar[PM_PAR_E1] = pol.e1;
     280        inPar[PM_PAR_E2] = pol.e2;
     281        pmPSF_FitToModel (inPar, 0.1);
     282
     283        psEllipseAxes axes1 = psEllipseShapeToAxes (shape, 20.0);
     284        psEllipseAxes axes2 = psEllipsePolToAxes(pol, 0.1);
     285
     286        psEllipsePol pol2 = psEllipseAxesToPol (axes1);
     287
     288        fprintf (f, "%3d  %7.2f %7.2f  %7.4f %7.4f %7.4f  --  %7.4f %7.4f %7.4f  :  %7.4f %7.4f %7.4f  --  %7.4f %7.4f %7.4f : %7.4f %7.4f %6.1f : %7.4f %7.4f %6.1f\n",
     289                i, outPar[PM_PAR_XPOS], outPar[PM_PAR_YPOS],
     290                outPar[PM_PAR_SXX], outPar[PM_PAR_SXY], outPar[PM_PAR_SYY],
     291                pol.e0, pol.e1, pol.e2,
     292                pol2.e0, pol2.e1, pol2.e2,
     293                inPar[PM_PAR_SXX], inPar[PM_PAR_SXY], inPar[PM_PAR_SYY],
     294                axes1.major, axes1.minor, axes1.theta*PM_DEG_RAD,
     295                axes2.major, axes2.minor, axes2.theta*PM_DEG_RAD
     296            );
    297297    }
    298298    fclose (f);
Note: See TracChangeset for help on using the changeset viewer.