looping to export data

121 views
Skip to first unread message

kingsley

unread,
Oct 27, 2009, 1:21:35 AM10/27/09
to fityk-users
I am using version 0.8.6 on linux to perform fits of multiple skewed
gaussian populations to my data.
I would like to export the mode values for each of the fitted
populations, up to about 6 in each dataset.
I can find the mode of individual fit populations using extremum
(%f,xmin,xmax), which is good.
But I cannot find how to loop over all the fitted populations in a
dataset and find and export each mode value. The function names may
not be sequential due to incorrect guesses about the component
populations before a final fit is accepted. And there may be a mixture
of population functions with differeing numbers of variables in each.

an attempt with:
info extremum(@0.F,100,820) gives: Error: extremum(F,...) is not
implemented. Does anyone need it?
(there were 4 skewgauss functions in this fit, _1, _2 _5 and _6 )

I was hoping this might have cycled through all the functions in
dataset @0. Am I confused - or is this not possible?

It is a very impressive fitting program and I would like to use it
instead of scidavis!

Jackson Read

unread,
Oct 27, 2009, 8:00:42 AM10/27/09
to fityk...@googlegroups.com
I don't know how to do it in fityk. However I did something similar in
my application(I think)...I needed to access the individual distro fncs
in my app to calculate the amount of sample each peak fnc corresponded
to. I did this by exporting the fityk script containing the distro fncs
and parsing it in my main app. The script generated by fityk is very
easy to parse and I created a simple c++ class for doing this...It would
be even easier to do it in a modern language like python

Marcin Wojdyr

unread,
Oct 27, 2009, 6:11:23 PM10/27/09
to fityk...@googlegroups.com
On Tue, Oct 27, 2009 at 06:21, kingsley <king...@burlinson.id.au> wrote:
>
> I am using version 0.8.6 on linux to perform fits of multiple skewed
> gaussian populations to my data.
> I would like to export the mode values for each of the fitted
> populations, up to about 6 in each dataset.
> I can find the mode of individual fit populations using extremum
> (%f,xmin,xmax), which is good.
> But I cannot find how to loop over all the fitted populations in a
> dataset and find and export each mode value. The function names may
> not be sequential due to incorrect guesses about the component
> populations before a final fit is accepted. And there may be a mixture
> of population functions with differeing numbers of variables in each.

There are no loops in fityk mini-language and it's not in plans.
I'm not sure what do you want to do manually and what you want to automate.
If you don't need GUI at all, you may use fityk module in Python language.
If you need GUI and just want to simplify export, you can write a script:
i extremum(%_1,100,820) >> file
i extremum(%_2,100,820) >> file
...
and ignore the "undefined function" errors.

If it's possible to calculate the mode from function parameters, you
can export peak parameters and then do the calculations.

Finally, some time ago I added a way to call external commands. If you
have Python installed, you can try such a script:

info F > f.info
!python -c 'for i in file("f.info").read().split()[1:]: print "info
extremum(%s, 100,820)" % i' >cmd.fit
commands < cmd.fit

I think I like the last option, although I should make it a bit simpler.

>
> an attempt with:
>   info extremum(@0.F,100,820)   gives:  Error: extremum(F,...) is not
> implemented. Does anyone need it?

This would give an extremum of the sum of all functions (but is not
implemented).

> It is a very impressive fitting program and I would like to use it
> instead of scidavis!

You are welcome.

Marcin

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr/

Marcin Wojdyr

unread,
Oct 29, 2009, 7:46:29 PM10/29/09
to fityk...@googlegroups.com
On Tue, Oct 27, 2009 at 23:11, Marcin Wojdyr <woj...@gmail.com> wrote:
>
> Finally, some time ago I added a way to call external commands. If you
> have Python installed, you can try such a script:
>
> info F > f.info
> !python -c 'for i in file("f.info").read().split()[1:]: print "info
> extremum(%s, 100,820)" % i' >cmd.fit
> commands < cmd.fit

I added syntax "commands !" to the program and now the two lines:

!python ... >cmd.fit
commands <cmd.fit

can be written as one:

commands ! python ...

or shorter as: c ! ...

M

Reply all
Reply to author
Forward
0 new messages