LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to downsample (with averaging) by a non-integer factor?

 

I am collecting data from a photomultiplier at 10MHz (from NI-PXI6115), to
produce an image in which
each pixel will be the average of several samples. That is trivial if the
number of samples per pixel is an
integer. But I need to be able to have the pixels created from an arbitrary
DBL, like 3.5845 samples per
pixel. (This is to satisfy the constraints of fast mirrors scanning a laser
to
produce the light collected by
the PMT)
I can't seem to find any VI that does this. How can I do this, and do it
quickly (images are coming in from
this 10MHz stream continuously, at about 10 FPS, and should be displayed
continuously). I did find a vi to
"align and resample" the data, but that does not seem to be able to take a
running average. There is also
the "decimate" command, which only decimates by an integer value.

 

I am collecting data from a photomultiplier at 10MHz (from NI-PXI-6115), to produce an image in which each pixel will be the average of several samples. That is trivial if the number of samples per pixel is an integer. But I need to be able to have the pixels created from an arbitrary
DBL, like 3.5845 samples per pixel. (This is to satisfy the constraints of fast mirrors scanning a laser to produce the light collected by the PMT)
I can't seem to find any VI that does this. How can I do this, and do it quickly (images are coming in from this 10MHz stream continuously, at about 10 FPS, and should be displayed continuously). I did find a vi to "align and resample" the data, but that does not seem to be able to take a running average. There is also the "decimate" command, which only decimates and averages an integer number of array elements (samples). All that I and an NI engineer came up with so far is to first upsample with interpolation by a large factor, then do the decimation with an integer that is my desired DBL multiplied by the upsampling factor. Any more efficient ways do approximate this? Which specific VIs to use?

 

Thanks,

Steve Potter

0 Kudos
Message 1 of 3
(4,463 Views)

Have you tried the "Resample (constant to constant)" VI in the Signal Processing/Signal Operation palette?  This uses a filter to allow resampling of the signal at an arbitrary dt.  If you need a variable dt (i.e. your sampling rate changes with time), you could try fitting some function (say a cubic or bezier or spline) to the input data and then interpolating values at your desired locations.

0 Kudos
Message 2 of 3
(4,453 Views)

Just noticed that there is also a "Resample (constant to variable)" in the same palette which appears to allow specification of variable dt.

0 Kudos
Message 3 of 3
(4,451 Views)