[Fityk-users] Multiple Data Sets

466 views
Skip to first unread message

Daniel T. Hallinan Jr.

unread,
Sep 6, 2006, 12:11:05 PM9/6/06
to fityk...@lists.sourceforge.net
Marcin,

Let me preface this by thanking you for this wonderful program. I am using
it to deconvolute FTIR (Fourier Transform InfraRed) spectra. I have become
competent with the basics of the GUI version of Fityk, altough I don't
understand how to use Scripts.

I have read through the mailing list and am trying to do something similar
to Pablo Bianucci. I have spectra that evolve with time. I would like to
automate openning each file, fitting it with the previous data set's fit
parameters, and exporting the peak parameters. This is very easy to do
manually with the GUI version. Is it possible to automate this process
without working with the source code? I have very limited programming
experience (just a little in Fortran and none in C++).

Also, is it possible to set a range that a fit parameter must remain within?
For example, tell the center to stay between 890 and 910.

Finally, can the heights be locked to positive values only?

If these requests are possible using cfityk only, I am willing to go down
that path, but it will require much learning. Either way, thank you very
much. Input from anyone else is much appreciated also.

Sincerely,

Dan Hallinan Jr

c: 610-350-9176
w: 215-895-5828
Drexel University
Chemical & Biological Engineering Department
3141 Chestnut Street
Philadelphia, PA 19104
http://www.pages.drexel.edu/~dth32/
dhall...@hotmail.com

Pablo Bianucci

unread,
Sep 6, 2006, 12:40:44 PM9/6/06
to fityk...@lists.sourceforge.net
Hi Daniel!

On Wed, Sep 06, 2006 at 12:11:05PM -0400, Daniel T. Hallinan Jr. wrote:

> I have read through the mailing list and am trying to do something similar
> to Pablo Bianucci. I have spectra that evolve with time. I would like to
> automate openning each file, fitting it with the previous data set's fit
> parameters, and exporting the peak parameters. This is very easy to do
> manually with the GUI version. Is it possible to automate this process
> without working with the source code? I have very limited programming
> experience (just a little in Fortran and none in C++).

I've got a semi-automated way to do that now (that will work in any
system that can run the bash shell).

*) First, I make sure the data files have a name that will allow them to
be sorted (like, time_001.dat, time_002.dat so that the first frame will be
loaded before the second).

*) Then start Fityk giving it as a command line a wildcard with all the
data files, ie 'fityk time_*.dat'. This will cause Fityk to read all the
data sets (can take a little while for many data sets).

*) In parallel, I use a shell script to create a Fityk script that will do
the fitting. I have two versions, which I am attaching to this email: One
for fitting a single peak and one for fitting multple peaks. They use
slightly different ways of setting the guesses.

*) Then, I tell Fityk to execute the script, and wait.

The scripts should be straightforward to understand, but they don't have
much documentation. Even though they work well enough for me, I can't
guarantee that the scripts will do anything for you. In particular,
they'll behave pretty badly if you have a varying number of peaks from
frame to frame, if there are problems fitting a peak, or if a peak changes
too much from one frame to the next. Also, sometimes it can be better
(especially for the multiple-peak script) to do a first fit by hand and
edit the generated script to not do any guesses.

I hope this is useful!

Bye & Good Luck!

Pablo B.

make_script_multi
make_script_single

Marcin Wojdyr

unread,
Sep 8, 2006, 10:28:12 AM9/8/06
to fityk...@lists.sourceforge.net, Daniel T. Hallinan Jr.

Hello,

For fitting series of data I'm using similar approach as Pablo wrote
(script that generates .fit script).

> Also, is it possible to set a range that a fit parameter must remain within?
> For example, tell the center to stay between 890 and 910.
> Finally, can the heights be locked to positive values only?

There is no obvious way how to add such constraints (I mean how to
implement it in the program). Popular fitting algorithms don't allow
to use constraints, and if I'd try to add it, the basic problem is what
to do when parameter goes outside of allowed domain.

The constraints you write about are the simplest ones, AFAIR they are
called "box constraints". The only way I can see is to add it is to use
eg. height that is given as h^2, where h is fittable parameter. In case of
two boundaries, sine or cosine function could be used.
It would also have a side-effect, which could be good or bad
(or probably neglectable) - it's possible that the result of fitting
with such constraints would be worse (or better) than without constraints.

Now it's possible to do:
%peak[height]=(~{sqrt( %peak[height] )})^2
but after this you won't be able to change the height using mouse in GUI.

I'm going to implement box constraints in a way transparent to user
(internally it would work in the same way as I wrote above),
but it has rather low priority.

>
> If these requests are possible using cfityk only, I am willing to go down

Everything what can be done is cfityk is possible also in fityk.

Cheers,
Marcin

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

David Hovis

unread,
Sep 8, 2006, 11:07:00 AM9/8/06
to fityk...@lists.sourceforge.net
On Sep 8, 2006, at 10:28 AM, Marcin Wojdyr wrote:


Also, is it possible to set a range that a fit parameter must remain within?

For example, tell the center to stay between 890 and 910.

Finally, can the heights be locked to positive values only?


There is no obvious way how to add such constraints (I mean how to

implement it in the program). Popular fitting algorithms don't allow

to use constraints, and if I'd try to add it, the basic problem is what 

to do when parameter goes outside of allowed domain.


The constraints you write about are the simplest ones, AFAIR they are

called "box constraints". The only way I can see is to add it is to use 

eg. height that is given as h^2, where h is fittable parameter. In case of 

two boundaries, sine or cosine function could be used.

It would also have a side-effect, which could be good or bad

(or probably neglectable) - it's possible that the result of fitting

with such constraints would be worse (or better) than without constraints.


Now it's possible to do:

%peak[height]=(~{sqrt( %peak[height] )})^2

but after this you won't be able to change the height using mouse in GUI.


I'm going to implement box constraints in a way transparent to user

(internally it would work in the same way as I wrote above),

but it has rather low priority.



That is pretty much how I do all my peak fitting. Though I only use cfityk, and I'm still using 0.5.4, because I haven't had the time to learn the new syntax and transition all of my old scripts yet.  I've just been burned too many times by peaks going negative,  widths going to infinity, or peaks shifting out of the range I'm looking at.  I also tend to preprocess all of my data with either Python (for my fluorescence work), or Java (for the synchrotron x-ray data that I work on).

By the way, Marcin,  I probably have a few more papers coming out in the next few months where I used cfityk for processing the data. 

I also recently solved a very big problem in our group on the processing of synchrotron x-ray patterns.  Previously if we got a week of beamtime, it would take several months to process the data.  Using ImageJ with a custom plugin that calls out to cfityk, I've been able to shorten our analysis time by two orders of magnitude(!).  That will be another paper that I'll need to write in the next few months.

I wish I could figure out how to call directly from Java to the fityk source, though.  Right now I create a Process() to call cfityk and process the results with java.util.regex.  I know that is not very efficient, but it works well enough.  I've got a new problem coming up, though, where I'm going to need to make it run much faster.

--David

Marcin Wojdyr

unread,
Sep 8, 2006, 2:04:37 PM9/8/06
to fityk...@lists.sourceforge.net
On Fri, 8 Sep 2006, David Hovis wrote:

> By the way, Marcin, I probably have a few more papers coming out in the next
> few months where I used cfityk for processing the data.

I've just added "Publications" section to
http://www.unipress.waw.pl/fityk/docs.html
I've put there what I found using http://scholar.google.com/scholar?q=fityk

If anyone has publications in which fityk is mentioned (or it's not
mentioned, but was used), drop me a line.

David Hovis

unread,
Sep 8, 2006, 2:26:58 PM9/8/06
to fityk...@lists.sourceforge.net

On Sep 8, 2006, at 2:04 PM, Marcin Wojdyr wrote:

> On Fri, 8 Sep 2006, David Hovis wrote:
>
>> By the way, Marcin, I probably have a few more papers coming out
>> in the next
>> few months where I used cfityk for processing the data.
>
> I've just added "Publications" section to
> http://www.unipress.waw.pl/fityk/docs.html
> I've put there what I found using http://scholar.google.com/scholar?
> q=fityk
>
> If anyone has publications in which fityk is mentioned (or it's not
> mentioned, but was used), drop me a line.
>

Here are my two in print. Both mention fityk, but not in the abstract.

Heuer, AH; Reddy, A; Hovis, DB; Veal, B; Paulikas, A; Vlad, A; Ruhle,
M. 2006. The effect of surface orientation on oxidation-induced
growth strains in single crystal NiAl: An in situ synchrotron study.
SCRIPTA MATERIALIA 54 (11): 1907-1912.

Hovis, DB; Heuer, AH. 2005. Confocal photo-stimulated micro
spectroscopy (CPSM) - residual stress measurements in Al2O3 using
confocal microscopy. SCRIPTA MATERIALIA 53 (3): 347-349.


Majzoub, Eric H

unread,
Sep 8, 2006, 4:20:39 PM9/8/06
to fityk...@lists.sourceforge.net
Here is one that's in print.

Lattice dynamics of NaAlH4 from high-temperature single-crystal Raman scattering
and ab initio calculations: Evidence of highly stable AlH4 anions
E.H. Majzoub, K.F. McCarty, V.Ozolins, PHYSICAL REVIEW B 71, 024118 (2005)

Eric

Cheers,
Marcin

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Fityk-users mailing list
Fityk...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fityk-users


winmail.dat
Reply all
Reply to author
Forward
0 new messages