Changeset 10199
- Timestamp:
- Nov 26, 2006, 12:26:51 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSourceFitModel.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSourceFitModel.c
r10180 r10199 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-11-2 4 20:55:48$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-11-26 22:26:51 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 207 207 208 208 // 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 210 210 if (paramMask != NULL) { 211 211 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64); 212 212 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; 219 216 } 220 217 psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, modelFunc); … … 222 219 if (!paramMask->data.U8[i]) 223 220 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]; 225 225 } 226 226 psFree (delta); … … 535 535 if (constrain->paramMask != NULL) { 536 536 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); 538 543 for (int i = 0; i < dparams->n; i++) { 539 544 if (!constrain->paramMask->data.U8[i]) 540 545 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]; 542 550 } 543 551 psFree (delta); 552 psFree (altmask); 544 553 } 545 554
Note:
See TracChangeset
for help on using the changeset viewer.
