Bounds for peak centres

52 views
Skip to first unread message

Daryl Lee

unread,
Oct 2, 2023, 5:15:49 AM10/2/23
to fityk-users
Hi fellow Fityk users, 

I'm new to this, and would like to get some advice on how to constrain my centers while fitting my Raman spectra with Gaussian and Lorentzian peaks. 

I'm using Fityk 1.3.1. What should I do allow my peak center to be varied between, say 1100 and 1300 during the fitting. If I unfreeze (disable the lock icon), I can get ridiculous results as the peak center goes to some unreasonable value. 

Any suggestions are welcome. 

Thank you.
Daryl


Capture.PNG

Alexander Selyutin

unread,
Oct 2, 2023, 12:51:33 PM10/2/23
to fityk...@googlegroups.com
I had the same issue. I did not find any solution because if you will in "definition manager" set the range of variable by example with "shape" fityke will crash.


пн, 2 окт. 2023 г. в 16:15, Daryl Lee <jhdar...@gmail.com>:
--
http://groups.google.com/group/fityk-users
---
You received this message because you are subscribed to the Google Groups "fityk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fityk-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fityk-users/58ef0de7-9445-4bbc-8486-d41dd0459306n%40googlegroups.com.


--
Regards,
Alexander Selyutin

Guillermo Copello

unread,
Oct 2, 2023, 4:08:07 PM10/2/23
to fityk-users
Hi,
The constraints are only conserved if you previously select: Fit-» Method-» Lev-Mar (from MPFIT)
Then, in the command line terminal you have to enter the value of your function (i.e. peak center) and the desired range:
The general formula is:
$_"variable number" = ~"initial peak center" ["peak lower constrain":"peak higher constrain"]
In example:
$_50 = ~1600 [1590:1610]
in this case my peak center variable number was _50 and the lower limit was 1590 and the higher 1610.
The variable number corresponding to your peal center can be known from the Functions table, but I usually know the peak center variable number by moving just a little bit the peak and this action appears in the command log above the command line terminal.
This can be also done with peak heigh, hwhm, and, if I am not wrong, with peak shape.

Best regards
Guillermo Copello

Daryl Lee

unread,
Oct 2, 2023, 6:23:30 PM10/2/23
to fityk...@googlegroups.com
Thank you for your replies, Alexander and Guillermo. 
With the ability to set bounds, I am confident I will get my Raman data processed appropriately now. 

image.png
Alexander, by 'definition manager' were you referring to the command line?


Daryl



You received this message because you are subscribed to a topic in the Google Groups "fityk-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fityk-users/w_hkB1NCO0w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fityk-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fityk-users/ab4b7315-e52d-4496-bc3d-94ce88e3c9c4n%40googlegroups.com.


--
Kind regards, 

Daryl J.H. Lee
PhD Researcher
Chemical & Polymers Graduate Research Industry Partnership
Room G44, 17 Rainforest Walk, Clayton campus
Monash University, VIC 3800, Australia 

Jasper Ristkok

unread,
Oct 2, 2023, 10:34:33 PM10/2/23
to fityk-users
Dear Daryl,

I'd like to add an additional method or "hack" to such cases. It consists of creating a separate variable and using sin function. So, lets say you want Gaussian center to remain between 900 and 1100. Then you can tell the function to use center = 1000 + 100*sin(angle). 1000 is the ideal center, 100 is amplitude and angle is the new variable that Fityk can change but as sin function value is only from -1 to 1, the center will be locked mathematically between 900 and 1100. I've successfully used this for batch processing close to hundred Gaussians/Lorentzians which need to have tight bounds similarly to your case. There's an example for that here: ( https://github.com/Tshepajev/fityk-libs-spectra-script/blob/master/analyze_and_plot.lua ) in the function guess_parameter_constructor(linenr) at line 397 (at the time of writing).

Cheers!
Jasper
Reply all
Reply to author
Forward
0 new messages