I've been using fityk 0.9.7 in Debian testing, to fit gaussian peaks
(plus lines) to dozens of spectra files.
First of all, is there a way to do for loops in a cfityk script? or
does it have to be done by a bash script externally? I basically want
to process all these spectra "semi-automatically". I couldn't find
anything in the documentation.
I know I can load multiple data sets, but I don't know how to loop over them...
Second question, one I fit my gaussian, I want to extract the fit
parameters (height, center and hwhm) with their errors. The only way I
know is using 'info errors' and then copying each individual number
elsewhere....this is really time consuming... how can I export them to
a file?
I tried doing (as in the documentation):
print all: $_1, $_2, $_3 > fit_data1.tsv
Syntax error: at 27, near `_2, $_3 > ': unexpected token or end of expression
I also tried without the $ signs and got an error saying 'unknown name _1'
Ideally I would like to export something in this format:
fit_par1 (tab, space or comma) error_fit_par1 (tab, space or comma)
fit_par2 (tab,space or comma) error_fit_par2 .....and so on
and then a new line for a different spectrum...
Any help is appreciated!
Thanks
Andres
> First of all, is there a way to do for loops in a cfityk script? or
[...]
> I know I can load multiple data sets, but I don't know how to loop over them...
@*: ... # this makes a loop
see http://fityk.nieto.pl/lang.html
> I tried doing (as in the documentation):
>
> print all: $_1, $_2, $_3 > fit_data1.tsv
> Syntax error: at 27, near `_2, $_3 > ': unexpected token or end of expression
I probably corrected the manual after 0.9.7. You can see it online:
http://fityk.nieto.pl/ref.html#print
> Ideally I would like to export something in this format:
>
> fit_par1 (tab, space or comma) error_fit_par1 (tab, space or comma)
> fit_par2 (tab,space or comma) error_fit_par2 .....and so on
>
> and then a new line for a different spectrum...
It's possible. This should work:
@*: print F[0].height, F[0].height.error, F[0].center, F[0].center.error >> file
Marcin
On Wed, Apr 13, 2011 at 08:29:11AM -0400, Marcin Wojdyr wrote:
> > fit_par1 (tab, space or comma) error_fit_par1 (tab, space or comma)
> > fit_par2 (tab,space or comma) error_fit_par2 .....and so on
> >
> > and then a new line for a different spectrum...
>
> It's possible. This should work:
> @*: print F[0].height, F[0].height.error, F[0].center, F[0].center.error >> file
Would it be possible to do the same, but for all peaks in each dataset (where
each dataset can have a different number of peaks)?
I've tried with "print F[*].area" (for instance), but I get a syntax error
(using 0.9.7).
Is there any other way to reproduce the behaviour of "info+ peaks" from older
versions?
Thanks a lot!
Pablo B.
> Is there any other way to reproduce the behaviour of "info+ peaks" from older
> versions?
info peaks_err
Best,
Marcin
You can do:
=-> @*: i filename, peaks_err
or:
=-> @*: i title, peaks_err
It prints, for each dataset, filename/title before the output from peaks_err.
If it's not what you'd like to get, you can propose a new format for
listing of peak parameters.
Cheers,
Marcin
On Mon, Apr 18, 2011 at 11:05:59AM +0200, Marcin Wojdyr wrote:
> =-> @*: i title, peaks_err
>
> It prints, for each dataset, filename/title before the output from peaks_err.
> If it's not what you'd like to get, you can propose a new format for
> listing of peak parameters.
That works well for me, I can now go back to using the little script I wrote
to extract results from multi-dataset fits.
> Is there a way to print not only the fitted peaks, but the fit information
> and a header line with the filename or a user defined header?
Unfortunately not. Printing has been neglected for a long time.
Adding some text to the graph is definitely a good idea.
> Can I define the default directory for the data files? It defaults to the
> /Applications directory (Mac) and I have to go through many folder levels to
> get to my data directory.
I assumed that this option is rarely used and I removed it some time
ago, to simplify the GUI.
But it's still possible to set the default data directory.
On Mac, open the file ~/Library/Application Support/fityk/wxoptions
(on Linux it is ~/.fityk/wxoptions, on Windows C:\Documents and
Settings\username\Application Data\fityk\wxoptions)
If there is a line starting with "loadDataDir=" modify it, otherwise
add such line, at the beginning of file:
loadDataDir=/path/to/dir
On Mac it should be also possible to open files that have popular
extensions by right clicking on them (open with > fityk)
Marcin
I normally use quick load but I often compare several Y values with
the same X, so the load data file is useful. Perhaps the first line header
could be imported into the dataset to be used for printing and tagging?
(i.e. X-header, Y-header1, Y-header 2, Y-header-3
X-data, Y-data-1, Y-data-2, Y-data-3)
A fit to page printout with the datapoints, fitsum, individual components,
fit parameters (and individual function x,y values), and modifiable
headers would be perfect for archival purposes.
I will try the default directory trick. The open with command would
probably only work for a quick load file. If I have one X and several Y
it would likely only load the first Y.
Best,
Soren
Soren N. Eustis, Ph.D.
ETH Zürich
Environmental Organic Chemistry Group
Institute for Biogeochemistry and Pollutant Dynamics
Universitatstrasse 16
CHN F33
8092 ZürichSWITZERLAND
+41 44 632 93 48 (office)
+41 44 632 14 38 (fax)
>--
>http://groups.google.com/group/fityk-users
> I normally use quick load but I often compare several Y values with
> the same X, so the load data file is useful. Perhaps the first line header
> could be imported into the dataset to be used for printing and tagging?
The problem here is how to detect if the first line contains column
headers or something else. It would be possible to add it as an option
to the open data dialog, but this would make this dialog even more
complicated.
BTW after 1.0.1 I started changing this dialog, to allow opening of
multiple files, blocks and/or columns at the same time. I haven't
finished it yet.
> I will try the default directory trick. The open with command would
> probably only work for a quick load file. If I have one X and several Y
> it would likely only load the first Y.
yes, that's what it does.
Cheers,
Marcin
Just a small note on this:
When trying to output to a file, e.g.
@*: i title, peaks_err > datafile
the file only contains the data from the last dataset. To get all the
data one has to do
@*: i title, peaks_err >> datafile
While this is probably expected behaviour (separate output for each
dataset), it still took me some time to figure out, so I just want to
mention it in case anyone else is wondering.
Cheers,
Christian