Changeset 1221 for tags


Ignore:
Timestamp:
08/31/06 11:10:17 (18 years ago)
Author:
mar637
Message:

Fix for ticket #65, fixed parameter issues. This was a problem with mask=!fixed in the fitter. Also, each fit reset the fixed parameters

Location:
tags/Release2.1.0b
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/Release2.1.0b/python/asapfitter.py

    r1214 r1221  
    136136                out = "Scan[%d] Beam[%d] IF[%d] Pol[%d] Cycle[%d]" % (self.data.getscan(i),self.data.getbeam(i),self.data.getif(i),self.data.getpol(i), self.data.getcycle(i))
    137137                asaplog.push(out,False)
     138        print self.mask
    138139        self.fitter.setdata(self.x, self.y, self.mask)
    139140        if self.fitfunc == 'gauss':
     
    224225        Set the Parameters of a 'Gaussian' component, set with set_function.
    225226        Parameters:
    226             peak, centre, fhwm:  The gaussian parameters
     227            peak, centre, fwhm:  The gaussian parameters
    227228            peakfixed,
    228229            centerfixed,
  • tags/Release2.1.0b/src/STFitter.cpp

    r1067 r1221  
    205205    if (parameters_.nelements() > 0 && tmppar.nelements() != parameters_.nelements())
    206206        throw (AipsError("Number of parameters inconsistent with function."));
    207     if (parameters_.nelements() == 0)
     207    if (parameters_.nelements() == 0) {
    208208        parameters_.resize(tmppar.nelements());
    209         fixedpar_.resize(tmppar.nelements());
    210         fixedpar_ = False;
     209        if (tmppar.nelements() != fixedpar_.nelements()) {
     210          fixedpar_.resize(tmppar.nelements());
     211          fixedpar_ = False;
     212        }
     213    }
    211214    if (dynamic_cast<Gaussian1D<Float>* >(funcs_[0]) != 0) {
    212215        uInt count = 0;
     
    229232bool Fitter::setFixedParameters(std::vector<bool> fixed)
    230233{
    231     Vector<Bool> tmp(fixed);
    232234    if (funcs_.nelements() == 0)
    233235        throw (AipsError("Function not yet set."));
    234     if (fixedpar_.nelements() > 0 && tmp.nelements() != fixedpar_.nelements())
     236    if (fixedpar_.nelements() > 0 && fixed.size() != fixedpar_.nelements())
    235237        throw (AipsError("Number of mask elements inconsistent with function."));
    236238    if (dynamic_cast<Gaussian1D<Float>* >(funcs_[0]) != 0) {
     
    238240        for (uInt j=0; j < funcs_.nelements(); ++j) {
    239241            for (uInt i=0; i < funcs_[j]->nparameters(); ++i) {
    240                 funcs_[j]->mask(i) = !tmp[count];
    241                 fixedpar_[count] = !tmp[count];
     242                funcs_[j]->mask(i) = !fixed[count];
     243                fixedpar_[count] = fixed[count];
    242244                ++count;
    243245            }
     
    245247    } else if (dynamic_cast<Polynomial<Float>* >(funcs_[0]) != 0) {
    246248        for (uInt i=0; i < funcs_[0]->nparameters(); ++i) {
    247             fixedpar_[i] = tmp[i];
    248             funcs_[0]->mask(i) =  tmp[i];
     249            fixedpar_[i] = fixed[i];
     250            funcs_[0]->mask(i) =  !fixed[i];
    249251        }
    250252    }
    251     //fixedpar_ = !tmpmsk;
    252253    return true;
    253254}
     
    312313  residual_ =  y_;
    313314  fitter.residual(residual_,x_);
    314 
    315315  // use fitter.residual(model=True) to get the model
    316316  thefit_.resize(x_.nelements());
Note: See TracChangeset for help on using the changeset viewer.