четверг, 21 октября 2010 г.

simple fityk tricks

Finally, I got stuck with experimental data and have some free time.
Ok:) tips I would like to share.

Fityk is great because:
• tool is free and works on different platforms (Windows, Mac OS?, Linux)
• program allows use of user defined models
• fitted models can be saved

Of course I miss features of:
• saving color of lines, size of points for different functions used in the model
• custom formating of the output (i errors)
• using constrains
• changing of visual baseline (in Fityk it is fixed to 0, all shapes are plotted relative to it) to some user defined constant value.
But I still like it. Comparing other free software (Gnuplot) to Fityk, I must say that these programs do different things and are in principle supplementary. Today's simple tricks:
• estimating errors of the fitted model: s=max(y-F(x)). We set values for the standard deviation as a constant value for all points. This value is considered as maximum deviation of experimental points y[n] from the fitted model F(x).
• setting manual constrains, like limiting parameter \$param to positive values. For this we need to create another variable, for instance, \$dummy and set: \$dummy=~{10}; \$param=sqrt(\$dummy^2). This way we define that Fityk may vary the \$dummy variable, and \$param variable depends linearly on it and is always positive. This trick is very useful if you need to avoid undesirable subtraction/addition of different Gaussian or Lorentz peaks (Spectroscopy, X-ray diffraction). Need to mention, that you have to control both widths/heights of the Lorentz/Gauss.
I strongly recommend to read the Fityk's Users Guide for some additional tricks like summing up the datasets, etc. The summation of datasets can be used as datasets subtraction, for instance, to remove calculated background from the X-ray dataset. Let us assume that @0 and @1 contain the observed spectrum and the calculated background. A simple line y=-y in @1; @2= sum_same_x @0+@1; delete @1; delete @0; will give us a spectrum without the background.