LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting and recording peak positions in real time

Solved!
Go to solution

Hello everyone,

 

I know this question has been answered in different posts on this forum. but I don’t know how to start. I've attached the I've written thanks to the help from the good people on this forum. The images taken by the CCD camera for each scan should look like the attached sketch (see fig 1). For each spot on the sample, there are 5 scans of 20 each; I want to insert a peak detection VI that detects and save the positions of the maxima of the 3 tallest peaks for each scan in real time. I then want to average and save these positions over all the 100 scans before moving to the next spot. Your help will be very appreciated.

 

Petmar.

Download All
0 Kudos
Message 1 of 16
(3,693 Views)

I do not see any peak finder in your posted VI. It looks like you CCD camera is only giving a line of values. This is one way to do it, but you need to verify.

  1. Take the first three peaks and their maximum, position and average.

Edge cases, assume 3 peaks A, B, and C

  1. First scan peak B is largest, second scan peak C is largest. The peak finder VI gives the peaks largest to smallest, so it may be better to rearrange based on position so you average the correct peaks.
  2. What happens when their are less than 3 peaks?

Example

snip.png

 

 

mcduff

 

0 Kudos
Message 2 of 16
(3,644 Views)

Hello mcduff,

 

The images I have attached are an interference fringes taken by a CCD line camera. Sometimes the peak positions and amplitudes vary; sometimes even the number of peaks vary when there is significant disturbance to the setup. I have a vibration isolation system so if there’s no significant disturbance and the laser remain fairly stable I should have the three peaks. You are right that the CCD is taking these images and giving out lines of values. What I want to do is that in the ideal situation where there are three peaks, that the peak finder detects and record the positions and amplitudes of the three tallest peaks shown by the CCD. The second step is to get the average position of each of the three peaks for each complete run (100 scans). When the conditions are not idea to permit three peaks I still want to continue with the scans but the data will be discarded. Please will what you suggested do this? Thank you.

 

Petmar.

Download All
0 Kudos
Message 3 of 16
(3,635 Views)

Look at the peak finder VI and make sure you have it set correctly to identify your peaks. You will need to adjust the width and threshold. Depending on your data you may need to smooth it before using the peak finder VI. The peak finder VI returns the number of peaks found, if that value is less than 3, then you can discard the results.

 

Alternatively, you could write a function that fits your peaks to 3 Gaussian functions, (search the forums for Altenbach's posts he is really good at this), once you fit the peaks, use the fitted values for your position and amplitude.

 

mcduff

0 Kudos
Message 4 of 16
(3,633 Views)

Okay. I'll do as you've suggested and get back to you. Thank you.

0 Kudos
Message 5 of 16
(3,629 Views)

Hello mcduff,

 

This is what I did following what you posted. I have tried it but it doesn't detect any peak. Please see what I did wrong.  Thank you.

 

Petmar.

0 Kudos
Message 6 of 16
(3,593 Views)

Send some example data. In the plot on your VI there are no peaks. You also need to add the whole array, change your 3 element array such that it is using a shift register, not autoindexing.

 

mcduff

0 Kudos
Message 7 of 16
(3,583 Views)

Hello,

 

Please pardon me for often responding late to your posts. I only have LabVIEW on the lab pc so I don't have access when I'm out; my student free trial time has elapsed. I have attached the data the VI is currently giving me, but it really don't understand it. What I want is for the VI to give the locations of the three peaks and their corresponding amplitudes and for each scan (and the average over all the 100 scans for each spot). Please see attached image. Thank you.

 

Petmar.

Download All
0 Kudos
Message 8 of 16
(3,571 Views)

In LabVIEW make a plot of the data you want to fit, then save that data as default data. Then attach that VI to the forum. I do not know how to read your files.

 

mcduff

0 Kudos
Message 9 of 16
(3,564 Views)

Here's it. Thank you.

 

Petmar.

0 Kudos
Message 10 of 16
(3,559 Views)