python - Fit algorithm does not accept my data -
I am using an algorithm that decreases the Gaussian bell on my data.
If I have my data table with:
x = linspace (1., 100., 100) data = 17 * exp (- (x-10) / 3) ** 2) Everything works fine.
But if I read data from a text file using
file = open ("d: \\ test7" .txt ") arr = [] data = [] DEAF COLUMN (MATRIX, I): Row line (in the line [i] matrix in the file]. Lineline (): number = map (float, line split)) Arr.append (number) data = Column (arr, 300) x = linspace (1., 115., 115)
I get an error message:
Traceback (most recent In the last call): File "readmatrix.py", line 60, Fit (F, [ M, sigma, altitude, data) file "readmatrix.py", in line 42, in fits if x is none: x = arange (y.shape [0]) attribute: error: the 'list' object is not attribute ' As I can see, the values contained in the data are correct, it looks like: [0.108032, 0.86181600000000003, 1.386169, 3.2790530000000002, ...]
Is there any indication that what I am doing?
Thank you!
The fit function has a sharp edges of data (that is, a shape and ), And not a list (which is not), hence the attribute error.
def column (matrix, i): return numpy.asarray ([row [i] for line in matrix)
Comments
Post a Comment