Ignore:
Timestamp:
09/01/06 13:14:11 (18 years ago)
Author:
mar637
Message:

Merge from Release2.1.0b tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapfitter.py

    r1217 r1232  
    100100
    101101        self.fitter.setexpression(self.fitfunc,n)
     102        self.fitted = False
    102103        return
    103104
     
    142143                self.fitter.estimate()
    143144        try:
     145            fxdpar = list(self.fitter.getfixedparameters())
     146            if len(fxdpar) and fxdpar.count(0) == 0:
     147                 raise RuntimeError,"No point fitting, if all parameters are fixed."
    144148            converged = self.fitter.fit()
    145149            if not converged:
     
    155159        return
    156160
    157     def store_fit(self):
    158         """
    159         Store the fit parameters in the scantable.
     161    def store_fit(self, filename=None):
     162        """
     163        Save the fit parameters.
     164        Parameters:
     165            filename:    if specified save as an ASCII file, if None (default)
     166                         store it in the scnatable
    160167        """
    161168        if self.fitted and self.data is not None:
     
    169176            fit.setcomponents(self.components)
    170177            fit.setframeinfo(self.data._getcoordinfo())
    171             self.data._addfit(fit,self._fittedrow)
     178            if filename is not None:
     179                import os
     180                filename = os.path.expandvars(os.path.expanduser(filename))
     181                if os.path.exists(filename):
     182                    raise IOError("File '%s' exists." % filename)
     183                fit.save(filename)
     184            else:
     185                self.data._addfit(fit,self._fittedrow)
    172186
    173187    #def set_parameters(self, params, fixed=None, component=None):
     
    224238        Set the Parameters of a 'Gaussian' component, set with set_function.
    225239        Parameters:
    226             peak, centre, fhwm:  The gaussian parameters
     240            peak, centre, fwhm:  The gaussian parameters
    227241            peakfixed,
    228242            centerfixed,
     
    352366            for i in range(len(pars)):
    353367                fix = ""
    354                 if fixed[i]: fix = "(fixed)"
     368                if len(fixed) and fixed[i]: fix = "(fixed)"
    355369                if errors :
    356370                    out += '  p%d%s= %3.6f (%1.6f),' % (c,fix,pars[i], errors[i])
Note: See TracChangeset for help on using the changeset viewer.