LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FFTW on LabView

Hi everyone, I am in DESPERATE need to have the FFTW (The Fastest Fourier Transform on the West) to work in LabView. I have currently finished a big LabView program which reads and calculates the Refractive index of a material. Everything needs to be absolutely correct for up to 4 decimal points. I use the exacly same data and do the calculations in Python using the FFTW library and it does it correctly, but when I do the same thing in LabView I can only get it correct up to 2 decimal points.

I have tried searching for FFTW (DLL) or a vi that computes the calculations using FFTW but so far I havent found any. Does ANY ONE have a vi that uses FFTW in LabView because I only have less than 3 weeks to go to my deadline in University and I have to hand in the project. I would be most greatfull if anyone can help me in this field.

I checked but one of the threads in this forum suggested that a wrapper of some sort would need to be created in order to interface the LabView with the FFTW DLL. But honestly speaking I am not that great in text based programming and I wouldn't even know of where to start.

Any help would be appriciated.

Thank you in advanced
0 Kudos
Message 1 of 23
(6,958 Views)
Hello Q<UL.

I think there is a way to work around your problem if FFTW does not work in LV.

Go here:  http://sourceforge.net/projects/labpython/

Its a free Python node that can be used in Labview. That way you can run your pythonscript and make use of the FFTW that works.

Sorry I dont have a better solution but this one will probably work.

//Beckman
Message 2 of 23
(6,929 Views)
Thanks for introducing me to this LabPython. I think this might actually be the way forward, "BUT" there is something else in here.
The Python program that I was reffering to on the previous post was written by a person working at NPL (National Physics Laboratory) some time ago, and I cannot get into contact with him since he now left his job. The only thing I can do so far in his Python program is to run it, so I can see if my LabView gives me same results to his Python software. I do this by having the same input numbers in both cases. And when it comes to python this is as far as my knowledge goes, so I really have no Idea when it comes to programming in Python, and I also don't have a strong knowledge on other text based language neither.

I have attached a .ZIP file here that includes some vi's that use Python, and there is an example called "PYTHON Array Example.vi" and all this does is pass a 2D and a 1D array into the Python script and gives exactly the same values out of the Python script. Since the scripts that was written in Python can be seen inside the vi and all it does is pass the values from one side to another without doing any changes.

My problem is to build this bridge, i.e. to replace the current Python script that can be seen on the example vi (which does nothing) to a script that probably is even simpler, where all I need it to do is pass a 1D string Array that contains my readings to the FFTW and give me an output of 1D Double Precission Array. The output will definetly be Complex numbers since its going through FFTW. My 1D string Array does not have to be this type, I can certanly change it to whatever the FFTW requires as input, but I will only input 1 column of data and thats all.


Inside the ZIP a file named "FFTW_Interface" has all the FFTW interfacing utilities using Python whereas the other folder contains the LabPython vi's.

NOTE: Python Version 2.4 will need to be installed before running some of the Python scripts including the LabPython Example.

If someone can help me on this fiels I would GREATLY GREATLY appriciate it.

Thank you in advanced.

Message Edited by Q<UL on 01-31-2007 06:17 PM

0 Kudos
Message 3 of 23
(6,913 Views)


@you wrote:

Everything needs to be absolutely correct for up to 4 decimal points. I use the exacly same data and do the calculations in Python using the FFTW library and it does it correctly, but when I do the same thing in LabView I can only get it correct up to 2 decimal points.


OK, 4 decimal points does not mean anything, it depends on the values (10000000000 to a precision of four decimal digits is good, but 0.01 would be bad ;)).

Just curious:

  1. How many significant digits do you need?
  2. How do you know that fftw is more accurate than labVIEW fft?
  3. What is your LabVIEW version? FFTs received a significant makeover a few versions back.
0 Kudos
Message 4 of 23
(6,903 Views)
1. I need the answer to be correct to at least 4 d.p

2. Because I use FFTW through Python and I get the correct values, but when I do insert the exact input through LabView I get the answer   correct to only 2 d.p.

3. I use LabView 7.1. But I don't think that LabView version would matter since I'm only using the FFT function, which most LabView's would  have the same.

What I'm actually calculating is the values for the Dielectric Constant of a measured material. I have this machine called DFTS (Dispersive Fourier Transform Spectroscopy) that I retrieve the Information from (using LabView of course) and then I do the calculations based on those measurments. The answer should normally be correct to 5 significant figures, i.e. 3.4567 etc. which is why so important to get the preccision correct. When I test using the same data through Python I get the correct value but not through LabView. The reason I know that Python calculation are correct because the Dielectric constants for most of the materials is all published on the Internet, and Python calculations give me the same results, and so should the LabView.

The Python Software is very complicated to use when retrieving the information from DFTS machine because it hasn't got a GUI as the user interface, instead you have to make a lot of adjustment through the script where only a person that understands Python would know how to run it. So, I took this project on making a better user friendly software that the user doesn't have to be a programmer to use the machine. I have so far built the LabView code to get the information from the DFTS machine, and it runs nicely, but I am only strugling in this last piece, the calculations.

Message Edited by Q<UL on 01-31-2007 08:16 PM

0 Kudos
Message 5 of 23
(6,897 Views)
Here is the Test program that I use through LabView. PLEASE PLEASE don't mind about the code in the background because I was only trying to test the results through different ways and see id I got the same result. 

All you need to do is specify the path for two files "TPX.txt" and "ZPD.txt" that are provided within the ZIP folder and run the prgram. The answer will be displayed in all of the 6 Arrays. The other text file called "Python Results" are the results I get through Python. You should only look at the 6th column since thats the important one.

The anser I get in LabView is around 2.11 and 2.10, but for Python its different.
0 Kudos
Message 6 of 23
(6,891 Views)
You indicated that you had to finish in a relatively short time. One option might be to use LV to operate the instrument and acquire the raw data (which you apparently have working). Save the raw data to a file that Python can read. Then use the System Exec VI to call the FFTW in Python. It is not as clean as an all LabVIEW program but might be a workaround until you can do the whole thing.

Lynn
0 Kudos
Message 7 of 23
(6,890 Views)
Good call Lynn.

That's probably the easiest and fastest way to do it.

However, if you want you can get fftw as a dll at www.fftw.org/, but then you probably need a code interface to get the data-types right.

Imho this is the most elegant way.

Cheers

//Beckman
Message 8 of 23
(6,885 Views)
Hi Beckman,

thanks for the link to www.fftw.org!

After downloading 'fftw V3.1 for Windows' I tried to test the new 'Import Shared Library' feature of LabView8+ on this fftw-dll and sh** - it doesn't work on this dll...

Can someone at NI elaborate what's missing in the supplied .h-file for a correct conversion to LabView-vi's?

Message Edited by GerdW on 02-01-2007 10:12 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 23
(6,882 Views)

I never used the "System Exec VI" before. Would anyone know any tutorials I could go through when using it? or any other type of information that could help me getting started with this.

 

On the other hand I really thought that this LabPython could do the job, but I just don't know how to writte the script for my use. If anyone out there knows haw to use Python software and writes a small script for what I need then it would be great. Read my last post for more details or request for more information if needed.

 

Thank you everyone for trying to help me with this issue.

0 Kudos
Message 10 of 23
(6,856 Views)