I was having troubles with iterating through a list in Python. For this I fiddled a little bit with making a numpy array iterable and came to the following (still not functional) stage:
import imp
import numpy as np
foo = imp.load_source('cvxeda', 'D:\\Python27\\Lib\\cvxEDA\\src\\cvxEDA.py')
tau = np.arange(2,4.1,0.1).tolist()
print tau
# for i, t in tau:
     # print t
     # [r[i], p[i], t[i], l[i], d[i], e[i], obj[i]] = foo.cvxEDA(data, 1./fs, t, 0.7, 10.0, 0.0008, 0.01)
Now this is where the strange things happen: the output of np.arange(2,4.1,0.1) is as expected:
[ 2.   2.1  2.2  2.3  2.4  2.5  2.6  2.7  2.8  2.9  3.   3.1  3.2  3.3  3.4
  3.5  3.6  3.7  3.8  3.9  4. ]
However, when I use print tau, the output is:
[2.0, 2.1, 2.2, 2.3000000000000003, 2.4000000000000004, 2.5000000000000004, 2.6000000000000005, 2.7000000000000006, 2.8000000000000007, 2.900000000000001, 3.000000000000001, 3.100000000000001, 3.200000000000001, 3.300000000000001, 3.4000000000000012, 3.5000000000000013, 3.6000000000000014, 3.7000000000000015, 3.8000000000000016, 3.9000000000000017, 4.000000000000002]
For some reason, tolist() changed the values of most of the values. How is this possible?
