def __init__(self,*args,**kargs): """Setup the fitting code.""" super(working,self).__init__(*args,**kargs) inifile=__file__.replace(".py",".ini") tmp=cfg_data_from_ini(inifile,filename=False) self._setas=tmp.setas.clone self.column_headers=tmp.column_headers self.metadata=tmp.metadata self.data=tmp.data self.vcol=self.find_col(self.setas["x"]) self.gcol=self.find_col(self.setas["y"]) self.filename=tmp.filename model,p0=cfg_model_from_ini(inifile,data=self) if python_v3: config=ConfigParser.ConfigParser() else: config=ConfigParser.SafeConfigParser() config.read(inifile) self.config=config #Some config variables we'll need later self.show_plot=config.getboolean('Options', 'show_plot') self.save_fit=config.getboolean('Options', 'save_fit') self.report=config.getboolean('Options', 'print_report') self.fancyresults=config.has_option("Options","fancy_result") and config.getboolean("Options","fancy_result") self.method=config.get('Options','method') self.model=model self.p0=p0
def __init__(self, *args, **kargs): """Setup the fitting code.""" super(working, self).__init__(*args, **kargs) inifile = __file__.replace(".py", ".ini") tmp = cfg_data_from_ini(inifile, filename=False) self._setas = tmp.setas.clone self.column_headers = tmp.column_headers self.metadata = tmp.metadata self.data = tmp.data self.vcol = self.find_col(self.setas["x"]) self.gcol = self.find_col(self.setas["y"]) self.filename = tmp.filename model, p0 = cfg_model_from_ini(inifile, data=self) if python_v3: config = ConfigParser.ConfigParser() else: config = ConfigParser.SafeConfigParser() config.read(inifile) self.config = config #Some config variables we'll need later self.show_plot = config.getboolean('Options', 'show_plot') self.save_fit = config.getboolean('Options', 'save_fit') self.report = config.getboolean('Options', 'print_report') self.fancyresults = config.has_option( "Options", "fancy_result") and config.getboolean( "Options", "fancy_result") self.model = model self.p0 = p0
"""Demo of new Stoner.Analysis.AnalyseFile.lmfit """ from __future__ import print_function from Stoner import __home__ from os.path import join from Stoner.Fit import cfg_data_from_ini, cfg_model_from_ini config = join(__home__, "..", "scripts", "PCAR-chi^2.ini") datafile = join(__home__, "..", "sample-data", "PCAR Co Data.csv") d = cfg_data_from_ini(config, datafile) model, p0 = cfg_model_from_ini(config, data=d) fit = d.lmfit(model, p0=p0, result=True, header="Fit", output="data") fit.plot(multiple="panels", capsize=3) fit.yscale = "log" # Adjust y scale for chi^2 fit.tight_layout()
"""Demo of new Stoner.Analysis.AnalyseFile.lmfit """ from __future__ import print_function from Stoner import __home__, Data from os.path import join from Stoner.Fit import cfg_data_from_ini, cfg_model_from_ini config = join(__home__, "..", "scripts", "PCAR-chi^2.ini") datafile = join(__home__, "..", "sample-data", "PCAR Co Data.csv") d = cfg_data_from_ini(config, datafile) model, p0 = cfg_model_from_ini(config, data=d) fit = d.lmfit(model, p0=p0, result=True, header="Fit", output="data") fit.plot(multiple="panels", capsize=3) fit.yscale = "log" # Adjust y scale for chi^2 fit.tight_layout()