Changeset 2047 for trunk/src/STFitter.cpp
- Timestamp:
- 03/15/11 18:31:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STFitter.cpp
r1932 r2047 39 39 #include <scimath/Functionals/Gaussian1D.h> 40 40 #include "Lorentzian1D.h" 41 #include <scimath/Functionals/Sinusoid1D.h> 41 42 #include <scimath/Functionals/Polynomial.h> 42 43 #include <scimath/Mathematics/AutoDiff.h> … … 149 150 funccomponents_.push_back(3); 150 151 } 151 } else if (expr == "poly") {152 funcs_.resize(1);153 funcnames_.clear();154 funccomponents_.clear();155 funcs_[0] = new Polynomial<Float>(ncomp);156 funcnames_.push_back(expr);157 funccomponents_.push_back(ncomp);158 152 } else if (expr == "lorentz") { 159 153 if (ncomp < 1) throw (AipsError("Need at least one lorentzian to fit.")); … … 166 160 funccomponents_.push_back(3); 167 161 } 162 } else if (expr == "sinusoid") { 163 if (ncomp < 1) throw (AipsError("Need at least one sinusoid to fit.")); 164 funcs_.resize(ncomp); 165 funcnames_.clear(); 166 funccomponents_.clear(); 167 for (Int k=0; k<ncomp; ++k) { 168 funcs_[k] = new Sinusoid1D<Float>(); 169 funcnames_.push_back(expr); 170 funccomponents_.push_back(3); 171 } 172 } else if (expr == "poly") { 173 funcs_.resize(1); 174 funcnames_.clear(); 175 funccomponents_.clear(); 176 funcs_[0] = new Polynomial<Float>(ncomp); 177 funcnames_.push_back(expr); 178 funccomponents_.push_back(ncomp); 168 179 } else { 169 //cerr << " compiled functions not yet implemented" << endl;170 180 LogIO os( LogOrigin( "Fitter", "setExpression()", WHERE ) ) ; 171 181 os << LogIO::WARN << " compiled functions not yet implemented" << LogIO::POST; … … 244 254 } 245 255 } 256 } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) { 257 uInt count = 0; 258 for (uInt j=0; j < funcs_.nelements(); ++j) { 259 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) { 260 (funcs_[j]->parameters())[i] = tmppar[count]; 261 parameters_[count] = tmppar[count]; 262 ++count; 263 } 264 } 265 } else if (dynamic_cast<Sinusoid1D<Float>* >(funcs_[0]) != 0) { 266 uInt count = 0; 267 for (uInt j=0; j < funcs_.nelements(); ++j) { 268 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) { 269 (funcs_[j]->parameters())[i] = tmppar[count]; 270 parameters_[count] = tmppar[count]; 271 ++count; 272 } 273 } 246 274 } else if (dynamic_cast<Polynomial<Float>* >(funcs_[0]) != 0) { 247 275 for (uInt i=0; i < funcs_[0]->nparameters(); ++i) { 248 276 parameters_[i] = tmppar[i]; 249 277 (funcs_[0]->parameters())[i] = tmppar[i]; 250 }251 } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) {252 uInt count = 0;253 for (uInt j=0; j < funcs_.nelements(); ++j) {254 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) {255 (funcs_[j]->parameters())[i] = tmppar[count];256 parameters_[count] = tmppar[count];257 ++count;258 }259 278 } 260 279 } … … 286 305 } 287 306 } 307 } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) { 308 uInt count = 0; 309 for (uInt j=0; j < funcs_.nelements(); ++j) { 310 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) { 311 funcs_[j]->mask(i) = !fixed[count]; 312 fixedpar_[count] = fixed[count]; 313 ++count; 314 } 315 } 316 } else if (dynamic_cast<Sinusoid1D<Float>* >(funcs_[0]) != 0) { 317 uInt count = 0; 318 for (uInt j=0; j < funcs_.nelements(); ++j) { 319 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) { 320 funcs_[j]->mask(i) = !fixed[count]; 321 fixedpar_[count] = fixed[count]; 322 ++count; 323 } 324 } 288 325 } else if (dynamic_cast<Polynomial<Float>* >(funcs_[0]) != 0) { 289 326 for (uInt i=0; i < funcs_[0]->nparameters(); ++i) { 290 327 fixedpar_[i] = fixed[i]; 291 328 funcs_[0]->mask(i) = !fixed[i]; 292 }293 } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) {294 uInt count = 0;295 for (uInt j=0; j < funcs_.nelements(); ++j) {296 for (uInt i=0; i < funcs_[j]->nparameters(); ++i) {297 funcs_[j]->mask(i) = !fixed[count];298 fixedpar_[count] = fixed[count];299 ++count;300 }301 329 } 302 330 }
Note: See TracChangeset
for help on using the changeset viewer.