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]

Similar Messages

  • Peak detection for a noisy signal offline

    Dear LabView experts...!
    I am trying to find the peaks in my Signal offline . I like to find out the amplitude,location of the peaks and manipulate it. But the signal has noise and if i try to feed in this signal to a peak detector it gives false results as taking the small noise peaks . i like to get the large peaks (3 peaks in the given data ) .
    Please help me out to detect these peaks.
    When i used a peak detector.vi for a simulated noise less data its works fine. I am using LabVIEW 7.1.
    Expecting your reply.
    Solved!
    Go to Solution.
    Attachments:
    forumpeak.vi ‏207 KB
    Forumdata.txt ‏753 KB

    Why such a slow sample frequency? A technique that I have used is to sample with a higher rate than needed and then average x samples together. As an example. Use 140 Hz as sample rate and then average every down every 20 sample to one , and present the result as 7 Hz samples.
    Message Edited by Coq Rouge on 04-13-2010 02:12 PM
    Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
    (Sorry no Labview "brag list" so far)

  • Did you know that using the erase feature for stolen iPads can fail? Mine did and was not detected for 10days.

    Thursday(day 1):Had an iPad2 wifi only which I rarely used, stolen.
    minutes later, pulled up findmyphone on iCloud and put a lock on iPad and then erased the iPad.
    Sunday(day4) : I noted websites opened on my iphone that I had not opened.
    Monday: Spooked, I went to genius bar was informed that it would have been wiped since the thief had been hooked to wifi and thus the iPad would have been erased.
    Sunday(day 11), my iCal has been deleted totally from all my devices (iMac, iPhone, MacAir)
    Monday (day12): I go to genius bar with Time Machine backup drive and some magic is worked to recover it. The conclusion was that the thief of my iPad wiped it out. And, " there are always ways to get into the iPad if they really want to with firewalls etc....".  And I needed to change my iCloud password (which the first guy did not suggest and stupidly I did not presume I needed to do).
    Monday: (day 12) Password changed. OK, done.
    Wednesday (day14): I open my photo stream on the iphone and see screen shots of websites dated from as recently as day 10! These of course showed up on my iMac and my iPhone amongst my own photo shots. Talk about feeling violated and failed.
    Moral of story: Can not trust that the erase feature works.
                              Change every single  password you have as there is not assurance that a track has not been made.
                              And, do not have more than one user on your device: such as your spouse as their stuff could be compromized too.

    The pages panel is not the place where you see this information.  You can customize the Links panel to show all sorts of things, including the page number, effective and actual ppi, and whether the link is OK or needs updating.

  • Peak detection( take 100 ms samples?)

    Hi...
    I have a problem using peak detection under Analysis=>waveform monitoring.
    I want to get the real data (ECG data), and detect the peak of the data. Then i want to store the index of the peak into array so that i can measure the time difference between two peaks.
    my problem is that when i use peak detection, i cannot get the result as above mentioned. Before this i have tried to test the peak detector and found that if it will detect the peak for 100 ms time interval only. SO if i have waveform with f=100 Hz, then it will detect only 10 peaks..Is it correct that this vi takes 100 ms sample for detection? *correct me if i'm wrong
    And since i want to get the real data from ECG hardware, is there any method to measure index of the occurence of all peaks and store it into array? (not only for 100 ms)
    -I saw the formula in peak detector help :
    To view the locations in terms of time, use the following equation.
    Time Locations[i] = t0 + dt*Locations[i]
    What does [i] here represent?
    Thanks for the help...
    Regards,
    Rismi *newbie...:d

    Hi...
    Thanks, now i can understand about peak detection for simulate signal...
    Then if i use this vi to detect peak of ECG data(data from DAQ or recorded data)..This vi will detect the locations of peak of current block of data. what "current block of data" in this case represents..??
    i attach my simple program to detect the index of peak of my data. But i cannot get my desired result. And when i detect the number of the peak, the values is either 0 or 1. I don't know how to fix this problems.Can anyone give me advice?
    Attachments:
    retrieveSunday22.vi ‏161 KB

  • WA Multiscale Peak Detection VI

    Dear users,
    using "WA Multiscale Peak Detection VI', I would expect that peaks detected for a waveform Y are the same as valleys detected for the waveform -Y (y-values multiplied by -1, i.e., waveform flipped upside-down), see the snippet, please. This is not the case, when doing the analysis on some data.
    Opening and examining the subVIs, I only see reversing the synthesis and analysis filter frequencies and changing "greater" for "lower", as for the difference between "peaks" and "valleys" setting.
    The documentation does not state any substantial difference between "peaks" and "valleys".
    Any thoughts on it?
    Solved!
    Go to Solution.

    OK, so after some more analysis:
    One has to "y-flip" the threshold for the valleys. I.e., if one searches for peaks with a threshold T and want to search for similar looking valleys, then there are two solutions:
    a) flip the data (*(-1)) and keep the threshold
    b) flip the threshold (*(-1)) and keep the data.
    Having no option for searching the valleys offered by this VI, I'd came up with the a) solution quickly, most probably -- it's hypothetical, right? Having this options and seeing the results, confused me highly.

  • T430, disable "OS Detection for NVIDIA OPtimus" in BIOS, no graphic card can be found in Windows

    I try to use my T430 minidisplayport to connect with external display. But it is so unstable that the connection between laptop and display can lost anytime. That is so annoying. I use Nvidia control panel in Windows to force use NVS5400M instead of HD4000, but it seems doesn't change anything.
    I heard if I select the discrete graphic card in BIOS, then it may fix the display connection lost problem. Then I go to the BIOS and  set the "discrete", and disable "OS Detection for NVIDIA OPtimus" in BIOS Config Display (This is necessary otherwise the laptop will change it back to Optimus automatically.). But after I log into Windows, then no graphic card can be found, Why? How should I fix this problem?
    The external display issue in T430 is so annoying. The VGA suffers very serious noise while the minidisplay is so unstable. Even worse, there is no any lenovo staff stand out to help !!!!!!!!!!!!!!
    If anyone has experience, please share that.
    Thank so much.

    Hello Mark, thanks for help. Please see my answers below:
    1. Windows 7 Ultimate 64 bits.
    2. Yes, I did. The BIOS is latest (2.65). The NVS5400M driver is 333.02.
    3. My display is Asus MX239, which only has HDMI. I use an adapter cable: miniDP->HDMI and then an HDMI-HDMI cable I try to connect to a Samsung TV, but similar. I don't have a miniDP to HDMI cable. I just order one but has not get it.
    Sorry that I post in multiple threads. As I mentioned in that thread, let me conclude all these here.
    After I disable "OS Detection for NVIDIA OPtimus" in BIOS, then I istalled the NVS5400M 333.11 driver. Then the NVS5400 can be found in Windows. But the displayport problem still exist. It is still very very difficult to detect external monitor (this means in most cases I can't switch to external display), and even sometimes it works, the connection can lost anytime.
    Even worse, I found a new problem, that if I disconnect my T430 with power supply, then I can see the "pink bar" appear and disappear in the laptop screen (not external monitor) repetitively, quickly. I have never seen this problem before, only after I install NVS 333.11. Then I reinstall the 333.02 driver. Then I enabled the "OS Detection for NVIDIA OPtimus" in BIOS again. The "pink bar" issue gone. It looks like the issue is caused by 333.11 driver. But this driver comes from Nvidia offical driver download website.
    So now the most important thing I need help is, I need to have a stable solution to connect external display. In T430, there are only two ports for external display:
    1. VGA
    2. MiniDisplayPort
    Please help me following questions:
    1. When I try to use VGA, I can see very very bad noise in external display. This issue also be posted in previous thread in forum. This should be a hardware design failure. Is there any solution to fix this that I can use VGA without noise in external display?
    2. My T430 has both HD4000 and NVS5400M, if I need to use miniDP (which is I prefer, I have digital port why I use VGA.) for display. Does miniDP only work when the NVS5400 is used (it looks like that)?
    3. If miniDP only works NVS5400, so how should I configure to ensure the T430 use NVS5400 all the time? Do I have to disable "OS Detection for NVIDIA OPtimus" in BIOS or I can switch using Nvidia Control panel in windows ?
    4. Would you please provide me a configuration for T430 (include BIOS, and setting in Nvidia Control panel) that can support stable external display thru miniDP? Include driver versions and BIOS version.
    5. What are potential reasons that the external display can't be detected and can lost connection anytime with T430? To be noted, I already set to use NVS5400 in Nvidia Control panel. The case is also same I disable "OS Detection for NVIDIA OPtimus" in BIOS. I think cable may be a issue.
    Thanks again.

  • I am trying to detect signal peaks (derivatives of the peaks both +ve and -ve peaks). simultaneously 2 peaks detectors are running, 1 for +ve and other for -ve peaks.

    i am trying to detect signal peaks (derivatives of the peaks both +ve and -ve peaks). simultaneously 2 peaks detectors are running, 1 for +ve and other for -ve peaks. when a peaks get detected it would trigger a pulse of approx 1 sec duration and at the same time it would disable the other peak detector for 1 sec time duration. after the time period, again both the peak detectors would be enabled. i have been able to detect both peaks but still not able to control the detectors block the way mentioned before.
    the code and the data are attached.
    Attachments:
    eog peak detection.vi ‏192 KB

    I'm not suggesting any of this as a model, and your needs are different than mine.
    1) Go to Preferences -> Audio.  Under "Default Audio Tracks", Set "Mono Media: Mono".  Set "Stereo Media: Mono"  (Choices from the pull-down for both are Use File, Mono, Stereo, 5.1, Adaptive)
    You can change these, but I don't. I am using both mono and stereo tracks. I set up a custom sequence with the particular combination of stereo and mono tracks I want.
    2) Set audio for clips by selecting all clips and going to Modify Clip -> Audio Channels Tab.  Under "Number of Audio Tracks" there should be a "1".  Under Channel Format it should read "Stereo".
    I am not sending the audio to anyone else to edit further. I am doing a final stereo mix. If camera one is set up to record 2 mikes as a stereo track, then I leave that unchanged and put it onto a stereo track. If camera two is set up to record one mike onto channel 1 as ambient sound and channel 2 is a mono feed from a sound board, then I modify those clips as Preset Mono, 2 audio tracks, Channel format Mono, and that puts the left source channel (or whichever I choose) onto Audio track 1, channel 1 (of one), and right source channel onto audio track 2, channel 1.
    4) Delete all the existing audio tracks in the sequence and replace them all with mono tracks, so all tracks in the sequence are mono.
    I modify the tracks while creating the sequence, and ultimately use a custom sequence.
    Under my Effects Controls panel there is only Channel Volume, and nowhere to adjust the pan.
    I'm using the mixer, not the effects control panel.

  • Block Peak Detection and Display

    I am doing a project on a spike check automation program in Labview. I am trying to detect the peaks and valleys from a probe test on a wafer.The probes are attached to the wafer and connect to an oscilloscope. Right now finding the peaks and valleys are done manually but take a lot of time from one pin.
    My program has to optimally run for 20 seconds and, at every interval, of let’s say 20microseconds, has to take the worst case scenario for the peaks and take the screenshot from the oscilloscope and save it until the worst case scenario in the next block on 20 microseconds until the 30 seconds are up.
    I am using LV 2010 and I don’t have experience with LV before. I have researched and found a VI called waveform peak detector which seems helpful but I am not sure how to save a screenshot at each interval or block.  
    I am also unsure on what to put in a loop so my program can run continuously for 30 seconds without stopping.  I also have the instrument drivers for my particular oscilloscope so I can control the scope from my computer and LV program.
    Any help is appreciated and thanks in advance for your assistance. 

    Share for care... oops share for cure...!!
    please share your code or more info..!!
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • Peak Detection and Display of TDMS file of 4 channels

    The Peak Detection and Display sample VI in the NI Example finder is exactly what I am looking for but I would like to use a recoded TDMS file as its input. The TDMS file is a 4 channel data file.
    Does someone have an example code on how to do this?
    ERB 

    Hi
    I found an example in exampler finder called Read Channel Groups (TDMS).vi, which seems to plot data for four channels written in a TDMS file.
    Its also attached.
    Kind Regards, 
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!
    Attachments:
    Read Channel Groups (TDMS) forum.vi ‏20 KB

  • Fetch and peak detection all channels of PXI-5105 with 4M record... HELP!

    Dear collegaues!
    Please help me to improve performance my application, see attachment, and sorry for my English.
    So, my task is to fetch and peak detection all (eight) channels of PXI-5105 with 4M record and sample rate 4M with loop 1 sec...
    Inputs of all my channels are wiring to NaI detectors with 0,5...1 microsec of pulse width (really) and freq from 0 kHz to no more than 40 kHz.
    Why I've selected 4M record and 4M sample rate namely? Answer is that I've tested PXI-5105 previously by generator 40 kHz and 0,5 microsec width pulse. It is working fine and peak detection indicate for me 40000 pulses/sec. If I set lower than 4M record and 4M sample rate it is no working. In my honest opinion 4M record and 4M sample rate are very min settings.
    In the present time peak detection working only 6 channels... When I've connected to diagram more than 6 "peak detector.vi" - I see the error "...out of memory...".
    Please advise me, what is to be done for that is all working fine.
    Solved!
    Go to Solution.
    Attachments:
    consumer-producer7.vi ‏44 KB

    What you are running into is an out of memory error in LabVIEW.  You have enough onboard memory to capture 4M samples per channel on the digitizer.  The issue is with fetching and manipulating that data in your LabVIEW application.  You will want to step back and take a look at how you are handling your data to understand why that is happening.
    1) 4M samples/ch = 4M Samples x 2Bytes/sample/ch = 8M Bytes/ch
    2) Expanding to 8 channels creates 64M Bytes of data in the raw binary format
    3) You are scaling your data by fetching in a 1D WDT format.  This stores each sample in a 32 bit double, expanding the memory to 256M Bytes (in addition to timing information)
    4) By splitting up the array of waveforms and branching data it you can easily create copies of this data, and if your consumer loop is not completed with the last data, you may be trying to capture a whole new set, creating yet another copy.
    So you can see that while you have 1.5GB of controller memory, when dealing with large arrays of data you can easily eat up that memory.  There are several things you can try to make your application more efficient.  You could work with an unscaled binary data format, you can wire the array of waveform directly to the peak detect vi (instead of creating 8 copies, you will have a single copy with arrays of output) or you could revisit the record size you have chosen (experimenting with your threshold and width settings might help you to get the results you want with smaller record lengths).
    -Jennifer O.

  • 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.
    nia

    Hello 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

  • Peak Detection Algorithm for FPGA LabView

    I am in the process of migrating my Labview software of a fiber optic sensor to an FPGA using a single board RIO.  However, my program uses the pre-built Peak Detector VI, which contain some floating point math.  I was wondering if there were any existing peak detection algorithms out there that uses the fixed-point math, required in the operation of the FPGA.  Thanks in advance for your time and consideration. 

    mdnb2,
    Here is a document on our website that talks about Peak Detection Using LabVIEW and Measurement Studio, though it references the VIs that are not available in FPGA, it has interesting information on peak detection in general.
    As far as writing your own algorithm, here is how I would start writing one. Basic Steps :
    1.) Search the array samples to find the top X number of points and their locations.
    2.) Filter out multiple samples on the same peak by removing points close to other points by witdth of Y samples.
    3.) Filter out low peaks by comparing the all remaining peaks to each other.
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • 2 Channel peak detection and value look up

    Hi all,
    I have 2 different sin waves going into channel 1 and channel 2 of an oscilloscope. What I'm trying to do is:
    1. From Channel 1's input determine the time when peak values occur and save them to an array
    2. Then find out what channel 2's voltage output is at times determined from step 1. 
    I started doing this project by only using 1 channel where I was able to extract the y data as well as plug it into peak detection.vi. 
    However after I merge the two channels together and proceed like I did with 1 channel  labview shows disconnected wires due to data incompatability. 
    Any help would be greately appreciated on how I can locate channel 1's peak times and plug those time values to determine output values for channel 2.
    Attached is
    1. The single channel peak detection (which works)
    2. 2 channel peak detection (the .vi I need help on)
    Attachments:
    Single Channel Peak Detection.vi ‏33 KB
    2 channel peak detection.vi ‏22 KB

    The VI is broken because you are connecting an array of waveforms with VI's that are asking for a single waveform.  You need to use Index Array to break out one or the other waveform to feed to the other VI's.

  • Peak Detection and Integratio​n

    I have been trying to design a reliable way to detect and integrate seven reactor zone temperature profiles. First, I tried to modify the peak 3.0 example to suit my needs, but alas, it does not work as envisioned (i.e it never detects the correct baseline with my data but it works with the peak 3.0 data set). Does anyone know of a reliable way to detect and integrate peaks of varying length in Labview? I will attach a copy of my vi in hopes of a solution. I attached a Savinsky-Golay smoothed experimental data set of one reactor zone. Thanks for your time!
    Attachments:
    Peaks_Example_3.0(modified).vi ‏137 KB
    time_peak3data_exp_data_.txt ‏38 KB

    In general, I've found working with either the 1st or 2nd derivatives to be more reliable when doing peak searches.
    2006 Ultimate LabVIEW G-eek.

  • "Timed event" for peak detection input

    I have a program that takes some data and looks for peaks in the data it collects. What I need to do is make a timed event such that the "peak width" parameter will change from one control variable that I can change manually to a second one after a certain time. Do I need a second loop and some boolean logic for this, or is there a much simpler way?
    I don't have access to the entire program right now, but the attached screenshot should contain all the relevant stucture.
    Attachments:
    untitled2.jpg ‏112 KB

    Sorry for the multiple posts.
    Upon closer inspection of the first VI image attached, I think I should clarify a bit more. In this attachment, a subVI called "peak detector" is being used to locate the magnitude and position of maximum values of the data array. I think this is the similar VI as the one shown here. This VI is being passed the following input parameters: 
    So it looks like the goal is to change the value of the "width" input manually after a certain period of time has elapsed. There was some ambiguity in my mind of exactly what this meant.
    If we just want to change the value of the "width" input during future iteration(s) in the stacked sequence structure, one way would be to place a different control inside each stacked sequence structure. You could add Wait (ms) VI's inside each stacked sequence to delay the progression from sequence to sequence.
    By contrast, if the goal is to change the value of the "width" input in the middle of the "X" array, then we could alter Detect Peak VI's default behavior by going into the block diagram of this VI. You might need to press "Ctrl+m" on its front panel to get an editable VI in this case. There, switch the threshold value to another added input parameter after a certain number of iterations into the array.
    What is the behavior that you want to see?
    Just some thoughts if you haven't solved the issue yet. Hope this helped, let me know if you have any questions or comments, and best of luck.

Maybe you are looking for