User Tools

Site Tools


ufit:help:tips

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
ufit:help:tips [2017/10/23 10:12] pcermakufit:help:tips [2017/10/23 10:15] pcermak
Line 21: Line 21:
              aa.data.meta.title += ', stt=%0.2f' % aa.data.meta.gamma              aa.data.meta.title += ', stt=%0.2f' % aa.data.meta.gamma
  
-===== Fit background from the file =====+===== 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**: 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', "scipy.interpolate.interp1d(numpy.loadtxt('I:\Documents\Playground\sinus.txt').T[0], numpy.loadtxt('I:\Documents\Playground\sinus.txt').T[1], kind='cubic')(x) * scale")+     Custom('MyBackground', 'scale', "scipy.interpolate.interp1d(numpy.loadtxt('C:\bg.txt').T[0], numpy.loadtxt('C:\bg.txt').T[1], kind='cubic')(x) * scale") 
 + 
 +Replace **both** 'C:\bg.txt' with path to your ASCII file. 
ufit/help/tips.txt · Last modified: 2017/10/24 07:28 by pcermak