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
ufit:help:tips [2017/10/23 10:15] pcermakufit:help:tips [2017/10/24 07:28] (current) – [Fit curve from the file] pcermak
Line 25: Line 25:
 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('MyBackground', 'scale', "scipy.interpolate.interp1d(numpy.loadtxt('C:\bg.txt').T[0], numpy.loadtxt('C:\bg.txt').T[1], kind='cubic')(x) * scale") +     Custom('MyBg', 'scale', "(lambda data: scipy.interpolate.interp1d(data[0], data[1], kind='cubic')(x) * scale)(numpy.loadtxt('C:\bg.txt').T)")
- +
-Replace **both** 'C:\bg.txt' with path to your ASCII file.+
  
 +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.txt · Last modified: 2017/10/24 07:28 by pcermak