IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10199


Ignore:
Timestamp:
Nov 26, 2006, 12:26:51 PM (19 years ago)
Author:
magnier
Message:

measured delta for unfitted parameters had the wrong sign
fitted parameters are masked out when measuring the parameter
deltas, so is sky (which is not fitted at all).

File:
1 edited

Legend:

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

    r10180 r10199  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-11-24 20:55:48 $
     8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-11-26 22:26:51 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    207207
    208208    // get the Gauss-Newton distance for fixed model parameters
    209     // XXX I need to hold the fitted parameters fixed!
     209    // hold the fitted parameters fixed; mask sky which is not fitted at all
    210210    if (paramMask != NULL) {
    211211        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    212212        psVector *altmask = psVectorAlloc (params->n, PS_TYPE_U8);
    213         for (int i = 0; i < dparams->n; i++) {
    214             if (paramMask->data.U8[i]) {
    215                 altmask->data.U8[i] = 0;
    216             } else {
    217                 altmask->data.U8[i] = 1;
    218             }
     213        altmask->data.U8[0] = 1;
     214        for (int i = 1; i < dparams->n; i++) {
     215            altmask->data.U8[i] = (paramMask->data.U8[i]) ? 0 : 1;
    219216        }
    220217        psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, modelFunc);
     
    222219            if (!paramMask->data.U8[i])
    223220                continue;
    224             dparams->data.F32[i] = delta->data.F64[i];
     221            // note that delta is the value *subtracted* from the parameter
     222            // to get the new guess.  for dparams to represent the direction
     223            // of motion, we need to take -delta
     224            dparams->data.F32[i] = -delta->data.F64[i];
    225225        }
    226226        psFree (delta);
     
    535535    if (constrain->paramMask != NULL) {
    536536        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    537         psMinimizeGaussNewtonDelta(delta, params, NULL, x, y, yErr, pmModelFitSet);
     537        psVector *altmask = psVectorAlloc (params->n, PS_TYPE_U8);
     538        altmask->data.U8[0] = 1;
     539        for (int i = 1; i < dparams->n; i++) {
     540            altmask->data.U8[i] = (constrain->paramMask->data.U8[i]) ? 0 : 1;
     541        }
     542        psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, pmModelFitSet);
    538543        for (int i = 0; i < dparams->n; i++) {
    539544            if (!constrain->paramMask->data.U8[i])
    540545                continue;
    541             dparams->data.F32[i] = delta->data.F64[i];
     546            // note that delta is the value *subtracted* from the parameter
     547            // to get the new guess.  for dparams to represent the direction
     548            // of motion, we need to take -delta
     549            dparams->data.F32[i] = -delta->data.F64[i];
    542550        }
    543551        psFree (delta);
     552        psFree (altmask);
    544553    }
    545554
Note: See TracChangeset for help on using the changeset viewer.