IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15699


Ignore:
Timestamp:
Nov 27, 2007, 11:16:45 AM (18 years ago)
Author:
Paul Price
Message:

Initialising chisqNorm.

File:
1 edited

Legend:

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

    r15587 r15699  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-11-11 21:49:18 $
     8 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-11-27 21:16:45 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5757    tmp->type = type;
    5858    tmp->chisq = 0.0;
     59    tmp->chisqNorm = 0.0;
    5960    tmp->nDOF  = 0;
    6061    tmp->nIter = 0;
     
    7677    }
    7778
    78     tmp->modelFunc          = class->modelFunc;
    79     tmp->modelFlux          = class->modelFlux;
    80     tmp->modelRadius        = class->modelRadius;
    81     tmp->modelLimits        = class->modelLimits;
     79    tmp->modelFunc          = class->modelFunc;
     80    tmp->modelFlux          = class->modelFlux;
     81    tmp->modelRadius        = class->modelRadius;
     82    tmp->modelLimits        = class->modelLimits;
    8283    tmp->modelGuess         = class->modelGuess;
    8384    tmp->modelFromPSF       = class->modelFromPSF;
     
    172173                          bool add,
    173174                          psMaskType maskVal,
    174                           int dx,
    175                           int dy
     175                          int dx,
     176                          int dy
    176177    )
    177178{
     
    225226    psImageInterpolateOptions *Ry = NULL;
    226227    if (model->residuals && (mode & (PM_MODEL_OP_RES0 | PM_MODEL_OP_RES1))) {
    227         // if the residual image and object image don't match,
    228         // supply an appropriately overlapped residual image
    229         psImage *inRo = model->residuals->Ro;
    230         psImage *inRx = model->residuals->Rx;
    231         psImage *inRy = model->residuals->Ry;
    232         if ((image->numCols != inRo->numCols) ||
    233             (image->numRows != inRo->numRows)) {
    234             myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    235             myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    236             myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
    237             dx = (int)(inRx->numCols / 2) - (xPos - image->col0);
    238             dy = (int)(inRx->numCols / 2) - (xPos - image->col0);
    239             for (int iy = 0; iy < myRo->numRows; iy++) {
    240                 int jy = iy + dy;
    241                 if ((jy < 0) || (jy >= inRo->numRows)) {
    242                     for (int ix = 0; ix < myRo->numCols; ix++) {
    243                         myRo->data.F32[iy][ix] = 0.0;
    244                         myRx->data.F32[iy][ix] = 0.0;
    245                         myRy->data.F32[iy][ix] = 0.0;
    246                     }
    247                     continue;
    248                 }
    249                 for (int ix = 0; ix < myRo->numCols; ix++) {
    250                     int jx = ix + dx;
    251                     if ((jx < 0) || (jx >= inRo->numCols)) {
    252                         myRo->data.F32[iy][ix] = 0.0;
    253                         myRx->data.F32[iy][ix] = 0.0;
    254                         myRy->data.F32[iy][ix] = 0.0;
    255                     } else {
    256                         myRo->data.F32[iy][ix] = inRo->data.F32[jy][jx];
    257                         myRx->data.F32[iy][ix] = inRx->data.F32[jy][jx];
    258                         myRy->data.F32[iy][ix] = inRy->data.F32[jy][jx];
    259                     }
    260                 }
    261             }           
    262         } else {
    263             myRo = psMemIncrRefCounter (inRo);
    264             myRx = psMemIncrRefCounter (inRx);
    265             myRy = psMemIncrRefCounter (inRy);
    266         }
     228        // if the residual image and object image don't match,
     229        // supply an appropriately overlapped residual image
     230        psImage *inRo = model->residuals->Ro;
     231        psImage *inRx = model->residuals->Rx;
     232        psImage *inRy = model->residuals->Ry;
     233        if ((image->numCols != inRo->numCols) ||
     234            (image->numRows != inRo->numRows)) {
     235            myRo = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
     236            myRx = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
     237            myRy = psImageAlloc (image->numCols, image->numRows, PS_TYPE_F32);
     238            dx = (int)(inRx->numCols / 2) - (xPos - image->col0);
     239            dy = (int)(inRx->numCols / 2) - (xPos - image->col0);
     240            for (int iy = 0; iy < myRo->numRows; iy++) {
     241                int jy = iy + dy;
     242                if ((jy < 0) || (jy >= inRo->numRows)) {
     243                    for (int ix = 0; ix < myRo->numCols; ix++) {
     244                        myRo->data.F32[iy][ix] = 0.0;
     245                        myRx->data.F32[iy][ix] = 0.0;
     246                        myRy->data.F32[iy][ix] = 0.0;
     247                    }
     248                    continue;
     249                }
     250                for (int ix = 0; ix < myRo->numCols; ix++) {
     251                    int jx = ix + dx;
     252                    if ((jx < 0) || (jx >= inRo->numCols)) {
     253                        myRo->data.F32[iy][ix] = 0.0;
     254                        myRx->data.F32[iy][ix] = 0.0;
     255                        myRy->data.F32[iy][ix] = 0.0;
     256                    } else {
     257                        myRo->data.F32[iy][ix] = inRo->data.F32[jy][jx];
     258                        myRx->data.F32[iy][ix] = inRx->data.F32[jy][jx];
     259                        myRy->data.F32[iy][ix] = inRy->data.F32[jy][jx];
     260                    }
     261                }
     262            }
     263        } else {
     264            myRo = psMemIncrRefCounter (inRo);
     265            myRx = psMemIncrRefCounter (inRx);
     266            myRy = psMemIncrRefCounter (inRy);
     267        }
    267268
    268269        Ro = psImageInterpolateOptionsAlloc(PS_INTERPOLATE_BILINEAR, myRo, NULL, mask, 0, 0.0, 0.0, 1, 0, 0.0);
     
    302303                float oy = yBin*(imageRow + 0.5 - yCenter) + yResidCenter;
    303304
    304                 psU8 mflux = 0;
     305                psU8 mflux = 0;
    305306                if (mode & PM_MODEL_OP_RES0) {
    306307                    double Fo = 0.0;
     
    310311                    }
    311312                }
    312                 // skip Rx,Ry if Ro is masked
     313                // skip Rx,Ry if Ro is masked
    313314                if (!mflux && (mode & PM_MODEL_OP_RES1)) {
    314315                    double Fx = 0.0;
     
    379380 *****************************************************************************/
    380381bool pmModelAddWithOffset(psImage *image,
    381                           psImage *mask,
    382                           pmModel *model,
    383                           pmModelOpMode mode,
    384                           psMaskType maskVal,
    385                           int dx,
    386                           int dy)
     382                          psImage *mask,
     383                          pmModel *model,
     384                          pmModelOpMode mode,
     385                          psMaskType maskVal,
     386                          int dx,
     387                          int dy)
    387388{
    388389    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     
    395396 *****************************************************************************/
    396397bool pmModelSubWithOffset(psImage *image,
    397                           psImage *mask,
    398                           pmModel *model,
    399                           pmModelOpMode mode,
    400                           psMaskType maskVal,
    401                           int dx,
    402                           int dy)
     398                          psImage *mask,
     399                          pmModel *model,
     400                          pmModelOpMode mode,
     401                          psMaskType maskVal,
     402                          int dx,
     403                          int dy)
    403404{
    404405    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
Note: See TracChangeset for help on using the changeset viewer.