rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
artype = Float
artype = Num.Float
def bilinear(b,a,fs=1.0): a,b = map(r1array,(a,b)) D = len(a) - 1 N = len(b) - 1 artype = Float M = max([N,D]) Np = M Dp = M bprime = zeros(Np+1,artype) aprime = zeros(Dp+1,artype) for j in range(Np+1): val = 0.0 for i in range(N+1): for k in range(i+1): for l in range(M-i+1): if k+l == j: val += comb(i,k)*comb(M-i,l)*...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
bprime = zeros(Np+1,artype) aprime = zeros(Dp+1,artype)
bprime = Num.zeros(Np+1,artype) aprime = Num.zeros(Dp+1,artype)
def bilinear(b,a,fs=1.0): a,b = map(r1array,(a,b)) D = len(a) - 1 N = len(b) - 1 artype = Float M = max([N,D]) Np = M Dp = M bprime = zeros(Np+1,artype) aprime = zeros(Dp+1,artype) for j in range(Np+1): val = 0.0 for i in range(N+1): for k in range(i+1): for l in range(M-i+1): if k+l == j: val += comb(i,k)*comb(M-i,l)*...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
Wn = asarray(Wn)
Wn = Num.asarray(Wn)
def iirfilter(N, Wn, rp=None, rs=None, btype='band', analog=0, ftype='butter', output='ba'): """IIR digital and analog filter design given order and critical points. Description: Design an Nth order lowpass digital or analog filter and return the filter coefficients in (B,A) (numerator, denominator) or (Z,P,K) form. ...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
WN = zeros(2,Numeric.Float)
WN = Num.zeros(2,Numeric.Float)
def buttord(wp, ws, gpass, gstop, analog=0): """Butterworth filter order selection. Description: Return the order of the lowest order digital Butterworth filter that loses no more than gpass dB in the passband and has at least gstop dB attenuation in the stopband. Inputs: wp, ws -- Passb and stopb edge frequencies,...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
W0 = array([-W0, W0],Numeric.Float)
W0 = Num.array([-W0, W0],Numeric.Float)
def buttord(wp, ws, gpass, gstop, analog=0): """Butterworth filter order selection. Description: Return the order of the lowest order digital Butterworth filter that loses no more than gpass dB in the passband and has at least gstop dB attenuation in the stopband. Inputs: wp, ws -- Passb and stopb edge frequencies,...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
nat = zeros(2,Num.Float)
nat = Num.zeros(2,Num.Float)
def cheb2ord(wp, ws, gpass, gstop, analog=0): """Chebyshev type II filter order selection. Description: Return the order of the lowest order digital Chebyshev Type II filter that loses no more than gpass dB in the passband and has at least gstop dB attenuation in the stopband. Inputs: wp, ws -- Passb and stopb edge...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
nat = zeros(2,Num.Float)
nat = Num.zeros(2,Num.Float)
def cheb2ord(wp, ws, gpass, gstop, analog=0): """Chebyshev type II filter order selection. Description: Return the order of the lowest order digital Chebyshev Type II filter that loses no more than gpass dB in the passband and has at least gstop dB attenuation in the stopband. Inputs: wp, ws -- Passb and stopb edge...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
n = Num.concatenate((arange(1,N-1,2),arange(N+2,2*N,2)))
n = Num.concatenate((Num.arange(1,N-1,2),Num.arange(N+2,2*N,2)))
def cheb2ap(N,rs): """Return (z,p,k) zero, pole, gain for Nth order Chebyshev type II lowpass analog filter prototype with rs decibels of ripple in the stopband. """ de = 1.0/sqrt(10**(0.1*rs)-1) mu = arcsinh(1.0/de)/N if N % 2: m = N - 1 n = Num.concatenate((arange(1,N-1,2),arange(N+2,2*N,2))) else: m = N n = arange(...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
n = arange(1,2*N,2)
n = Num.arange(1,2*N,2)
def cheb2ap(N,rs): """Return (z,p,k) zero, pole, gain for Nth order Chebyshev type II lowpass analog filter prototype with rs decibels of ripple in the stopband. """ de = 1.0/sqrt(10**(0.1*rs)-1) mu = arcsinh(1.0/de)/N if N % 2: m = N - 1 n = Num.concatenate((arange(1,N-1,2),arange(N+2,2*N,2))) else: m = N n = arange(...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
p = exp(1j*(pi*arange(1,2*N,2)/(2.0*N) + pi/2.0))
p = exp(1j*(pi*Num.arange(1,2*N,2)/(2.0*N) + pi/2.0))
def cheb2ap(N,rs): """Return (z,p,k) zero, pole, gain for Nth order Chebyshev type II lowpass analog filter prototype with rs decibels of ripple in the stopband. """ de = 1.0/sqrt(10**(0.1*rs)-1) mu = arcsinh(1.0/de)/N if N % 2: m = N - 1 n = Num.concatenate((arange(1,N-1,2),arange(N+2,2*N,2))) else: m = N n = arange(...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
j = arange(1-N%2,N,2)
j = Num.arange(1-N%2,N,2)
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down. Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, k eps = Num.sqrt(10**(0.1...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
[s,c,d,phi] = special.ellpj(j*capk/N,m*ones(jj))
[s,c,d,phi] = special.ellpj(j*capk/N,m*Num.ones(jj))
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down. Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, k eps = Num.sqrt(10**(0.1...
78dbcc11384c4361dd850305b138d97d4c6ff715 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/78dbcc11384c4361dd850305b138d97d4c6ff715/filter_design.py
property_object.__init__(self,attr)
property_object.__init__(self, attr)
def __init__(self, parent, id = -1, pos=wx.wxPyDefaultPosition, size=wx.wxPyDefaultSize,**attr): wx.wxWindow.__init__(self, parent, id, pos,size) wx.EVT_PAINT(self,self.OnPaint) property_object.__init__(self,attr) background = wx.wxNamedColour(self.background_color) self.SetBackgroundColour(background) #self.SetBackgro...
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
def __init__(self, parent, id = -1, pos=wx.wxPyDefaultPosition, size=wx.wxPyDefaultSize,**attr): wx.wxWindow.__init__(self, parent, id, pos,size) wx.EVT_PAINT(self,self.OnPaint) property_object.__init__(self,attr) background = wx.wxNamedColour(self.background_color) self.SetBackgroundColour(background) #self.SetBackgro...
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
min_point = array((-1.,-1),) max_point = array((1.,1))
min_point = array((-1.,-1.),) max_point = array((1.,1.))
def layout_graph(self,graph_area,dc): self.axes = [] #data_x_bounds,data_y_bounds = [0,6.28], [-1.1,1000] #jeez this is unwieldy code... smalls = []; bigs =[] if len(self.line_list): p1,p2 = self.line_list.bounding_box() smalls.append(p1);bigs.append(p2) if len(self.image_list): p1,p2 = self.image_list.bounding_box()...
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
x_scale = graph_area.width() / self.x_axis.range() y_scale = graph_area.height() / self.y_axis.range()
x_scale = float(graph_area.width()) / self.x_axis.range() y_scale = float(graph_area.height()) / self.y_axis.range()
def layout_graph(self,graph_area,dc): self.axes = [] #data_x_bounds,data_y_bounds = [0,6.28], [-1.1,1000] #jeez this is unwieldy code... smalls = []; bigs =[] if len(self.line_list): p1,p2 = self.line_list.bounding_box() smalls.append(p1);bigs.append(p2) if len(self.image_list): p1,p2 = self.image_list.bounding_box()...
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
gb.width()+1,gb.height()+1)
gb.width()+1,gb.height()+1)
def draw_graph_area(self,dc=None): if not dc: dc = wx.wxClientDC(self) self.layout_data() # just to check how real time plot would go...
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
if not dc: dc = wx.wxClientDC(self)
if not dc: dc = wx.wxClientDC(self)
def draw(self,dc=None): #if not len(self.line_list) or len(self.image_list): # return # resize if necessary #print 'draw'
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
axis.draw_labels(dc)
axis.draw_labels(dc)
def draw(self,dc=None): #if not len(self.line_list) or len(self.image_list): # return # resize if necessary #print 'draw'
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
scales = print_box.size() / graph_box.size()
scales = array(print_box.size(), Float)/graph_box.size()
def OnPrintPage(self, page): dc = self.GetDC()
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
menu.Append(204, '&Print Preview', 'Preview the current plot')
menu.Append(204, 'Print Pre&view', 'Preview the current plot')
def __init__(self, parent=wx.NULL, id = -1, title = '', pos=wx.wxPyDefaultPosition, size=default_size,visible=1): wx.wxFrame.__init__(self, parent, id, title,pos,size)
df79b98c303a560c1ce3becb40a1d8ef0365b9f5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df79b98c303a560c1ce3becb40a1d8ef0365b9f5/wxplt.py
points = atleast_2d(points).astype(self.dataset.typecode())
points = atleast_2d(points).astype(self.dataset.dtype)
def evaluate(self, points): """Evaluate the estimated pdf on a set of points.
4170c932f8da971f1fe2ac7cfb4d00a930fa5a41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4170c932f8da971f1fe2ac7cfb4d00a930fa5a41/kde.py
def xlabel(self,t):
def xtitle(self,t):
def xlabel(self,t): cmd = 'set xlabel "' + t + '"' self._replot(cmd)
6a704f0bcf83e352f39dea8e27e6094efb896ef0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6a704f0bcf83e352f39dea8e27e6094efb896ef0/pyPlot.py
def ylabel(self,t):
def ytitle(self,t):
def ylabel(self,t): cmd = 'set ylabel "' + t + '"' self._replot(cmd)
6a704f0bcf83e352f39dea8e27e6094efb896ef0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6a704f0bcf83e352f39dea8e27e6094efb896ef0/pyPlot.py
def zlabel(self,t):
def ztitle(self,t):
def zlabel(self,t): cmd = 'set zlabel "' + t + '"' self._replot(cmd)
6a704f0bcf83e352f39dea8e27e6094efb896ef0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6a704f0bcf83e352f39dea8e27e6094efb896ef0/pyPlot.py
tic = tics * 10.0**fl; results = [0,0,0]
tic = tics * 10.0**fl; results = [0,0,0]
def _figure_rtics(self,minval,maxval,guess=20): xr = abs(maxval-minval) l10 = log10(xr) fl = floor(l10) xnorm = 10**(l10-fl) #you can change the value of 5 # to something if you want more tics... posns = guess / xnorm if (posns > 40): tics = 0.05 # eg 0, .05, .10, ... if (posns > 20): tics = 0.1 # eg 0, .1, ....
6a704f0bcf83e352f39dea8e27e6094efb896ef0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6a704f0bcf83e352f39dea8e27e6094efb896ef0/pyPlot.py
def __init__(self, val): UserList.UserList.__init__(self, val)
def __init__(self, val): if type(val) is types.TupleType: self.data = list(val) else: self.data = val
def __init__(self, val): UserList.UserList.__init__(self, val)
a32d3b9f09e96b868d5c5054a19456f251ebff35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a32d3b9f09e96b868d5c5054a19456f251ebff35/gui_thread_guts.py
UserDict.UserDict.__init__(self, val)
self.data = val
def __init__(self, val): UserDict.UserDict.__init__(self, val)
a32d3b9f09e96b868d5c5054a19456f251ebff35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a32d3b9f09e96b868d5c5054a19456f251ebff35/gui_thread_guts.py
execfile('../saved_values.py')
exec(open(save_file).read())
def configuration(parent_package=''): """ gist only works with an X-windows server This will install *.gs and *.gp files to '%spython%s/site-packages/scipy/xplt' % (sys.prefix,sys.version[:3]) """ # Check for X11 libraries try: execfile('../saved_values.py') try: X11 = X11 except NameError: X11 = check_and_save() excep...
fbd6e473d4f8f9c7b55de975abd44d97328b5700 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/fbd6e473d4f8f9c7b55de975abd44d97328b5700/setup_xplt.py
obj = self.wx_obj return apply(smart_call, (setattr, obj, key, val))
if self.__dict__.has_key(key): self.__dict__[key] = val else: obj = self.wx_obj return apply(smart_call, (setattr, obj, key, val))
def __setattr__(self,key,val):
6e974aafc67ed22d1b09f2f952d86652b111b648 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6e974aafc67ed22d1b09f2f952d86652b111b648/gui_thread_guts.py
ftype = data.typecode() if ftype not in ['d','D','f','F']: data = data*1.0 ftype = 'd' return ftype, nnz, data, colind, row_ptr
ptype = data.typecode() if ptype not in ['d','D','f','F']: data = data.astype('d') ptype = 'd' return _transtabl[ptype], nnz, data, colind, row_ptr
def getCSR(self): # Return Compressed Sparse Row format arrays for this matrix keys = self.keys() keys.sort() nnz = len(keys) data = [None]*nnz colind = [None]*nnz row_ptr = [None]*(self.shape[0]+1) current_row = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey0 != current_row: current_row = ik...
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
ftype = data.typecode() if ftype not in ['d','D','f','F']: data = data*1.0 ftype = 'd' return ftype, nnz, data, rowind, col_ptr
ptype = data.typecode() if ptype not in ['d','D','f','F']: data = data.astype('d') ptype = 'd' return _transtabl[ptype], nnz, data, rowind, col_ptr
def getCSC(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz rowind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: curren...
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
def dense(self,typecode=None): if typecode is None: typecode = self.type if typecode is None: typecode = 'd' new = zeros(self.shape,typecode) for key in self.keys(): ikey0 = int(key[0]) ikey1 = int(key[1]) new[ikey0,ikey1] = self[key] return new
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
if type(s) in [types.ListType, ArrayType]:
if isinstance(s, dictmatrix): ftype, nnz, data, index0, index1 = s.getCSR() self.ftype = ftype self.ptype = _itranstabl[ftype] self.lastel = nnz-1 self.data = data self.index = [index0+1, index1+1] M, N = s.shape nzmax = nnz elif type(s) in [types.ListType, ArrayType]:
def __init__(self,s,i=None,j=None,M=None,N=None,nzmax=None, typecode=Float): if type(s) in [types.ListType, ArrayType]: s = array(s,copy=0,typecode=typecode) if s.typecode() not in 'fdFD': # only support these 4 types. s = s.astype('d') sz = len(s) i = array(i,typecode='l',copy=0) j = array(j,typecode='l',copy=0) if n...
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
return A.ftype, A.lastel+1, A.data, A.index[0]-1, A.index[1]-1
return self.ftype, self.lastel+1, self.data, self.index[0]-1, self.index[1]-1
def getCSR(self): return A.ftype, A.lastel+1, A.data, A.index[0]-1, A.index[1]-1
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
B = A.transp()
B = self.transp()
def getCSC(self): B = A.transp() return B.ftype, B.lastel+1, B.data, B.index[0]-1, B.index[1]-1
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
gssv = eval('_superlu.' + _transtabl[ftype] + 'gssv')
gssv = eval('_superlu.' + ftype + 'gssv')
def solve(A,b,permc_spec=2): if not hasattr(A, 'getCSR') and not hasattr(A, 'getCSC'): raise ValueError, "Sparse matrix must be able to return CSC format--"\ "A.getCSC()--or CSR format--A.getCSR()" if not hasattr(A,'shape'): raise ValueError, "Sparse matrix must be able to return shape (rows,cols) = A.shape" if hasattr...
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf')
gstrf = eval('_superlu.' + ftype + 'gstrf')
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): ftype, nnz, data, rowind, colptr = A.getCSC() M,N = A.shape gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf') return gstrf(M,N,nnz,data,rowind,colptr,permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size)
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
x = splinsolve(a,b)
x = solve(a,b)
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): ftype, nnz, data, rowind, colptr = A.getCSC() M,N = A.shape gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf') return gstrf(M,N,nnz,data,rowind,colptr,permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size)
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
x = splinsolve(a,b)
x = solve(a,b)
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): ftype, nnz, data, rowind, colptr = A.getCSC() M,N = A.shape gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf') return gstrf(M,N,nnz,data,rowind,colptr,permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size)
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
x = splinsolve(a,b)
x = solve(a,b)
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): ftype, nnz, data, rowind, colptr = A.getCSC() M,N = A.shape gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf') return gstrf(M,N,nnz,data,rowind,colptr,permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size)
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
x = splinsolve(a,b.astype('f'))
x = solve(a,b.astype('f'))
def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): ftype, nnz, data, rowind, colptr = A.getCSC() M,N = A.shape gstrf = eval('_superlu.' + _transtabl[ftype] + 'gstrf') return gstrf(M,N,nnz,data,rowind,colptr,permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size)
7ac5837240f39d681a1090b6bff65737b05da719 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7ac5837240f39d681a1090b6bff65737b05da719/Sparse.py
raise RunTimeError, "should never have nnz > nzmax"
raise RuntimeError, "should never have nnz > nzmax"
def prune(self): """ Remove empty space after all non-zero elements. """ nnz = self.indptr[-1] if self.nzmax <= nnz: if self.nzmax < nnz: raise RunTimeError, "should never have nnz > nzmax" return self.nnz = nnz self.data = self.data[:nnz] self.rowind = self.rowind[:nnz] self.nzmax = nnz self._check()
7270a9021508eec44f178fc2ded755fdefa8d64b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7270a9021508eec44f178fc2ded755fdefa8d64b/sparse.py
raise RunTimeError, "should never have nnz > nzmax"
raise RuntimeError, "should never have nnz > nzmax"
def prune(self): """ Eliminate non-zero entries, leaving space for at least newnzmax elements. """ nnz = self.indptr[-1] if self.nzmax <= nnz: if self.nzmax < nnz: raise RunTimeError, "should never have nnz > nzmax" return self.data = self.data[:nnz] self.colind = self.colind[:nnz] self.nzmax = nnz self._check()
7270a9021508eec44f178fc2ded755fdefa8d64b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7270a9021508eec44f178fc2ded755fdefa8d64b/sparse.py
define_macros.append(('round','cephes_round'))
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('special', parent_package, top_path) define_macros = []
73aca75650cd9b1f0f175d6f9e68d76216c1bc7f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/73aca75650cd9b1f0f175d6f9e68d76216c1bc7f/setup.py
def eig(a,b=None,left=0,right=1,overwrite_a=0,overwrite_b=0):
def eig(a,b=None, left=False, right=True, overwrite_a=False, overwrite_b=False):
def eig(a,b=None,left=0,right=1,overwrite_a=0,overwrite_b=0): """ Solve ordinary and generalized eigenvalue problem of a square matrix. Inputs: a -- An N x N matrix. b -- An N x N matrix [default is identity(N)]. left -- Return left eigenvectors [disabled]. right -- Return right eigenvectors [enabled]. Outp...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
w -- eigenvalues [left==right==0]. w,vr -- w and right eigenvectors [left==0,right=1]. w,vl -- w and left eigenvectors [left==1,right==0]. w,vl,vr -- [left==right==1].
w -- eigenvalues [left==right==False]. w,vr -- w and right eigenvectors [left==False,right=True]. w,vl -- w and left eigenvectors [left==True,right==False]. w,vl,vr -- [left==right==True].
def eig(a,b=None,left=0,right=1,overwrite_a=0,overwrite_b=0): """ Solve ordinary and generalized eigenvalue problem of a square matrix. Inputs: a -- An N x N matrix. b -- An N x N matrix [default is identity(N)]. left -- Return left eigenvectors [disabled]. right -- Return right eigenvectors [enabled]. Outp...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0):
def eigh(a, lower=True, eigvals_only=False, overwrite_a=False):
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U']
lower -- values in a are read from lower triangle [True: UPLO='L' (default) / False: UPLO='U']
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
w,v -- w: eigenvalues, v: eigenvectors [for eigvals_only == False] w -- eigenvalues [for eigvals_only == True (default)].
For eigvals_only == False (the default), w,v -- w: eigenvalues, v: eigenvectors For eigvals_only == True, w -- eigenvalues
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
a1 = asarray_chkfinite(a) overwrite_a = overwrite_a or (_datanotshared(a1,a))
a1 = asarray_chkfinite(a) overwrite_a = overwrite_a or (_datanotshared(a1,a))
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
a1 = array(a)
a1 = array(a)
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
raise ValueError, "array must not contain infs or NaNs" overwrite_a = 1
raise ValueError, "array must not contain infs or NaNs" overwrite_a = 1
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
heev, = get_lapack_funcs(('heev',),(a1,))
heev, = get_lapack_funcs(('heev',),(a1,))
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
lwork = calc_lwork.heev(heev.prefix,a1.shape[0],lower) w,v,info = heev(a1,lwork = lwork, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a) else: w,v,info = heev(a1, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a)
lwork = calc_lwork.heev(heev.prefix,a1.shape[0],lower) w,v,info = heev(a1,lwork = lwork, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a) else: w,v,info = heev(a1, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a)
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
'illegal value in %-th argument of internal heev'%(-info)
'illegal value in %-th argument of internal heev'%(-info)
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
syev, = get_lapack_funcs(('syev',),(a1,))
syev, = get_lapack_funcs(('syev',),(a1,))
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
lwork = calc_lwork.syev(syev.prefix,a1.shape[0],lower) w,v,info = syev(a1,lwork = lwork, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a) else: w,v,info = syev(a1, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a)
lwork = calc_lwork.syev(syev.prefix,a1.shape[0],lower) w,v,info = syev(a1,lwork = lwork, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a) else: w,v,info = syev(a1, compute_v = not eigvals_only, lower = lower, overwrite_a = overwrite_a)
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
'illegal value in %-th argument of internal syev'%(-info)
'illegal value in %-th argument of internal syev'%(-info)
def eigh(a,lower=1,eigvals_only=0,overwrite_a=0): """ Solve real symmetric or complex hermitian eigenvalue problem. Inputs: a -- A hermitian N x N matrix. lower -- values in a are read from lower triangle [1: UPLO='L' (default) / 0: UPLO='U'] eigvals_only -- don't compute eigenvectors. overwrite_a ...
cd400c1c2f5100b19fcf298f15e60d171a9932cb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cd400c1c2f5100b19fcf298f15e60d171a9932cb/decomp.py
A = Numeric.abs(A)
A = abs(A)
def matview(A,cmax=None,cmin=None,palette=None,color='black'): """Plot an image of a matrix. """ A = Numeric.asarray(A) if A.typecode() in ['D','F']: print "Warning: complex array given, plotting magnitude." A = Numeric.abs(A) M,N = A.shape A = A[::-1,:] if cmax is None: cmax = max(ravel(A)) if cmin is None: cmin = min...
7a24404a5c2b90b90712f31c78b1e9a4f2c6dbb6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7a24404a5c2b90b90712f31c78b1e9a4f2c6dbb6/Mplot.py
weave_timer = timeit.Timer('blitz("result=%s")' % expr, setup) weave_time = weave_timer.timeit(number=iterations) print "Weave:", weave_time/iterations print "Speed-up of weave over numpy:", numpy_time/weave_time
try: weave_timer = timeit.Timer('blitz("result=%s")' % expr, setup) weave_time = weave_timer.timeit(number=iterations) print "Weave:", weave_time/iterations print "Speed-up of weave over numpy:", numpy_time/weave_time except: print "Skipping weave timing"
def compare_times(setup, expr): print "Expression:", expr numpy_timer = timeit.Timer(expr, setup) numpy_time = numpy_timer.timeit(number=iterations) print 'numpy:', numpy_time / iterations weave_timer = timeit.Timer('blitz("result=%s")' % expr, setup) weave_time = weave_timer.timeit(number=iterations) print "Weave:",...
cef8bae794a542d130ab84a2c6b7ef5ba68e8ada /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cef8bae794a542d130ab84a2c6b7ef5ba68e8ada/timing.py
from scipy.weave import blitz
try: from scipy.weave import blitz except: pass
def compare_times(setup, expr): print "Expression:", expr numpy_timer = timeit.Timer(expr, setup) numpy_time = numpy_timer.timeit(number=iterations) print 'numpy:', numpy_time / iterations weave_timer = timeit.Timer('blitz("result=%s")' % expr, setup) weave_time = weave_timer.timeit(number=iterations) print "Weave:",...
cef8bae794a542d130ab84a2c6b7ef5ba68e8ada /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cef8bae794a542d130ab84a2c6b7ef5ba68e8ada/timing.py
from scipy.weave import blitz
try: from scipy.weave import blitz except: pass
def compare_times(setup, expr): print "Expression:", expr numpy_timer = timeit.Timer(expr, setup) numpy_time = numpy_timer.timeit(number=iterations) print 'numpy:', numpy_time / iterations weave_timer = timeit.Timer('blitz("result=%s")' % expr, setup) weave_time = weave_timer.timeit(number=iterations) print "Weave:",...
cef8bae794a542d130ab84a2c6b7ef5ba68e8ada /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/cef8bae794a542d130ab84a2c6b7ef5ba68e8ada/timing.py
if not alltrue(eval(expr) == evaluate(expr)):
npval = eval(expr) neval = evaluate(expr) if not (shape(npval) == shape(neval) and alltrue(ravel(npval) == ravel(neval))):
def check(expr): try: if not alltrue(eval(expr) == evaluate(expr)): print ">>> %s: FAILED" % expr print " GOT :", evaluate(expr)[:3], "..." print " EXPECTED :", eval(expr)[:3], "..." return False else: print " %s" % expr#, evaluate(expr)[:3], "..." return True except StandardError, err: print ">>> %s: ERROR(%...
fcab26279a671a2bbf0f2b68455bc55928a43303 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/fcab26279a671a2bbf0f2b68455bc55928a43303/test.py
print " GOT :", evaluate(expr)[:3], "..." print " EXPECTED :", eval(expr)[:3], "..."
print " GOT :", neval[:3], "..." print " EXPECTED :", npval[:3], "..."
def check(expr): try: if not alltrue(eval(expr) == evaluate(expr)): print ">>> %s: FAILED" % expr print " GOT :", evaluate(expr)[:3], "..." print " EXPECTED :", eval(expr)[:3], "..." return False else: print " %s" % expr#, evaluate(expr)[:3], "..." return True except StandardError, err: print ">>> %s: ERROR(%...
fcab26279a671a2bbf0f2b68455bc55928a43303 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/fcab26279a671a2bbf0f2b68455bc55928a43303/test.py
def fixed_point(func, x0, args=(), tol=1e-10, maxiter=50):
def fixed_point(func, x0, args=(), xtol=1e-10, maxiter=500):
def fixed_point(func, x0, args=(), tol=1e-10, maxiter=50): """Given a function of one variable and a starting point, find a fixed-point of the function: i.e. where func(x)=x. """ p0 = x0 for iter in range(maxiter): p1 = apply(func,(p0,)+args) p2 = apply(func,(p1,)+args) try: p = p0 - (p1 - p0)*(p1-p0) / (p2-2.0*p1+p0)...
b1d59676a0c53bba678533d6bdf76ee7aa79be6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1d59676a0c53bba678533d6bdf76ee7aa79be6c/minpack.py
print "Difference in estimates is %g" % (abs(p2-p1))
print "Warning: Difference in estimates is %g" % (abs(p2-p1))
def fixed_point(func, x0, args=(), tol=1e-10, maxiter=50): """Given a function of one variable and a starting point, find a fixed-point of the function: i.e. where func(x)=x. """ p0 = x0 for iter in range(maxiter): p1 = apply(func,(p0,)+args) p2 = apply(func,(p1,)+args) try: p = p0 - (p1 - p0)*(p1-p0) / (p2-2.0*p1+p0)...
b1d59676a0c53bba678533d6bdf76ee7aa79be6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1d59676a0c53bba678533d6bdf76ee7aa79be6c/minpack.py
if abs(p-p0) < tol:
if abs(p-p0) < xtol:
def fixed_point(func, x0, args=(), tol=1e-10, maxiter=50): """Given a function of one variable and a starting point, find a fixed-point of the function: i.e. where func(x)=x. """ p0 = x0 for iter in range(maxiter): p1 = apply(func,(p0,)+args) p2 = apply(func,(p1,)+args) try: p = p0 - (p1 - p0)*(p1-p0) / (p2-2.0*p1+p0)...
b1d59676a0c53bba678533d6bdf76ee7aa79be6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1d59676a0c53bba678533d6bdf76ee7aa79be6c/minpack.py
def bisection(func, a, b, args=(), tol=1e-10, maxiter=100):
def bisection(func, a, b, args=(), xtol=1e-10, maxiter=400):
def fixed_point(func, x0, args=(), tol=1e-10, maxiter=50): """Given a function of one variable and a starting point, find a fixed-point of the function: i.e. where func(x)=x. """ p0 = x0 for iter in range(maxiter): p1 = apply(func,(p0,)+args) p2 = apply(func,(p1,)+args) try: p = p0 - (p1 - p0)*(p1-p0) / (p2-2.0*p1+p0)...
b1d59676a0c53bba678533d6bdf76ee7aa79be6c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b1d59676a0c53bba678533d6bdf76ee7aa79be6c/minpack.py
def draw(self,dc=None): #if not len(self.line_list) or len(self.image_list): # return # resize if necessary #print 'draw' t1 = time.clock();self.reset_size(dc);t2 = time.clock() #print 'resize:',t2 - t1 if not dc: dc = wx.wxClientDC(self)
30d9514f30dd67adee810a4f5c643dba8a41d06f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/30d9514f30dd67adee810a4f5c643dba8a41d06f/wxplt.py
def update(self):
def update(self,event=None):
def update(self): self.client_size = (0,0) # forces the layout self.Refresh()
30d9514f30dd67adee810a4f5c643dba8a41d06f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/30d9514f30dd67adee810a4f5c643dba8a41d06f/wxplt.py
maxfun = max(1000, 100*len(x0))
maxfun = max(1000, 100*len(x0))
def func_and_grad(x): x = asarray(x) f = func(x, *args) g = fprime(x, *args) return f, list(g)
d15726ceeb983ee315adcb6a1eb566962f7850fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d15726ceeb983ee315adcb6a1eb566962f7850fc/tnc.py
else: if (type(which_one) == type(1)) or (type(which_one) == type(1.)): try: _active = _figure[int(which_one)] except IndexError: msg = "There are currently only %d active figures" % len(_figure) raise IndexError, msg return current()
elif (type(which_one) == type(1)) or (type(which_one) == type(1.)): try: _active = _figure[int(which_one)] _active.Raise() except IndexError: msg = "There are currently only %d active figures" % len(_figure) raise IndexError, msg elif which_one in _figure: _active = which_one _active.Raise() else: raise ValueError, "Th...
def figure(which_one = None): global _figure; global _active if which_one == None: title ='Figure %d' % len(_figure) _figure.append(plot_class(title=title)) _active = _figure[-1] else: if (type(which_one) == type(1)) or (type(which_one) == type(1.)): try: _active = _figure[int(which_one)] except IndexError: msg = "Ther...
bf7cd4493d319dc4bdf2d964a5d182a39340bc20 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bf7cd4493d319dc4bdf2d964a5d182a39340bc20/interface.py
((tdtsz < rdtsz) and not ok_T))
((tdtsz <= rdtsz) and not ok_T))
def test_smallest_same_kind(self): R = self.recaster value = 1 # smallest same kind # Define expected type output from same kind downcast of value required_types = {'complex': N.complex128, 'float': N.float64, 'int': N.int32, 'uint': None} for kind, req_type in required_types.items(): if req_type is not None: rdtsz = N...
f8a6c4339fbc7a901e79b6b517f6faddafa34a4e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/f8a6c4339fbc7a901e79b6b517f6faddafa34a4e/test_recaster.py
return where(cond, special.bdtr(k,n,pr)-special.bdtr(k-1,n,pr), 0.0)
sv =errp(0) temp = special.bdtr(k,n,pr) temp2 = special.bdtr(k-1,n,pr) sv = errp(sv) return select([cond,k==0], [temp-temp2,temp],0.0)
def binompdf(k, n, pr=0.5): k = arr(k) assert (0<pr<1) cond = arr((k > 0) & (k == floor(k))) return where(cond, special.bdtr(k,n,pr)-special.bdtr(k-1,n,pr), 0.0)
aed8df05a6a372ef881099180d71354da959d7cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/aed8df05a6a372ef881099180d71354da959d7cc/distributions.py
W0 = nat / ( ( 10**(0.1*abs(gstop))-1)**(1.0/(2.0*or)))
W0 = nat / ( ( 10**(0.1*abs(gstop))-1)**(1.0/(2.0*ord)))
def buttord(wp, ws, gpass, gstop, analog=0): """Butterworth filter order selection. Description: Return the order of the lowest order digital Butterworth filter that loses no more than gpass dB in the passband and has at least gstop dB attenuation in the stopband. Inputs: wp, ws -- Passb and stopb edge frequencies,...
b3f9da60a7e6e906a0c30af8d3bedb2ea37ffa8b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b3f9da60a7e6e906a0c30af8d3bedb2ea37ffa8b/filter_design.py
def mathieu_odd_coef(m,q): """Compute expansion coefficients for even mathieu functions and modified mathieu functions. """ if not (isscalar(m) and isscalar(q)): raise ValueError, "m and q must be scalars." if (q < 0): raise ValueError, "q >=0" if (m != floor(m)) or (m<=0): raise ValueError, "m must be an integer > 0" ...
06b9fd0434a7a788ef62ac0ef0ecaf3052229617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/06b9fd0434a7a788ef62ac0ef0ecaf3052229617/basic.py
if not isscalar(m) or (m<0): raise ValueError, "m must be a non-negative integer."
if not isscalar(m) or (abs(m)>n): raise ValueError, "m must be <= n."
def lpmn(m,n,z): """Associated Legendre functions of the second kind, Pmn(z) and its derivative, Pmn'(z) of order m and degree n. Returns two arrays of size (m+1,n+1) containing Pmn(z) and Pmn'(z) for all orders from 0..m and degrees from 0..n. z can be complex. """ if not isscalar(m) or (m<0): raise ValueError, "m m...
06b9fd0434a7a788ef62ac0ef0ecaf3052229617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/06b9fd0434a7a788ef62ac0ef0ecaf3052229617/basic.py
p,pd = specfun.clpmn(m,n,z)
p,pd = specfun.clpmn(mp,n,real(z),imag(z))
def lpmn(m,n,z): """Associated Legendre functions of the second kind, Pmn(z) and its derivative, Pmn'(z) of order m and degree n. Returns two arrays of size (m+1,n+1) containing Pmn(z) and Pmn'(z) for all orders from 0..m and degrees from 0..n. z can be complex. """ if not isscalar(m) or (m<0): raise ValueError, "m m...
06b9fd0434a7a788ef62ac0ef0ecaf3052229617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/06b9fd0434a7a788ef62ac0ef0ecaf3052229617/basic.py
p,pd = specfun.lpmn(m,n,z)
p,pd = specfun.lpmn(mp,n,z) if (m < 0): p = p * fixarr pd = pd * fixarr
def lpmn(m,n,z): """Associated Legendre functions of the second kind, Pmn(z) and its derivative, Pmn'(z) of order m and degree n. Returns two arrays of size (m+1,n+1) containing Pmn(z) and Pmn'(z) for all orders from 0..m and degrees from 0..n. z can be complex. """ if not isscalar(m) or (m<0): raise ValueError, "m m...
06b9fd0434a7a788ef62ac0ef0ecaf3052229617 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/06b9fd0434a7a788ef62ac0ef0ecaf3052229617/basic.py
if val not in [0,1,2]:
if mode not in [0,1,2]:
def _valfrommode(mode): try: val = _modedict[mode] except KeyError: if val not in [0,1,2]: raise ValueError, "Acceptable mode flags are 'valid' (0), 'same' (1), or 'full' (2)." val = mode return val
fad9e702a0226be5895a44619f1b64a3c70f1c6f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/fad9e702a0226be5895a44619f1b64a3c70f1c6f/signaltools.py
self.squeeze_me = squeeze_me self.chars_as_strings = chars_as_strings
self._squeeze_me = squeeze_me self._chars_as_strings = chars_as_strings
def __init__(self, mat_stream, byte_order=None, base_name='raw', matlab_compatible=False, squeeze_me=True, chars_as_strings=True, ): # Initialize stream self.mat_stream = mat_stream self.dtypes = {} if not byte_order: byte_order = self.guess_byte_order() self.order_code = byte_order # sets dtypes and other things too s...
5fa24f4a2989d3e4542207a96d574cb965ab5f43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5fa24f4a2989d3e4542207a96d574cb965ab5f43/miobase.py
def set_matlab_compatible(self, matlab_compatible): self._matlab_compatible = matlab_compatible if matlab_compatible: self.squeeze_me = False self.char_as_strings = False
def set_matlab_compatible(self, m_l_c): self._matlab_compatible = m_l_c if m_l_c: self._squeeze_me = False self._chars_as_strings = False
def set_matlab_compatible(self, matlab_compatible): self._matlab_compatible = matlab_compatible if matlab_compatible: self.squeeze_me = False self.char_as_strings = False self.processor_func = self.get_processor_func()
5fa24f4a2989d3e4542207a96d574cb965ab5f43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5fa24f4a2989d3e4542207a96d574cb965ab5f43/miobase.py
if getter.mat_dtype:
if getter.mat_dtype is not None:
def func(arr, getter): if arr.dtype.kind == 'U' and self.chars_as_strings: # Convert char array to string or array of strings dims = arr.shape if len(dims) >= 2: # return array of strings dtt = self.order_code + 'U' n_dims = dims[:-1] str_arr = reshape(arr, (small_product(n_dims), dims[-1])) arr = empty(n_dims, dtype=o...
5fa24f4a2989d3e4542207a96d574cb965ab5f43 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5fa24f4a2989d3e4542207a96d574cb965ab5f43/miobase.py
def all_subroutines(interface_in): # remove comments comment_block_exp = re.compile(r'/\*(?:\s|.)*?\*/') subroutine_exp = re.compile(r'subroutine (?:\s|.)*?end subroutine.*') function_exp = re.compile(r'function (?:\s|.)*?end function.*') interface = comment_block_exp.sub('',interface_in) subroutine_list = subroutine_...
28961a6eddd6e6679b5191e026fcffd4205756d1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/28961a6eddd6e6679b5191e026fcffd4205756d1/interface_gen.py
def __init__(self,x,y,z,kind='linear', copy=True,bounds_error=0,fill_value=None):
def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=None):
def __init__(self,x,y,z,kind='linear', copy=True,bounds_error=0,fill_value=None): """ Input: x,y - 1-d arrays defining 2-d grid (or 2-d meshgrid arrays) z - 2-d array of grid values kind - interpolation type ('nearest', 'linear', 'cubic', 'quintic') copy - if true then data is copied into class, otherwise only a re...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
kind - interpolation type ('nearest', 'linear', 'cubic', 'quintic')
kind - interpolation type ('linear', 'cubic', 'quintic')
def __init__(self,x,y,z,kind='linear', copy=True,bounds_error=0,fill_value=None): """ Input: x,y - 1-d arrays defining 2-d grid (or 2-d meshgrid arrays) z - 2-d array of grid values kind - interpolation type ('nearest', 'linear', 'cubic', 'quintic') copy - if true then data is copied into class, otherwise only a re...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
if self.x > 2 or rank(self.y) > 2:
if rank(self.x) > 2 or rank(self.y) > 2:
def __init__(self,x,y,z,kind='linear', copy=True,bounds_error=0,fill_value=None): """ Input: x,y - 1-d arrays defining 2-d grid (or 2-d meshgrid arrays) z - 2-d array of grid values kind - interpolation type ('nearest', 'linear', 'cubic', 'quintic') copy - if true then data is copied into class, otherwise only a re...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
'qunitic' : 5}[kind]
'quintic' : 5}[kind]
def __init__(self,x,y,z,kind='linear', copy=True,bounds_error=0,fill_value=None): """ Input: x,y - 1-d arrays defining 2-d grid (or 2-d meshgrid arrays) z - 2-d array of grid values kind - interpolation type ('nearest', 'linear', 'cubic', 'quintic') copy - if true then data is copied into class, otherwise only a re...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
z,ier=fitpack._fitpack._bispev(*(self.tck+[x,y,dx,dy])) if ier==10: raise ValueError,"Invalid input data" if ier: raise TypeError,"An error occurred"
z,ier=fitpack.bisplev(self.tck, x, y, dx, dy) if ier==10: raise ValueError, "Invalid input data" if ier: raise TypeError, "An error occurred"
def __call__(self,x,y,dx=0,dy=0): """ Input: x,y - 1-d arrays defining points to interpolate. dx,dy - order of partial derivatives in x and y, respectively. 0<=dx<kx, 0<=dy<ky Output: z - 2-d array of interpolated values """ x = atleast_1d(x) y = atleast_1d(y) z,ier=fitpack._fitpack._bispev(*(self.tck+[x,y,dx,dy]...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
if len(z)==1: z = z[0]
if len(z)==1: z = z[0]
def __call__(self,x,y,dx=0,dy=0): """ Input: x,y - 1-d arrays defining points to interpolate. dx,dy - order of partial derivatives in x and y, respectively. 0<=dx<kx, 0<=dy<ky Output: z - 2-d array of interpolated values """ x = atleast_1d(x) y = atleast_1d(y) z,ier=fitpack._fitpack._bispev(*(self.tck+[x,y,dx,dy]...
4e854b6c82072ab4ffffddf9fddc188fbc52a64a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4e854b6c82072ab4ffffddf9fddc188fbc52a64a/interpolate.py
def gmres(A,b,x0=None,tol=1e-5,maxiter=None):
def gmres(A,b,restrt=None,x0=None,tol=1e-5,maxiter=None):
def gmres(A,b,x0=None,tol=1e-5,maxiter=None): """Use Generalized Minimal RESidual iteration to solve A x = b Inputs: A -- An array or an object with a matvec(x) method to represent A * x. May also have a psolve(b) methods for representing solution to the preconditioning equation M * x = b. b -- An n-length vecto...
b585c46ec7564dc2759b5b471e5d839e535903c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b585c46ec7564dc2759b5b471e5d839e535903c0/iterative.py
restrt -- A restart value
def gmres(A,b,x0=None,tol=1e-5,maxiter=None): """Use Generalized Minimal RESidual iteration to solve A x = b Inputs: A -- An array or an object with a matvec(x) method to represent A * x. May also have a psolve(b) methods for representing solution to the preconditioning equation M * x = b. b -- An n-length vecto...
b585c46ec7564dc2759b5b471e5d839e535903c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b585c46ec7564dc2759b5b471e5d839e535903c0/iterative.py
def gmres(A,b,x0=None,tol=1e-5,maxiter=None): """Use Generalized Minimal RESidual iteration to solve A x = b Inputs: A -- An array or an object with a matvec(x) method to represent A * x. May also have a psolve(b) methods for representing solution to the preconditioning equation M * x = b. b -- An n-length vecto...
b585c46ec7564dc2759b5b471e5d839e535903c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b585c46ec7564dc2759b5b471e5d839e535903c0/iterative.py
work = sb.zeros(5*n,typ) work2 = sb.zeros(restrt*(2*restrt+2),typ)
work = sb.zeros((6+restrt)*n,typ) work2 = sb.zeros((restrt+1)*(2*restrt+2),typ)
def gmres(A,b,x0=None,tol=1e-5,maxiter=None): """Use Generalized Minimal RESidual iteration to solve A x = b Inputs: A -- An array or an object with a matvec(x) method to represent A * x. May also have a psolve(b) methods for representing solution to the preconditioning equation M * x = b. b -- An n-length vecto...
b585c46ec7564dc2759b5b471e5d839e535903c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b585c46ec7564dc2759b5b471e5d839e535903c0/iterative.py
if "fpedef" in os.environ:
if os.environ.has_key('fpedef'):
fpedef = "-DFPU_HPUX"
c76c81448b93199e56ce7ac26e44970a72588cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c76c81448b93199e56ce7ac26e44970a72588cd5/setup_xplt.py
if "TRAP_FPE" in os.environ: del os.environ["TRAP_FPE"]
if os.environ.has_key('TRAP_FPE'): del os.environ["TRAP_FPE"]
fpedef = "-DFPU_HPUX"
c76c81448b93199e56ce7ac26e44970a72588cd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c76c81448b93199e56ce7ac26e44970a72588cd5/setup_xplt.py
assert_array_almost_equal(f([1,2,3],[2,-1,3]),[7,9,18],a=5)
assert_array_almost_equal(f([1,2,3],[2,-1,3],a=5),[7,9,18])
def check_axpy(self): for p in 'sd': f = getattr(cblas,p+'axpy') assert_array_almost_equal(f(5,[1,2,3],[2,-1,3]),[7,9,18]) f = getattr(fblas,p+'axpy') assert_array_almost_equal(f([1,2,3],[2,-1,3]),[7,9,18],a=5) for p in 'cz': f = getattr(cblas,p+'axpy') assert_array_almost_equal(f(5,[1,2j,3],[2,-1,3]),[7,10j-1,18]) f =...
505cd178c9b9716b98cc80cd8d0ba74717b417c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/505cd178c9b9716b98cc80cd8d0ba74717b417c0/test_blas.py
assert_array_almost_equal(f([1,2j,3],[2,-1,3]),[7,10j-1,18],a=5)
assert_array_almost_equal(f([1,2j,3],[2,-1,3],a=5),[7,10j-1,18])
def check_axpy(self): for p in 'sd': f = getattr(cblas,p+'axpy') assert_array_almost_equal(f(5,[1,2,3],[2,-1,3]),[7,9,18]) f = getattr(fblas,p+'axpy') assert_array_almost_equal(f([1,2,3],[2,-1,3]),[7,9,18],a=5) for p in 'cz': f = getattr(cblas,p+'axpy') assert_array_almost_equal(f(5,[1,2j,3],[2,-1,3]),[7,10j-1,18]) f =...
505cd178c9b9716b98cc80cd8d0ba74717b417c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/505cd178c9b9716b98cc80cd8d0ba74717b417c0/test_blas.py
class test_trapz(unittest.TestCase): def check_basic(self): x = [1,4,6,7,12] y = [11,15,6,3,9] val = (11+15)/2.0*3 + (15+6)/2.0*2 + (6+3)/2.0 + (3+9)/2.0*5.0 assert_equal(trapz(y,x),val) def check_nd(self): x = sort(20*rand(10,20,30)) y = x**2 + 2*x + 1 dx = x[:,1:,:] - x[:,:-1,:] val = add.reduce(dx*(y[:,1:,:] + y[:,...
def check_basic(self): ba = [1,2,10,11,6,5,4] ba2 = [[1,2,3,4],[5,6,7,9],[10,3,4,5]] for ctype in ['1','b','s','i','l','f','d','F','D']: a = array(ba,ctype) a2 = array(ba2,ctype) if ctype in ['1', 'b']: self.failUnlessRaises(ArithmeticError, cumprod, a) self.failUnlessRaises(ArithmeticError, cumprod, a2, 1) self.failUn...
a73dc1fecfa3891e3212d6ddd69af8f1370a6c53 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a73dc1fecfa3891e3212d6ddd69af8f1370a6c53/test_basic.py