LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

identify peaks on graph using cursors

I have a piece of analysis software that is supposed to identify event shapes based on peaks in a histogram (attached, along with a sample data set). Following the advice of users in my last thread, I rewrote the program in what I hope is a much improved way. My first question as a LabVIEW newbie: please critique my code. Suggestions for improved style/readability are more than welcome.

Currently, the program automatically detects peaks in the histogram and fit them, which works fine. However, for more noisy data sets where peaks overlap or there may be many small peaks, it does not do as good a job as it does for the sample data provided. To that end, I would like to be able to have users specify peak locations, ideally by clicking on the graph. It would be relatively simple to have them input them numerically (something like this, for example: https://decibel.ni.com/content/docs/DOC-2238), but I would like to learn to user cursors at the same time if possible. So, my idea is this:

After plotting the raw histogram without a fit, users would be prompted to enter a variable number of peak locations by clicking on the graph, which would then be used to split the graph up into pieces containing a single peak and fit, just as is already done in the program. Basically I want to replace the Peak_Detector.vi with user input. I believe from reading around that the way to do it would be to use cursors, but I haven't been able to find an example showing me how to do it. A push in the right direction would be appreciated!

 

To run it, feed the input file the attached .csv and take the default values. If anything is unclear, let me know.

Download All
0 Kudos
Message 1 of 3
(2,960 Views)

I have worked out a partial tentative solution using invoke nodes (attached). I need some help getting further, though. If, during the loop to get point, I decide I made a mistake and I want to go back, what is the cleanest way to do that (delete previous array elements and decrement the index). I tried adding a boolean button to delete last with a value change event structure associated with it, but I couldn't figure out how to choose between getting a new point and that as a way to control the loop.

0 Kudos
Message 2 of 3
(2,917 Views)

(disclaimer : I haven't looked at your VI).

 

One way to use the cursors would be to create one (in EDIT mode) and have it snap to plot 0.

It will therefore always be on your plot.

You can show the readout (Cursor Palette) if you like.

 

In the code, it's just a property of the graph.

 

You could respond to changes in cursor position and provide your own readout, if you like.

 

Provide a button (or menu item) to DO IT, and when the button is clicked, you remember the X and Y cursor value (read the properties) and use that Y value as your peak.

 

you could also look up some other value at that X location, if that does anything for you.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 3
(2,876 Views)