IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

check in changes from genes development branch : extensive changes to moments calculation, psf model generation, aperture residuals

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmModel.c

    r25738 r25754  
    5656
    5757    tmp->type = type;
    58     tmp->chisq = 0.0;
    59     tmp->chisqNorm = 0.0;
     58    tmp->mag = NAN;
     59    tmp->chisq = NAN;
     60    tmp->chisqNorm = NAN;
    6061    tmp->nDOF  = 0;
    6162    tmp->nPix  = 0;
    6263    tmp->nIter = 0;
    63     tmp->radiusFit = 0;
     64    tmp->fitRadius = 0;
    6465    tmp->flags = PM_MODEL_STATUS_NONE;
    6566    tmp->residuals = NULL;              // XXX should the model own this memory?
     
    109110    new->nIter     = model->nIter;
    110111    new->flags     = model->flags;
    111     new->radiusFit = model->radiusFit;
     112    new->fitRadius = model->fitRadius;
    112113
    113114    for (int i = 0; i < new->params->n; i++) {
     
    190191    psVector *params = model->params;
    191192
    192     psS32 imageCol;
    193     psS32 imageRow;
    194     psF32 pixelValue;
     193    float imageCol;
     194    float imageRow;
     195    float pixelValue;
    195196
    196197    // save original values; restore before returning
     
    233234    psF32 **Rx = NULL;
    234235    psF32 **Ry = NULL;
    235     psImageMaskType **Rm = NULL;
     236    pmResidMaskType **Rm = NULL;
    236237
    237238    if (model->residuals) {
    238         DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;
    239         DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;
    240         Ro = (model->residuals->Ro)   ? model->residuals->Ro->data.F32 : NULL;
    241         Rx = (model->residuals->Rx)   ? model->residuals->Rx->data.F32 : NULL;
    242         Ry = (model->residuals->Ry)   ? model->residuals->Ry->data.F32 : NULL;
    243         Rm = (model->residuals->mask) ? model->residuals->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
    244         if (Ro) {
    245             NX = model->residuals->Ro->numCols;
    246             NY = model->residuals->Ro->numRows;
    247         }
     239        DX = xBin*(image->col0 - xCenter - dx) + model->residuals->xCenter + 0.5;
     240        DY = yBin*(image->row0 - yCenter - dy) + model->residuals->yCenter + 0.5;
     241        Ro = (model->residuals->Ro)   ? model->residuals->Ro->data.F32 : NULL;
     242        Rx = (model->residuals->Rx)   ? model->residuals->Rx->data.F32 : NULL;
     243        Ry = (model->residuals->Ry)   ? model->residuals->Ry->data.F32 : NULL;
     244        Rm = (model->residuals->mask) ? model->residuals->mask->data.PM_TYPE_RESID_MASK_DATA : NULL;
     245        if (Ro) {
     246            NX = model->residuals->Ro->numCols;
     247            NY = model->residuals->Ro->numRows;
     248        }           
    248249    }
    249250
     
    256257                continue;
    257258
    258             // XXX should we use using 0.5 pixel offset?
    259259            // Convert to coordinate in parent image, with offset (dx,dy)
    260             imageCol = ix + image->col0 - dx;
    261             imageRow = iy + image->row0 - dy;
    262 
    263             x->data.F32[0] = (float) imageCol;
    264             x->data.F32[1] = (float) imageRow;
     260            // 0.5 PIX: the model take pixel coordinates so convert the pixel index here
     261            imageCol = ix + 0.5 + image->col0 - dx;
     262            imageRow = iy + 0.5 + image->row0 - dy;
     263
     264            x->data.F32[0] = imageCol;
     265            x->data.F32[1] = imageRow;
    265266
    266267            pixelValue = 0.0;
Note: See TracChangeset for help on using the changeset viewer.