I have a lot of data files (testfft.dat) whit three columns like
trash | x | f(x)
100, 1, 0.129
100, 2, 0.198
etc.
where ',' is the separator. I was trying to do the Fast Fourier Transform over the f(x) column and then plot the spectrum vs. x. I was trying to do that following another answer but I can't get that working. More over, I just don't know python at all, I was doing the FFT with xmgrace but it isn't efficient.
I did the following (on ipython)
import numpy as np
import scipy as sy
import scipy.fftpack as syfp
array = np.loadtxt("testfft.dat")
but I get this error when I do the last line
ValueError Traceback (most recent call last)
<ipython-input-5-f42979d3ce2b> in <module>()
----> 1 array = np.loadtxt("testfft.dat")
~/.local/lib/python3.5/site-packages/numpy/lib/npyio.py in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin)
1022
1023 # Convert each value according to its column and store
-> 1024 items = [conv(val) for (conv, val) in zip(converters, vals)]
1025 # Then pack it according to the dtype's nesting
1026 items = pack_items(items, packing)
~/.local/lib/python3.5/site-packages/numpy/lib/npyio.py in <listcomp>(.0)
1022
1023 # Convert each value according to its column and store
-> 1024 items = [conv(val) for (conv, val) in zip(converters, vals)]
1025 # Then pack it according to the dtype's nesting
1026 items = pack_items(items, packing)
~/.local/lib/python3.5/site-packages/numpy/lib/npyio.py in floatconv(x)
723 if b'0x' in x:
724 return float.fromhex(asstr(x))
--> 725 return float(x)
726
727 typ = dtype.type
ValueError: could not convert string to float: b'10,'
As I don't really know Python, I don't know what to do from here.
Is there a way to modify the script from the answer to do what I need?
Thanks.