Ignore:
Timestamp:
07/29/10 19:13:46 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: No (test merging alma branch)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed:

Test Programs:

Put in Release Notes: No

Module(s):

Description:


Location:
branches/mergetest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/mergetest

  • branches/mergetest/src/STFitter.cpp

    r1391 r1779  
    3232#include <casa/Arrays/ArrayMath.h>
    3333#include <casa/Arrays/ArrayLogical.h>
     34#include <casa/Logging/LogIO.h>
    3435#include <scimath/Fitting.h>
    3536#include <scimath/Fitting/LinearFit.h>
     
    3738#include <scimath/Functionals/CompoundFunction.h>
    3839#include <scimath/Functionals/Gaussian1D.h>
     40#include "Lorentzian1D.h"
    3941#include <scimath/Functionals/Polynomial.h>
    4042#include <scimath/Mathematics/AutoDiff.h>
     
    146148    funcs_.resize(1);
    147149    funcs_[0] = new Polynomial<Float>(ncomp);
     150  } else if (expr == "lorentz") {
     151    if (ncomp < 1) throw (AipsError("Need at least one lorentzian to fit."));
     152    funcs_.resize(ncomp);
     153    for (Int k=0; k<ncomp; ++k) {
     154      funcs_[k] = new Lorentzian1D<Float>();
     155    }
    148156  } else {
    149     cerr << " compiled functions not yet implemented" << endl;
     157    //cerr << " compiled functions not yet implemented" << endl;
     158    LogIO os( LogOrigin( "Fitter", "setExpression()", WHERE ) ) ;
     159    os << LogIO::WARN << " compiled functions not yet implemented" << LogIO::POST;
    150160    //funcs_.resize(1);
    151161    //funcs_[0] = new CompiledFunction<Float>();
     
    227237            (funcs_[0]->parameters())[i] =  tmppar[i];
    228238        }
     239    } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) {
     240        uInt count = 0;
     241        for (uInt j=0; j < funcs_.nelements(); ++j) {
     242            for (uInt i=0; i < funcs_[j]->nparameters(); ++i) {
     243                (funcs_[j]->parameters())[i] = tmppar[count];
     244                parameters_[count] = tmppar[count];
     245                ++count;
     246            }
     247        }
    229248    }
    230249    // reset
     
    260279            funcs_[0]->mask(i) =  !fixed[i];
    261280        }
     281    } else if (dynamic_cast<Lorentzian1D<Float>* >(funcs_[0]) != 0) {
     282      uInt count = 0;
     283        for (uInt j=0; j < funcs_.nelements(); ++j) {
     284            for (uInt i=0; i < funcs_[j]->nparameters(); ++i) {
     285                funcs_[j]->mask(i) = !fixed[count];
     286                fixedpar_[count] = fixed[count];
     287                ++count;
     288            }
     289        }
    262290    }
    263291    return true;
Note: See TracChangeset for help on using the changeset viewer.