Multiple gaussian peak fitting
I have LabVIEW 7.5 How do I fit multiple gaussian peak (amplitude) with Labview. Is there a package to do this or do I have to start from scratch.
Thanks
I don't think there is a LabVIEW 7.5.
Fitting multiple peaks is necessarily ambiguous because there will always be multiple solutions (e.g. swap all parameters of two peaks and you'get an equally good fit). It will be important to have good initial guesses.
An amplitude alone does not define a gaussian peak, each peak also has a position and width so you'll have to fit three parameters per peak. Is the number of peaks fixed or can it be variable? Do all have the same width?
The nonlinear fitting VIs have been extensively revised with LabVIEW 8.0. Doing the same in LabVIEW 7.x would involve quite a bit more work. LAbVIEW 8.0+ even includes an example that demonstrates fitting a function that is the sum of three gaussian peaks plus an offset. That example would be a good starting point for you.
LabVIEW Champion . Do more with less code and in less time .
Similar Messages
-
Multiple Gaussian Peak Fit for Wavelength Spectrum
Hello.....
First, let me confess to being a relative noob..... So please be gentle.
I am trying to create a vi to analyse an optical spectrum of the form: Intensity vs. Wavelength. This vi would need to do the following:
1: Read the input data file.
2: Set a noise floor, below which all data will be ignored.
3: Scan the spectrum and identify the amplitude, width, and center of any peaks that are above the noise floor. There will be multiple peaks present (as many as thirty or so).
5: Fit a gaussian to each peak.
6: Sum the gaussians and create a new data file from this sum.
So..... I know what I want to do, just not the best way to do it. Is there a vi already in labview that will do this for me? The Gaussian fit vi seems only really useful if you want to fit a curve to a single peak. If I need to build this from the ground up, which is fine since I need the practice anyway, what would be the best way to start?
Thanks in advance for any help.
niaHello Nia,
There are many ways to approach this problem. By chance, do you have access to the sound and vibration toolkit for labVIEW (http://sine.ni.com/nips/cds/view/p/lang/en/nid/209056)? That toolkit will make performing the signal processing tools which will make creating this VI much easier. The following links may also be helpful for getting started with your issue
http://zone.ni.com/reference/en-XX/help/371361J-01/glang/file_vis_and_functions/
http://zone.ni.com/devzone/cda/epd/p/id/5742
http://zone.ni.com/reference/en-XX/help/371361J-01/lvanls/signal_processing_vis/
https://decibel.ni.com/content/docs/DOC-4475
https://decibel.ni.com/content/docs/DOC-17986
http://zone.ni.com/reference/en-XX/help/371361H-01/gmath/gaussian_peak_fit/
Thanks
Doug W
Applications Engineer
Applications Engineer
National Instruments -
Gaussian Peak Fit and Nonlinear Curve Fit on small data differ from Origin Peak fit
Hi all,
I am developing a program in which I have to fit Gaussian curve on only 4 or 5 data points. When I am using Gaussian Peak Fit or Nonlinear Curve fit, it linearly connects all the points while other fitting software like Origin is fitting Gaussian curve on the same set of data I have attached two images One is from Labview with Gaussian Peak Fit and NonLinear Fit and other is from Origin.
Data is
X Y
799.09857 257
912.25256 641
1026.00366 1516
1137.92871 1118
1253.43713 329
Labview user
Solved!
Go to Solution.
Attachments:
Origin_Fit.PNG 21 KB
Labview_fit.PNG 15 KBThat looks like a plot of the input data.
When I run it with your data I get a Gaussian curve which looks much like your Origin plot.
The Plot 2 curve is from 128 points equally spaced along X and Y calculated from the Gaussian formula in the LV help using the output parameters from the fit. Plot 1 is the Best Gaussian Fit output from the fit VI. It only has five points.
I used default values for everything except X and Y.
Lynn -
Does anyone know how LabView determines standard deviation on their Gaussian Peak Fit VI?
The VI reports standard deviation that is quite high. I am wondering if they go out to 5-sigma or something along those lines.
If anyone has had this same issue, please let me know
Thanks in advance!Interesting you mention the robustness of the algorithm. I have heard in the past that it is not very good. In fact, the data you feed into it must be VERY Gaussian otherwise the fit is just garbage. Luckily for me, my data is quite clean, see the attached picture.
You also mention Levenberg-Marquardt. Is a VI available somewhere or would I need to write my own?
Thanks for your prompt reply!
Attachments:
GaussFitAttachment.docx 26 KB -
How to fit multiple guassian peaks ?
Hi,
I have a two column data set (x,y) that contain large number of Gaussian peaks ( several hundredes infact). You can think of it more like a wavelength spectrum. The number of spectral peaks is not known exactly. There is no problem in detecting the peaks as they are of same amplitude. Eventually I want to fit a Gaussian funtion to each of these spectral peak and obtain the the parameters such as amplitude, line-center and sigma. This seems a somewhat tricky in LabVIEW. There is an example ( Sum of 3 Gaussian with offset) that comes bundled with LabVIEW. This example VI however uses a static refrence to a model function which is sum of three gaussian curves. This works well for few number of peaks in the data. If we have large number of peaks ( e.g spectroscopy data) then creating such a model function for a large number of peaks is nealy impractical. Is there a better way to handle such peak-fitting problems in LabVIEW? Would greatly appreciate if someone could point out any existing LV code/library function.
Regards,
RK
Solved!
Go to Solution.Many Thanks Altenbach. That was something I was after. I've attached an example data file of the sep...
Regards,
RK
Attachments:
multi-peak-spectra.txt 1128 KB -
How do I print multiple PDFs AND fit them to my paper size?
Hi,
I'm using a 24 inch wide plotter with roll paper. I want to be able to print multiple PDFs AND fit them to a specified paper size. I can print one page and fit it to the paper, but I can't do it with multiple PDFs.
For example, I have two PDFs that are only 8x8 inches. I want to print them side by side on a 24 inch x 12 inch page size and fit them to size and then FIT them to the page size so the end result will be 2 PDFs printing at 12 x 12 side by side.
I can't seem to be able to do this. I'm sure I was able to do this using earlier versions. As it is, I have to print one at a time and waste half of my roll paper size.
Any help?
Adobe Acrobat Pro, Windows 7 Proffesional, HP Designjet 111 roll fed plotter.
ThanksNote this illustration is Based on Mac version of HP Print Driver standard inkjet. However Control should be smilar Layouts and titles may be different:
Adjust items shown according to pages desired -
Getting errors in Guassian Peak fitting
Hi all,
I am trying to fit Guassian curve on following data
Index
Value
12
237
13
214
14
214
15
218
16
254
17
236
18
271
19
243
20
278
21
282
22
272
23
296
24
309
25
312
26
337
27
342
28
344
29
344
30
358
31
373
32
425
33
432
34
436
35
466
36
508
37
553
38
596
39
613
40
663
41
701
42
744
43
808
44
859
45
924
46
988
47
1059
48
1188
49
1299
50
1415
51
1542
52
1631
53
1775
54
1929
55
2018
56
2225
57
2458
58
2679
59
2956
60
3229
61
3408
62
3666
105
3546
106
3286
107
3023
108
2789
109
2598
110
2385
111
2187
112
1986
113
1841
114
1701
115
1616
116
1485
117
1356
118
1271
119
1165
120
1084
121
1013
122
945
123
884
124
827
125
785
126
721
127
660
128
620
129
606
130
581
131
535
132
519
133
500
134
462
135
438
136
449
137
426
138
381
139
375
140
366
141
338
142
342
143
335
144
302
145
313
146
293
147
291
148
282
149
276
150
275
151
280
152
269
153
255
154
250
155
252
156
248
157
252
158
255
159
242
But Guassian peak fit vi is fitting curve only for one side lobe. result is attached. Can anyone tell me how to avoid this problem
Labview user
Attachments:
Fit.png 25 KB
data.xls 21 KBTry specifying an initial guess. I used:
initial amplitude = 6000
initial center = 80
initial standard deviation = 10
initial offset = 200
-Jim -
Fitting multiple gaussians to curve
Hi,
I'm collecting a data array and saving it to a spread sheet. I can plot this on an xy graph however in order to process the data i need to separate the curve into separate gaussians. In theory decimating the curve should do what i need but I can't figure out how to make this work. Can i do this using point by point, or is there a way of converting each line into a wave to process it in this way?
The attached files are the basic vi that im using to read the saved file and an example file. I haven't included any of the errors as i've made as they haven't worked. I hae tried a simple guassian fit but as the peaks are overlaid on each other it isn't working and i feel sure that theres a better way of doing it than multiple iterations of this, particularly as the number of peaks varies.
Thanks!
Attachments:
cut analysis 2010.vi 73 KB
selected spectrums.xls 848 KBHello and thanks for using the forums.
If I understand your query correctly, you would like to be able to split your data into separate plot instances on the same XY graph in the simplist way possible. I have attached an altered version of your VI which will plot each gaussian separately.
If I've misunderstood your query please feel free to provide some further clarification.
Kind Regards,
Paul
http://www.paulharris.engineering
Attachments:
Separate Gaussians.vi 62 KB -
Multi peak fitting Error -20041
I programmed a multipeak gaussian fit. Its displaying the following error
"Error -20041 occurred at NI_Gmath.lvlib:Nonlinear Curve Fit LM.vi:6620001"
Possible reason(s):
Analysis: The system of equations cannot be solved because the input matrix is singular.
Can someone help me on this?
Solved!
Go to Solution.
Attachments:
Sum of N Gaussians with offseat fit.vi 38 KB
sum of N Gaussians with offset model.vi 17 KBI cleaned things up a little bit and it all seems to work OK. (might need to tune the peak detector). LabVIEW 2013.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Sum of N Gaussians with offseat fit_MODCA.vi 35 KB
sum of N Gaussians with offset model_MODCA.vi 17 KB -
Multiple place and fit content
I have several chapters of a book done in CS2. These were sent out and edited by a third-party in CS4 (communication issue there).
So they were backsaved as an .INX file and now I'm using CS3.
Problem is that the embedded images and links to 20 or so illustrations were not honoured and defaulted to "foo. jpeg" in the links pallette when I opened these in CS3.
The embedded images (excel graphs) I'm not worried about, it's the linked images which I now have to go in and manually relink.
The graphic frame and content boundary is intact so re-linking seems to work fine, but I'm wondering If i can select the art and multiple place each image within it's corresponding frame and have the attribute "fit content proportionately" assigned at the same time.
Do I use an object style?? I'm not too familiar with this, so if anyone can run me through the simple steps, it would be appreciated.
Also, I noticed in CS3 that the number of icons for fitting content are reduced on the toolbar (see image circled) compared with CS2?
Are the options to "fit content to frame, center content etc" only available from the drop-down menu or from the short-cuts?
Thanks in advance,
JulianPeter,
Yip, those would be the icons I was looking for, but maybe they weren't visible depending on what i had selected, since I swear I looked for them..but there they are in my screenshot
I was thinking a basic object style with just fram-fitting option selected to "fit content prop.", but I guess you are right in that the time saved would probably be negligible.
Any idea as to why the links broke - just a consequence of back-saving??
Julian -
I have a client with a system that has some kind of blend of old and new plugins on the system. There are 2 different Gaussian Blurs. There's "Color" and "Solid Color." Essentially, it has today's plugins and also stuff from a previous version of FCP.
Where does Final Cut keep it's default stock plugins? I've scoured the libraries and looked all over the place and I can't find them. I just want to delete the old ones and make sure they never show up ever again.
I miss the old days of System 9 when you told it to search your computer and it searched EVERYWHERE for EVERYTHING that you were trying to find. Now if something is hiding in a library, it won't show up in Finder searches.Yeah, two Gaussian Blurs. One is the normal with a popup RGB+Alpha by default and a number slider to pick the amount of blur. The other version has separate horizontal and vertical sliders. I think that's an old version from maybe FCP v4.
As for that folder location, that's where your plugins go that you install in addition to the default plugins. I'm looking for the built-in plugins. I'm guessing something got merged in from an older installation.
Well, huh... I switched Effects>Effect Availablility> from Only Recommended Effects to All Effects on my home studio system and now *I* have 2 Gaussian Blurs too. I guess those old versions of the plugins (which won't render on my client's rig) are actually hiding in all of our installations. By default they're hidden by the Effect Availability selection.
And on the Color/Solid Color, I forgot about that one. Now I remember that one is for FCP and the other is installed with Motion or something like that.
OK, I don't guess I need to know where the plugins are hiding since I can kill the wonky ones. -
Fitting multiple peaks under a curve?
Hello all,
I've recently come back to LV (after using it for hardware control) and am now using it for data manipulation. Basically I'd like some pointers regarding fitting.
The set-up I'm using collects scans every 20s for hours on end, generating tons of data. I can fit multiple Lorentzian curves under the peaks (see attached for typical data file and screen shot of fitting) using Origin manually but obviously if I could automate this and implement it in real time as the scans are acquired I will be saving a great deal of time and effort..
The positions of the peaks are unlikely to change (much) but the heights and widths may do.. will this cause a problem? Im very interested in following the change in the area of the third peak (as you see it on the screen shot) as time passes...
Finally I'm fairly familar with 8.2 but have been tasked with having a look at 2009 (which i currently have an evaluation version of), the main deciding factor in us upgrading is the new 'constrained' Lv fitting Vi, can anyone explain what the difference is and would it help in what I'm trying to do?
Any thoughts and ideas are much appreciated,
Kind reagrds,
David.
Attachments:
plotx.txt 2 KB
origin lor 3 peak fit.PNG 45 KBHi,
I can see how to get the curve fitting but how do you then apply the guassian fits to the peak locations? I'm struggling to achieve this using the fitting vis?
Cheers!
Daniel -
Gaussian and Lorentzian peak detection for spectroscopy
I am trying to automate some data analysis for a large number of Raman
spectra, and would like the option of using a Gaussian or Lorentzian peak
fit (the included VI is some sort of a parabolic fitting algorithm). Is
there a way to do this with any of the VIs in the full development system
(or has anyone already made such a VI), or am I going to need to just write
some C code and use the code interface node?Scott Williams wrote:
>
> I am trying to automate some data analysis for a large number of Raman
> spectra, and would like the option of using a Gaussian or Lorentzian peak
> fit (the included VI is some sort of a parabolic fitting algorithm). Is
> there a way to do this with any of the VIs in the full development system
> (or has anyone already made such a VI), or am I going to need to just write
> some C code and use the code interface node?
On my web site you can download a routine that makes a fit to a
Gaussian peak. It first estimates the width, offset, amp., etc, so that
the non-linear fit has a chance to converge. You may be able to
generalize this to do a Lorentzian as well.
Go to www.originalcode.com, then click on Example Code, Utilities,
and Downloads.
Dave
David Thomson 303-499-1973 (voice and fax)
Original Code Consulting [email protected]
www.originalcode.com
National Instruments Alliance Program Member
Research Scientist 303-497-3470 (voice)
NOAA Aeronomy Laboratory 303-497-5373 (fax)
Boulder, Colorado [email protected] -
Lev Mar parameters for Gaussian fit
I am trying to analyse a Gaussian profile using the Lev-Ma r fit provided with LabVIEW. My problem is that I don't know the proper format for the function descriptions to use and get an error when using the fit. Has anyone done this in the past, and can help with the formating of the inputs to the fit.
Thanks
Eugene Lormanlorman wrote:
> I am trying to analyse a Gaussian profile using the Lev-Ma r fit
> provided with LabVIEW. My problem is that I don't know the proper
> format for the function descriptions to use and get an error when
> using the fit. Has anyone done this in the past, and can help with
> the formating of the inputs to the fit.
>
> Thanks
>
> Eugene Lorman
Eugence,
I've been doing similar stuff myself, and found this link very helpful:
http://www.originalcode.com/occdl.html
Page down through and you'll find a downloadable VI that does
peak fitting on a gaussian.
HTH
dave Langstaff
Remove "spamkill." when replying to this message -
Best fit curve (gaussian)
I am having an issue implementing the gaussian best fit line on the data in the attached vi. How can i get this done?
Will appreciate any help!
-FredFred
Attachments:
best fitvi.vi 58 KBFredFred,
I think I've found a great example that shows how to use the LevMar.vi. It can be found here. It also shows how to plot the data from the LevMar.vi to gain the result I think you're looking for. Post if you have further questions.
Best Regards,
Chris C
Applications Engineering
National Instruments
Chris Cilino
National Instruments
LabVIEW Product Marketing Manager
Certified LabVIEW Architect
Maybe you are looking for
-
Document table and paragraph with POI
Hi wrotten the following program in order to read paragraph and tables in a word document: * To change this template, choose Tools | Templates * and open the template in the editor. package prezziarioreader; import org.apache.poi.hwpf.HWPFDocument; i
-
Generating a PDF programatically with precision placement...
I have a coworker who is creating a poster-sized calendar in Illustrator. Imagine a calendar with 100 events on it, each represented by a rectangle containing text describing the event, and some other details, in a nice typeface, and a few other sim
-
Upper Limit In Range and Coerce
I found a bug with the In Range and Coerce function, and I tried searching but I didn't see if anyone posted the issue before. Anyways, the Lower Limit is inclusive for the In Range indicator and the Upper Limit is not: Using U32, set the Upper limit
-
E-mail program won't open PDF attachments automatically with Adobe Reader
When I get e-mail with PDF attachment I get a message saying I must open only from trustworthy source. Then I click it open, but it won't open. So I click save, and it is saved to desktop where I can then open it with Adobe Reader. I prefer that O
-
hello all, this is 10g on AIX(RAC). i have been trying to use a index on a query forcefully by using a HINT ..here is the query. SELECT m.* FROM law.messages m inner join law.log_events l on l.bod_id = m.bod_id and l.type = 'LogEventException' WHERE