2014-07-04 1 views
0

표시된 데이터를 보간하기 위해 here 클래스를 사용하려고합니다.scipy 보간 문제가 없습니다

이 클래스를 작동시키는 데 문제가 있습니다. 최소한의 예는 다음과 같습니다

#!/usr/bin/env python 
import sys 

from mayavi.mlab import * 
from mayavi import mlab 
from numpy import * 
import numpy as np 
from mayavi.scripts import mayavi2 
from mayavi.sources.vtk_file_reader import VTKFileReader 
from mayavi.modules.outline import Outline 
from mayavi.modules.grid_plane import GridPlane 
from mayavi.modules.contour_grid_plane import ContourGridPlane 
from mayavi.modules.iso_surface import IsoSurface 
from mayavi.modules.scalar_cut_plane import ScalarCutPlane 
import scipy 
from scipy import interpolate 
from scipy.interpolate import griddata 
#from scipy.interpolate import RegularGridInterpolator 



print 'Argument List:', str(sys.argv) 

if (len(sys.argv)==5): 
    NX = int(sys.argv[1]) 
    NY = int(sys.argv[2]) 
    NZ = int(sys.argv[3]) 
    fname = sys.argv[4] 
else: 
     print "Error in parsing the command line arguments" 
     print "Command line arguments are: N_X N_Y N_Z filename " 
     sys.exit() 

clf() 
figure(bgcolor=(1, 1, 1)) 
len(sys.argv) 

data = genfromtxt(fname) 
x,y,z = mgrid[ 0:NX:1, 0:NY:1, 0:NZ:1 ] 
#print(x) 
index = 0 

V=0*x 

for k in range(NZ): 
    for j in range(NY): 
     for i in range(NX): 
      V[i][j][k] = 1000*data[index,5] 

scipy.interpolate.RegularGridInterpolator(V, V, method='linear', bounds_error=True, fill_value=nan) #ERROR 

내 현재의 문제에 정말 관심의 유일한 비트

처음의 마지막 줄에 모든 가져 오기 명령입니다

내 오류는 다음과 같습니다

Traceback (most recent call last): 
File "contour-3d.py", line 70, in <module> 
scipy.interpolate.RegularGridInterpolator(W, W, method='linear', bounds_error=True, fill_value=nan) 
AttributeError: 'module' object has no attribute 'RegularGridInterpolator' 

I 파이썬에 익숙하지 않아서 아주 기본적인 오류 일 수 있습니다. 워드 프로세서

답변

1

scipy.interpolate.RegularGridInterpolator를 참조

sudo apt-get install gcc gfortran python-dev libblas-dev liblapack-dev cython 

자세한 내용은 scipy0.14.x의 새로운 기능입니다 . 이전 버전을 사용하고있을 가능성이 큽니다. scipy을 업데이트하면 문제가 해결됩니다.

관련 문제