User Tools

Site Tools


ufit:help:tips

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ufit:help:tips [2017/10/23 10:00] – created pcermakufit:help:tips [2017/10/24 07:28] (current) – [Fit curve from the file] pcermak
Line 1: Line 1:
 ====== GUI Tips & Tricks ====== ====== GUI Tips & Tricks ======
-{{ :ufit:bulb.svg?nolink&180}}+{{ :ufit:tips.svg?nolink&180}}
  
-  * Use of complex fitting functions +===== Change of all scan names ===== 
-  * Select between several backends  + 
-    * lmfit - uses the [[http://cars9.uchicago.edu/software/python/lmfit/|lmfit]] package written by Matthew Newville+Open iPython console and write commands. 
-    * minuit - uses the [[http://pythonhosted.org/ufit/pyminuit|MINUIT]] package from CERN+ 
-    * scipy.optimize - uses the scipy.optimize.leastsq function without any further wrapping +To see temperature in legend of charts: 
-  * Easy plotting by matplotlib  + 
-    * 1D plots of scans, automatic determination of axes +    for aa in D: 
-    * 2D color maps of several datasets +         if hasattr(aa, 'data'): 
-  * Fast merging and binning of the data +             aa.data.oldname=aa.data.name 
-  Fast extraction of fitted values + creation of datasets from fitted values +             aa.data.name=aa.data.environment[0] 
-  Automatic determination of file format +              
-  Fit more datasets together (not implemented in GUI)+ 
 +To put some parameter to all scan titles (in this example it is parameter gamma): 
 + 
 +    for aa in D: 
 +         if hasattr(aa, 'data'): 
 +             aa.data.oldtitle=aa.data.meta.title 
 +             aa.data.meta.title += ', stt=%0.2f' % aa.data.meta.gamma 
 + 
 +===== Fit curve from the file ===== 
 + 
 +It is possible to have a spectrum/background stored as a xy points in ASCII datafile. This command will load that file, interpolate between the loaded values and then fit the scale of such model. Just add this line to the **Model definition**: 
 +      
 +     Custom('MyBg', 'scale', "(lambda data: scipy.interpolate.interp1d(data[0], data[1], kind='cubic')(x) scale)(numpy.loadtxt('C:\bg.txt').T)"
 + 
 +Replace **C:\bg.txt** with path to your ASCII file. **MyBg** can be also changed - this is just name of your model.
ufit/help/tips.1508752832.txt.gz · Last modified: 2017/10/23 10:00 by pcermak