aus lauter Frust wende ich mich nun an die Öffentlichkeit. Ich habe eine Routine InterpolateData geschrieben, welche die scipy-Methode interp1D aufruft.
Beim Debuggen erhalte ich von der Zeile "yval = float( YNew( xval ))" jedes Mal eine Fehlermeldung, die unten im Anhang steht.
Sichergestellt habe ich bereits, dass DataX und DataY wirklich Felder sind, welche die gleiche Anzahl von Einträgen besitzen und aus Fließkommazahlen bestehen.
Für einen Hinweis zur Klärung dieses Fehlers wäre ist sehr verbunden.
MfG.
Code: Alles auswählen
for nvar in range(len(DVariables)):
xPtr = int(IVariables[0])
yPtr = int(DVariables[nvar])
#
DataX = list()
DataY = list()
#
for i in range(len(VariablesIn[xPtr].Value)):
DataX.append(float(VariablesIn[xPtr].Value[i]))
DataY.append(float(VariablesIn[yPtr].Value[i]))
#
cSpline = InterpolateData( DataX, DataY, NPoints)
.....
def InterpolateData( DataX, DataY , NOfPoints):
x = linspace(float(DataX[0]), float(DataX[-1]), NOfPoints)
#
Num = len(DataY)
if (Num >= 4):
YNew = interp1d(DataX, DataY, kind = 'cubic')
else:
YNew = interp1d(DataX, DataY, kind = 'linear')
WarningMsg("InterpolateData", "Input-Datafield contains N=" + str(Num) +
"entries. Interpolation will be reduced to linear. For cubic interpolation at least 4 entries are required." )
#
cSpline = SplineXY()
#
for i in range(NOfPoints):
xval = float( x[i] )
yval = float( YNew( xval ))
#
cSpline.X.append(xval)
cSpline.Y.append(yval)
#
pass
#
return cSpline
Traceback (most recent call last):
File "C:\Program Files (x86)\pythonxy\eclipse\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\pydevd.py", line 1145, in <module>
debugger.run(setup['file'], None, None)
File "C:\Program Files (x86)\pythonxy\eclipse\plugins\org.python.pydev.debug_1.6.3.2010100513\pysrc\pydevd.py", line 916, in run
execfile(file, globals, locals) #execute the script
File "D:\02_Python\SmoothData\src\SmoothData.py", line 77, in <module>
retval2 = ComputeVariables(Type, VariablesIn, VariablesOut, IVariables, DVariables, CVariables, GlobalVarList, NPoints)
File "D:\02_Python\SmoothData\src\Methods.py", line 48, in ComputeVariables
cSpline = InterpolateData( DataX, DataY, NPoints)
File "D:\02_Python\SmoothData\src\Methods.py", line 24, in InterpolateData
yval = float( YNew( xval ))
File "C:\Python26\lib\site-packages\scipy\interpolate\interpolate.py", line 357, in __call__
out_of_bounds = self._check_bounds(x_new)
File "C:\Python26\lib\site-packages\scipy\interpolate\interpolate.py", line 415, in _check_bounds
raise ValueError("A value in x_new is above the interpolation "
ValueError: A value in x_new is above the interpolation range.