Changeset 1391 for trunk/src/STFitter.cpp
- Timestamp:
- 07/30/07 11:59:36 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STFitter.cpp
r1232 r1391 329 329 } 330 330 331 bool Fitter::lfit() { 332 LinearFit<Float> fitter; 333 CompoundFunction<Float> func; 334 335 uInt n = funcs_.nelements(); 336 for (uInt i=0; i<n; ++i) { 337 func.addFunction(*funcs_[i]); 338 } 339 340 fitter.setFunction(func); 341 //fitter.setMaxIter(50+n*10); 342 // Convergence criterium 343 //fitter.setCriteria(0.001); 344 345 // Fit 346 Vector<Float> sigma(x_.nelements()); 347 sigma = 1.0; 348 349 parameters_.resize(); 350 parameters_ = fitter.fit(x_, y_, sigma, &m_); 351 std::vector<float> ps; 352 parameters_.tovector(ps); 353 setParameters(ps); 354 355 error_.resize(); 356 error_ = fitter.errors(); 357 358 chisquared_ = fitter.getChi2(); 359 360 residual_.resize(); 361 residual_ = y_; 362 fitter.residual(residual_,x_); 363 // use fitter.residual(model=True) to get the model 364 thefit_.resize(x_.nelements()); 365 fitter.residual(thefit_,x_,True); 366 return true; 367 } 331 368 332 369 std::vector<float> Fitter::evaluate(int whichComp) const
Note: See TracChangeset
for help on using the changeset viewer.