LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does waveform graph downsamples the data before it is plotted

Solved!
Go to solution

Hi,

 

I'm interested in how does waveform graph downsamples the data before it is plotted and what algorithm is used for this purpose? My goal is to plot 30 plots that have 1M samples each and I would like to downsample them before plotting onto a graph. I tried several VIs/algorithms for resampling and none of them gave the same result as seen by waveform graph (when all the samples are plotted).

 

For example, if only one sample of 1M samples is 1 and all others are 0, then after downsampling to 1k samples the sample is not visible on the graph anymore. However, if I plot all 1M samples directly onto the graph, then also this 1 sample is visible (see attached example). 

0 Kudos
Message 1 of 13
(5,417 Views)

I have the same problem that  l want to get Y axes point each sample and l will save these values in a .txt file.

Can anyone help me?Thanks.

0 Kudos
Message 2 of 13
(5,385 Views)

Hi andrej,

 

LabVIEW draws plots in the way that draw every pixel affected by signal. So for example if there is zero-valued 1M samples and even one equals to 1, you will see the peak. That is the reason why you do not get the exactly same behavior comparing to interpolating. But if you set FIR as interpolation mode in Resample Waveforms (single shot).vi, result is really similar, but of course amplitude is 1000-times smaller than original one (because there is dt set to 1000). Keep also in mind that in Graph 2, there is different Y-scale and it should be considered as noise, not relevant data, I would expect 1000-times smaller amplitude as in Graph 3, it is many more times smaller.

 

I would also like to say something about downsampling (decimating) the data. If you have 1M samples, you can see the peak even that there is only one value. But bigger problem is that with this graph resolution (I guess that is not more than 1000px), it is problem to find position of this peak. It means that still the zoom is needed to know where the peak is. Usually, when there is that big set of data, you are extracting different data (statistical information, peaks in FFT, etc.) not just visual data in graph.

 

Mariaaa:

I do not understand your question, can you please describe more your needs? You mentioned saving the data into a file, you can use Write to Measurement File express VI or see Write to Text File.vi in Example Finder and try to appropriately modify it.

 

Best regards,

Martin

0 Kudos
Message 3 of 13
(5,339 Views)

Thanks Martin!

I'm aware of evreything you wrote.

 

I would just like to get the algorithm (or its description) that is used with Waveform graph, so I would save some time. Otherwise, I'll have to do it on my own.

0 Kudos
Message 4 of 13
(5,333 Views)

Hi andrej,

 

I think that it is not possible to create the same functionality as graph using decimation. What functionality would you like to do?

 

Best regards,

Martin

0 Kudos
Message 5 of 13
(5,326 Views)

I would like to plot a signal on a graph and I would like to downsample it first (because signal can be 10M samples or more long). But I would like to do it as waveform graph does it by itself (small events must be visible). It's just for visualization.

 

E.g.. I have a zero-based signal that is 10M samples long and it contains 3 to 5 events. Event is impulse with amplitude of ~1 and with of 3 samples. The goal is to visualize the events on a graph.

I know that in this case a can do visualization on my own (find peaks and construct new signal), however I would like to have more general solution - and this is exactly what waveform graph does.

0 Kudos
Message 6 of 13
(5,324 Views)

Hi andrej,

 

you have full knowledge about processed signal, I think that creating the code capable of extract this data and downsample it with paying attention on peaks would not be an big issue. The easiest way how to do it would be for example downsample it to 1000 samples (or similar number). Every value will in this case (initial array is 10M samples long) cover 10k values. If there will be peak in this region, you will set this sample as peak. If there will be more than one peak in 10k region, you do not need to care because due to resolution, you will not be able to see anyway.

 

And under the graph, you can have an array of simple values or array of clusters with more detailed information about this peaks like position, width, etc., so you will see both graphical overview and details.

 

Best regards,

Martin

0 Kudos
Message 7 of 13
(5,320 Views)

Yes, this will work in my case. But in general the algorithm is more complicated I think. I'll try to do something more general.

Thanks again for your help!

0 Kudos
Message 8 of 13
(5,317 Views)

Why not use two plots with min & max filled with the plot color ? 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 9 of 13
(5,313 Views)

I honestly dont understand the original question.

The graph is not downsampling the data or modifying it by any means.

The graph is plotting every single value of the signal. If the #samples > #pixels available on the x-axis, the graph will simply plot multiple values on the same x-coordinate!

 

Norbert

 

EDIT: Corrected my post to match the actual functionality of LV graph elements

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 10 of 13
(5,312 Views)