rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
derphi_a0 = phiprime(alpha) gc = gc + 1 if (phi_a0 <= phi0 + c1*alpha0*derphi0) \ and (abs(derphi_a0) <= c2*abs(derphi0)): return alpha0, fc, gc alpha0 = 0 alpha1 = 1 phi_a1 = phi_a0 | alpha1 = pymin(1.0,1.01*2*(phi0-old_old_fval)/derphi0) phi_a1 = phi(alpha1) derphi_a1 = phiprime(alpha1) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
alpha_star, ifc, igc = zoom(alpha0, alpha1, phi_a0, phi_a1, derphi_a0, phi, phiprime, phi0, derphi0, c1, c2) gc = gc + igc fc = fc + ifc | alpha_star, fval_star = zoom(alpha0, alpha1, phi_a0, phi_a1, derphi_a0, phi, phiprime, phi0, derphi0, c1, c2) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
gc = gc + 1 | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py | |
alpha_star, ifc, igc = zoom(alpha1, alpha0, phi_a1, phi_a0, derphi_a1, phi, phiprime, phi0, derphi0, c1, c2) gc = gc + igc fc = fc + ifc | alpha_star, fval_star = zoom(alpha1, alpha0, phi_a1, phi_a0, derphi_a1, phi, phiprime, phi0, derphi0, c1, c2) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
phi_a1 = f(xk+alpha1*pk,*args) fc = fc + 1 | phi_a1 = phi(alpha1) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
return alpha_star, fc, gc def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): | return alpha_star, fc, gc, fval_star, old_fval def line_search_BFGS(f, xk, pk, gfk, old_fval, args=(), c1=1e-4, alpha0=1): | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
phi0 = apply(f,(xk,)+args) | phi0 = old_fval | def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): """Minimize over alpha, the function f(xk+alpha pk) Uses the interpolation algorithm (Armiijo backtracking) as suggested by Wright and Nocedal in 'Numerical Optimization', 1999, pg. 56-57 Outputs: (alpha, fc, gc) """ fc = 0 phi0 = apply(f,(xk,)+args) ... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
fc = fc + 2 | fc = fc + 1 | def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): """Minimize over alpha, the function f(xk+alpha pk) Uses the interpolation algorithm (Armiijo backtracking) as suggested by Wright and Nocedal in 'Numerical Optimization', 1999, pg. 56-57 Outputs: (alpha, fc, gc) """ fc = 0 phi0 = apply(f,(xk,)+args) ... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
return alpha0, fc, 0 | return alpha0, fc, 0, phi_a0 | def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): """Minimize over alpha, the function f(xk+alpha pk) Uses the interpolation algorithm (Armiijo backtracking) as suggested by Wright and Nocedal in 'Numerical Optimization', 1999, pg. 56-57 Outputs: (alpha, fc, gc) """ fc = 0 phi0 = apply(f,(xk,)+args) ... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
return alpha1, fc, 0 | return alpha1, fc, 0, phi_a1 | def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): """Minimize over alpha, the function f(xk+alpha pk) Uses the interpolation algorithm (Armiijo backtracking) as suggested by Wright and Nocedal in 'Numerical Optimization', 1999, pg. 56-57 Outputs: (alpha, fc, gc) """ fc = 0 phi0 = apply(f,(xk,)+args) ... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
return alpha2, fc, 0 | return alpha2, fc, 0, phi_a2 | def line_search_BFGS(f, xk, pk, gfk, args=(), c1=1e-4, alpha0=1): """Minimize over alpha, the function f(xk+alpha pk) Uses the interpolation algorithm (Armiijo backtracking) as suggested by Wright and Nocedal in 'Numerical Optimization', 1999, pg. 56-57 Outputs: (alpha, fc, gc) """ fc = 0 phi0 = apply(f,(xk,)+args) ... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
alpha_k, fc, gc = line_search_BFGS(f,xk,pk,gfk,args) | alpha_k, fc, gc, old_fval = line_search_BFGS(f,xk,pk,gfk,old_fval,args) | def fmin_bfgs(f, x0, fprime=None, args=(), avegtol=1e-5, epsilon=1e-8, maxiter=None, full_output=0, disp=1): """Minimize a function using the BFGS algorithm. Description: Optimize the function, f, whose gradient is given by fprime using the quasi-Newton method of Broyden, Fletcher, Goldfarb, and Shanno (BFGS) See Wri... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
def fmin_cg(f, x0, fprime=None, args=(), avegtol=1e-5, epsilon=1e-8, maxiter=None, full_output=0, disp=1): """Minimize a function with nonlinear conjugate gradient algorithm. Description: Optimize the function, f, whose gradient is given by fprime using the nonlinear conjugate gradient algorithm of Polak and Ribier... | def fmin_bfgs(f, x0, fprime=None, args=(), avegtol=1e-5, epsilon=1e-8, maxiter=None, full_output=0, disp=1): """Minimize a function using the BFGS algorithm. Description: Optimize the function, f, whose gradient is given by fprime using the quasi-Newton method of Broyden, Fletcher, Goldfarb, and Shanno (BFGS) See Wri... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py | |
alphak, fc, gc = line_search_BFGS(f,xk,pk,gfk,args) | alphak, fc, gc, old_fval = line_search_BFGS(f,xk,pk,gfk,old_fval,args) | def fmin_ncg(f, x0, fprime, fhess_p=None, fhess=None, args=(), avextol=1e-5, epsilon=1e-8, maxiter=None, full_output=0, disp=1): """Description: Minimize the function, f, whose gradient is given by fprime using the Newton-CG method. fhess_p must compute the hessian times an arbitrary vector. If it is not given, finit... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
fval = apply(f,(xk,)+args) | fval = old_fval | def fmin_ncg(f, x0, fprime, fhess_p=None, fhess=None, args=(), avextol=1e-5, epsilon=1e-8, maxiter=None, full_output=0, disp=1): """Description: Minimize the function, f, whose gradient is given by fprime using the Newton-CG method. fhess_p must compute the hessian times an arbitrary vector. If it is not given, finit... | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py |
start = time.time() x = fmin_cg(rosen, x0, fprime=rosen_der, maxiter=80) print x times.append(time.time() - start) algor.append('Nonlinear CG\t') | def _scalarfunc(*params): params = squeeze(asarray(params)) return func(params,*args) | d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py | |
if len(row) == 0 and len(seq) == self.shape[1]: nonzeros = [ind for ind, xi in enumerate(x) if xi != 0] x = [x[ind] for ind in nonzeros] row[:] = nonzeros self.data[i] = x else: for k, col in enumerate(seq): self[i, col] = x[k] | for k, col in enumerate(seq): self[i, col] = x[k] | def __setitem__(self, index, x): try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if isinstance(i, int): if not (i>=0 and i<self.shape[0]): raise IndexError, "lil_matrix index out of range" else: if isinstance(i, slice): seq = xrange(i.start or 0, i.stop or ... | 8f4e66c458a41ba941e436146e9a9e7df93cdc46 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8f4e66c458a41ba941e436146e9a9e7df93cdc46/sparse.py |
mu = 1/(exp(lambda_))-1) | mu = 1/(exp(lambda_)-1) | def _stats(self, lambda_): m2, m1 = arr(lambda_) mu = 1/(exp(lambda_))-1) var = exp(-lambda_)/(1-exp(-lambda))**2 g1 = 2*cosh(lambda_/2.0) g2 = 4+2*cosh(lambda_) return mu, var, g1, g2 | ccb0a69b78ea57818837f989851ed5bf4309a175 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/ccb0a69b78ea57818837f989851ed5bf4309a175/distributions.py |
cond = c+0*val1+0*val2 | cond = c+0*val1 | def _ppf(self, q, a, c): val1 = special.gammaincinv(a,q) val2 = special.gammaincinv(a,1.0-q) ic = 1.0/c cond = c+0*val1+0*val2 return where(cond > 0,val1**ic,val2**ic) | abc8537bacaa811a759c7d399b68a35ec64aa647 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/abc8537bacaa811a759c7d399b68a35ec64aa647/distributions.py |
f = open(source,'w') | f = open(target,'w') | def get_clapack_source(ext, build_dir): name = ext.name.split('.')[-1] assert name=='clapack',`name` if atlas_version is None: target = os.path.join(build_dir,target_dir,'clapack.pyf') from distutils.dep_util import newer if newer(__file__,target): f = open(source,'w') f.write(tmpl_empty_clapack_pyf) f.close() else: ta... | 40bc33ebd624fc0d82e81085df9c2afab5cf1e58 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/40bc33ebd624fc0d82e81085df9c2afab5cf1e58/setup_lapack.py |
if nest is None: nest=m/2 | if nest is None: nest=m+2*k | def splprep(x,w=None,u=None,ub=None,ue=None,k=3,task=0,s=None,t=None, full_output=0,nest=None,per=0,quiet=1): """Find the B-spline representation of an N-dimensional curve. Description: Given a list of N rank-1 arrays, x, which represent a curve in N-dimensional space parametrized by u, find a smooth approximating sp... | 8db610b5e4af19ed171e7489fe6046b0f314615a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8db610b5e4af19ed171e7489fe6046b0f314615a/fitpack.py |
x = asarray(x) | def plot(x,*args,**keywds): """Plot curves. Description: Plot one or more curves on the same graph. Inputs: There can be a variable number of inputs which consist of pairs or triples. The second variable is plotted against the first using the linetype specified by the optional third variable in the triple. If onl... | 65c5bf346df3d9775ed2b57ef9fbcebd5c054ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/65c5bf346df3d9775ed2b57ef9fbcebd5c054ac9/Mplot.py | |
if y.typecode() in ['F','D']: | if scipy.array_iscomplex(y): | def plot(x,*args,**keywds): """Plot curves. Description: Plot one or more curves on the same graph. Inputs: There can be a variable number of inputs which consist of pairs or triples. The second variable is plotted against the first using the linetype specified by the optional third variable in the triple. If onl... | 65c5bf346df3d9775ed2b57ef9fbcebd5c054ac9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/65c5bf346df3d9775ed2b57ef9fbcebd5c054ac9/Mplot.py |
type = 'b' | type = 'B' | def fromimage(im, flatten=0): """Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel Optional arguments: - flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the... | a785a7f292974deb7696ea9b39f9194c356e7756 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a785a7f292974deb7696ea9b39f9194c356e7756/pilutil.py |
type = 'i' | type = 'I' | def fromimage(im, flatten=0): """Takes a PIL image and returns a copy of the image in a Numeric container. If the image is RGB returns a 3-dimensional array: arr[:,:,n] is each channel Optional arguments: - flatten (0): if true, the image is flattened by calling convert('F') on the image object before extracting the... | a785a7f292974deb7696ea9b39f9194c356e7756 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a785a7f292974deb7696ea9b39f9194c356e7756/pilutil.py |
pal = arange(0,256,1,dtype='b')[:,NewAxis] * \ ones((3,),dtype='b')[NewAxis,:] | pal = arange(0,256,1,dtype='B')[:,NewAxis] * \ ones((3,),dtype='B')[NewAxis,:] | def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, mode=None,channel_axis=None): """Takes a Numeric array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to ... | a785a7f292974deb7696ea9b39f9194c356e7756 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a785a7f292974deb7696ea9b39f9194c356e7756/pilutil.py |
bytedata = ((data > high)*255).astype('b') image = Image.fromstring('L',shape,bytedata.tostring()) image = image.convert(mode='1') | bytedata = (data > high) image = Image.fromstring('1',shape,bytedata.tostring()) | def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, mode=None,channel_axis=None): """Takes a Numeric array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to ... | a785a7f292974deb7696ea9b39f9194c356e7756 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a785a7f292974deb7696ea9b39f9194c356e7756/pilutil.py |
raise ValueError, "Only floating point sparse matrix types allowed" | self.data = self.data.astype('d') self.typecode = 'd' | def _check(self): M,N = self.shape nnz = self.indptr[-1] nzmax = len(self.rowind) | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py |
typecode = _coerce_rules[(self.typecode,bmat.typecode)] ftype = _transtabl[typecode] | def matmat(self, bmat): self._check() M,K1 = self.shape K2,N = bmat.shape if (K1 != K2): raise ValueError, "Shape mismatch error." a, rowa, ptra = self.data, self.rowind, self.indptr typecode = _coerce_rules[(self.typecode,bmat.typecode)] ftype = _transtabl[typecode] if isinstance(bmat,csr_matrix): bmat._check() func =... | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py | |
raise ValueError, "Only floating point sparse matrix types allowed" | self.typecode = 'd' self.data = self.data.astype('d') | def _check(self): M,N = self.shape if (rank(self.data) != 1) or (rank(self.colind) != 1) or \ (rank(self.indptr) != 1): raise ValueError, "Data, colind, and indptr arrays "\ "should be rank 1." if (len(self.data) != len(self.colind)): raise ValueError, "Data and row list should have same length" if (len(self.indptr) !=... | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py |
typecode = _coerce_rules[(self.typecode,bmat.typecode)] ftype = _transtabl[typecode] | def matmat(self, bmat): self._check() M,K1 = self.shape K2,N = bmat.shape a, rowa, ptra = self.data, self.colind, self.indptr typecode = _coerce_rules[(self.typecode,bmat.typecode)] ftype = _transtabl[typecode] if (K1 != K2): raise ValueError, "Shape mismatch error." if isinstance(bmat,csc_matrix): bmat._check() func =... | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py | |
if isinstance(bmat,csc_matrix): | if isinstance(bmat,csc_matrix): | def matmat(self, bmat): self._check() M,K1 = self.shape K2,N = bmat.shape a, rowa, ptra = self.data, self.colind, self.indptr typecode = _coerce_rules[(self.typecode,bmat.typecode)] ftype = _transtabl[typecode] if (K1 != K2): raise ValueError, "Shape mismatch error." if isinstance(bmat,csc_matrix): bmat._check() func =... | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py |
return gstrf(N,csc.nnz,csc.data,csc.rowind,csc.colptr,permc_spec, | return gstrf(N,csc.nnz,csc.data,csc.rowind,csc.indptr,permc_spec, | def lu_factor(A, permc_spec=2, diag_pivot_thresh=1.0, drop_tol=0.0, relax=1, panel_size=10): M,N = A.shape if (M != N): raise ValueError, "Can only factor square matrices." csc = A.tocsc() gstrf = eval('_superlu.' + csc.ftype + 'gstrf') return gstrf(N,csc.nnz,csc.data,csc.rowind,csc.colptr,permc_spec, diag_pivot_thresh... | 581c924d7981707b461583419b5d513f06410592 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/581c924d7981707b461583419b5d513f06410592/Sparse.py |
a = array((1,2,3,4),Float32) | a = array((1,2,3,4),Float64) | def check_1D_array(self): a = array((1,2,3,4),Float32) actual= stats.hmean(a) desired = 4. / (1./1 + 1./2 + 1./3 + 1./4) assert_almost_equal(desired,actual,decimal=14) | df519ee6c07847bf1a14f9089d81e12bbe7c4347 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/df519ee6c07847bf1a14f9089d81e12bbe7c4347/test_stats.py |
just return the wx_class unaltered. """ | just return the wx_class unaltered. The proxied class is wrapped by the smart_class that returns a proxied or normal instance depending on where the instantiation occurs. """ | def register(wx_class): """ Create a gui_thread compatible version of wx_class Test whether a proxy is necessary. If so, generate and return the proxy class. if not, just return the wx_class unaltered. """ if running_in_second_thread: #print 'proxy generated' return proxify(wx_class) else: if not hasattr(wx_class, '... | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
return proxify(wx_class) | return smart_class(wx_class, proxify(wx_class)) | def register(wx_class): """ Create a gui_thread compatible version of wx_class Test whether a proxy is necessary. If so, generate and return the proxy class. if not, just return the wx_class unaltered. """ if running_in_second_thread: #print 'proxy generated' return proxify(wx_class) else: if not hasattr(wx_class, '... | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
args = dereference_arglist(args) | args = dereference_arglist(args) dkw = dereference_dict(kw) | body = """def %(method)s(self,*args,**kw): \"\"\"%(documentation)s\"\"\" %(pre_test)s from gui_thread_guts import proxy_event, smart_return %(import_statement)s # remove proxies if present args = dereference_arglist(args) %(arguments)s # inserts proxied object up front ret_val = None if in_proxy_call: ret_val = apply(%... | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
ret_val = apply(%(call_method)s, arg_list, kw) | ret_val = apply(%(call_method)s, arg_list, dkw) | body = """def %(method)s(self,*args,**kw): \"\"\"%(documentation)s\"\"\" %(pre_test)s from gui_thread_guts import proxy_event, smart_return %(import_statement)s # remove proxies if present args = dereference_arglist(args) %(arguments)s # inserts proxied object up front ret_val = None if in_proxy_call: ret_val = apply(%... | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
evt = proxy_event(%(call_method)s,arg_list,kw,finished) | evt = proxy_event(%(call_method)s,arg_list,dkw,finished) | body = """def %(method)s(self,*args,**kw): \"\"\"%(documentation)s\"\"\" %(pre_test)s from gui_thread_guts import proxy_event, smart_return %(import_statement)s # remove proxies if present args = dereference_arglist(args) %(arguments)s # inserts proxied object up front ret_val = None if in_proxy_call: ret_val = apply(%... | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
hasattr(x, 'x._proxy_attr__dont_mess_with_me_unless_you_know_what_youre_doing') | return hasattr(x, 'x._proxy_attr__dont_mess_with_me_unless_you_know_what_youre_doing') | def is_proxy_attr(x): hasattr(x, 'x._proxy_attr__dont_mess_with_me_unless_you_know_what_youre_doing') | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
res.append(get_proxy_attr_obj(arg)) | obj = get_proxy_attr_obj(arg) if is_proxy(obj): res.append(obj.wx_obj) else: res.append(obj) | def dereference_arglist(lst): """ Scan for proxy objects and convert to underlying object """ res = [] for arg in lst: if is_proxy(arg): res.append(arg.wx_obj) #print 'dereferenced ', arg.wx_obj elif is_proxy_attr(arg): res.append(get_proxy_attr_obj(arg)) else: res.append(arg) return res | 4d50a24916bde5ccf37876de92ba8f8d8c0a41c4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4d50a24916bde5ccf37876de92ba8f8d8c0a41c4/main.py |
M = int(amax(ij[0])) N = int(amax(ij[1])) | M = int(amax(ij[0])) + 1 N = int(amax(ij[1])) + 1 | def __init__(self, obj, ij_in, dims=None, nzmax=None, dtype=None): spmatrix.__init__(self) try: # Assume the first calling convention # assert len(ij) == 2 if len(ij_in) != 2: if isdense( ij_in ) and (ij_in.shape[1] == 2): ij = (ij_in[:,0], ij_in[:,1]) else: raise AssertionError else: ij = ij_in if dims is N... | 57e057b52364d5b77af01198799ed00aea306d4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/57e057b52364d5b77af01198799ed00aea306d4c/sparse.py |
except Exception, e: raise e, "invalid input format" | except Exception: print "invalid input format" raise | def __init__(self, obj, ij_in, dims=None, nzmax=None, dtype=None): spmatrix.__init__(self) try: # Assume the first calling convention # assert len(ij) == 2 if len(ij_in) != 2: if isdense( ij_in ) and (ij_in.shape[1] == 2): ij = (ij_in[:,0], ij_in[:,1]) else: raise AssertionError else: ij = ij_in if dims is N... | 57e057b52364d5b77af01198799ed00aea306d4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/57e057b52364d5b77af01198799ed00aea306d4c/sparse.py |
import os.path as op | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info import os.path as op config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound... | 0beefb64e326cff6a092b86769cce70c9582ce1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0beefb64e326cff6a092b86769cce70c9582ce1a/setup.py | |
if umf_info: print 'Umfpack present, ok.' else: return None | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info import os.path as op config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound... | 0beefb64e326cff6a092b86769cce70c9582ce1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0beefb64e326cff6a092b86769cce70c9582ce1a/setup.py | |
scipyInclude = numpy.get_numpy_include() umfpackInclude = umf_info['include_dirs'][0] | umfpack_i_file = config.paths('umfpack.i')[0] def umfpack_i(ext, build_dir): if umf_info: return umfpack_i_file | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info import os.path as op config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound... | 0beefb64e326cff6a092b86769cce70c9582ce1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0beefb64e326cff6a092b86769cce70c9582ce1a/setup.py |
sources = ['umfpack.i'], swig_opts = ['-I' + umfpackInclude], include_dirs = [umfpackInclude, scipyInclude], | sources = [umfpack_i], | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info import os.path as op config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound... | 0beefb64e326cff6a092b86769cce70c9582ce1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0beefb64e326cff6a092b86769cce70c9582ce1a/setup.py |
extra_objects = umf_info['extra_objects'] ) | **umf_info) | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info import os.path as op config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound... | 0beefb64e326cff6a092b86769cce70c9582ce1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/0beefb64e326cff6a092b86769cce70c9582ce1a/setup.py |
raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." | raise ValueError, "Both rp and rs must be provided to design an elliptic filter." | 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. ... | f294fbfbcba8fd09ee3427e2fb9d597320fb8aae /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/f294fbfbcba8fd09ee3427e2fb9d597320fb8aae/filter_design.py |
v v v v v v v | def check_complex_expr(self): | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v ^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
v v v v v v v | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
^ ^ ^ ^ ^ ^ ^ | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 59b4e95f7f51e2949dfc41d870520dd7f49c95eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/59b4e95f7f51e2949dfc41d870520dd7f49c95eb/test_numexpr.py | |
beta = select([A>50, A>21], [0.1102*(A-8.7), 0.5842*(A-21)**(0.4) + 0.07866*(A-21)], 0.0) | if (A>50): beta = 0.1102*(A-8.7) elif (A>21): beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) else: beta = 0.0 | def kaiserord(ripple, width): """Design a Kaiser window to limit ripple and width of transition region. Inputs: ripple -- positive number specifying maximum ripple in passband (dB) and minimum ripple in stopband width -- width of transition region (normalized so that 1 corresponds to pi radians / sample) Outputs: ... | ef7ae2163847f15d6f109eac68148b2b4694233b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/ef7ae2163847f15d6f109eac68148b2b4694233b/filter_design.py |
for key in self.keys(): if key[indx] in cols_or_rows: res[key] = self[key] | N = len(cols_or_rows) if indx: for key in self.keys(): num = searchsorted(cols_or_rows,key[1]) if num < N: newkey = (key[0],num) res[newkey] = self[key] else: for key in self.keys(): num = searchsorted(cols_or_rows,key[0]) if num < N: newkey = (num,key[1]) res[newkey] = self[key] | def take(self, cols_or_rows, columns=1): # Extract columns or rows as indictated from matrix res = dictmatrix() indx = int((columns == 1)) for key in self.keys(): if key[indx] in cols_or_rows: res[key] = self[key] return res | 7d60f439c1f14bf97fbf1ded32a5ecb59793f242 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/7d60f439c1f14bf97fbf1ded32a5ecb59793f242/Sparse.py |
f = open(source,'w') | f = open(target,'w') | def get_cblas_source(ext, build_dir): name = ext.name.split('.')[-1] assert name=='cblas',`name` if atlas_version is None: target = join(build_dir,target_dir,'cblas.pyf') from distutils.dep_util import newer if newer(__file__,target): f = open(source,'w') f.write(tmpl_empty_cblas_pyf) f.close() else: target = ext.depen... | 6e5cad3f6513055c6057bb0caa3c100d26866d61 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/6e5cad3f6513055c6057bb0caa3c100d26866d61/setup_blas.py |
h = wiener(g) assert_array_almost_equal(h,correct,decimal=6) | h = wiener(g) assert_array_almost_equal(h,correct,decimal=6) | def check_basic(self): g = Numeric.array([[5,6,4,3],[3,5,6,2],[2,3,5,6],[1,6,9,7]],'d') correct = Numeric.array([[2.16374269,3.2222222222, 2.8888888889, 1.6666666667],[2.666666667, 4.33333333333, 4.44444444444, 2.8888888888],[2.222222222, 4.4444444444, 5.4444444444, 4.801066874837],[1.33333333333, 3.92735042735, 6.0712... | afdfe630da72326dbdc18cfc00e7782f2ab82f35 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/afdfe630da72326dbdc18cfc00e7782f2ab82f35/test_signaltools.py |
assert_array_almost_equal(f(3,[3],[-4]),[-36]) | assert_array_almost_equal(f(3,[3],[-4]),[[-36]]) | def check_gemm(self): for p in 'sd': f = getattr(fblas,p+'gemm',None) if f is None: continue assert_array_almost_equal(f(3,[3],[-4]),[-36]) assert_array_almost_equal(f(3,[3],[-4],3,[5]),[-21]) for p in 'cz': f = getattr(fblas,p+'gemm',None) if f is None: continue assert_array_almost_equal(f(3j,[3-4j],[-4]),[-48-36j]) a... | dd7605b66704602793ae5a516e8f3a5ee4157154 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/dd7605b66704602793ae5a516e8f3a5ee4157154/test_blas.py |
assert_array_almost_equal(f(3j,[3-4j],[-4]),[-48-36j]) | assert_array_almost_equal(f(3j,[3-4j],[-4]),[[-48-36j]]) | def check_gemm(self): for p in 'sd': f = getattr(fblas,p+'gemm',None) if f is None: continue assert_array_almost_equal(f(3,[3],[-4]),[-36]) assert_array_almost_equal(f(3,[3],[-4],3,[5]),[-21]) for p in 'cz': f = getattr(fblas,p+'gemm',None) if f is None: continue assert_array_almost_equal(f(3j,[3-4j],[-4]),[-48-36j]) a... | dd7605b66704602793ae5a516e8f3a5ee4157154 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/dd7605b66704602793ae5a516e8f3a5ee4157154/test_blas.py |
if not issubclass(line.dtype.type, int) or not line.iscontiguous()): | if not issubclass(line.dtype.type, int) or not line.iscontiguous(): | def polyline(dc,line,xoffset=0,yoffset=0): #------------------------------------------------------------------------ # Make sure the array is the correct size/shape #------------------------------------------------------------------------ shp = line.shape assert(len(shp)==2 and shp[1] == 2) #--------------------------... | b87a2bda3158afdebfcbff0f8b776db588cc79e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/b87a2bda3158afdebfcbff0f8b776db588cc79e7/wx_speed.py |
v = [(s.delta, s.time) for s in subjects] | def initialize(self, subjects): | c9c3c7d8f2e2a3ad7a3edb438ee0e18d948101c7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9c3c7d8f2e2a3ad7a3edb438ee0e18d948101c7/cox.py | |
if not _hold: gist.fma() gist.animate(0) | try: _style = None saveval = gist.plsys(2) gist.plsys(saveval) except: _style = 'default' if not _hold: gist.fma() gist.animate(0) | def imagesc(z,cmin=None,cmax=None,xryr=None,_style='default', palette=None, color='black'): """Plot an image on axes. z -- The data cmin -- Value to map to lowest color in palette (min(z) if None) cmax -- Value to map to highest color in palette (max(z) if None) xryr -- (xmin, ymin, xmax, ymax) coordinates to print (0... | c3fd93bfa60f92bb1be62ae0bd29941be5afd8e7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c3fd93bfa60f92bb1be62ae0bd29941be5afd8e7/Mplot.py |
assert(isnan(array(1+1j)/0.) == 0) | assert(isnan(array(0+0j)/0.) == 1) | def check_complex1(self): assert(isnan(array(1+1j)/0.) == 0) | 9496b106d6e4258c5be22603073cc93174e67902 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/9496b106d6e4258c5be22603073cc93174e67902/test_misc.py |
assert(vals.imag > 1e10 and isfinite(vals)) | assert(vals.imag ==0) | def check_complex_bad(self): v = 1+1j v += array(0+1.j)/0. vals = nan_to_num(v) assert(vals.imag > 1e10 and isfinite(vals)) | 9496b106d6e4258c5be22603073cc93174e67902 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/9496b106d6e4258c5be22603073cc93174e67902/test_misc.py |
assert(vals.imag > 1e10 and isfinite(vals)) | assert(isfinite(vals)) | def check_complex_bad2(self): v = 1+1j v += array(-1+1.j)/0. vals = nan_to_num(v) assert(vals.imag > 1e10 and isfinite(vals)) # !! This is actually (unexpectedly) positive # !! inf. Comment out for now, and see if it # !! changes #assert(vals.real < -1e10 and isfinite(vals)) | 9496b106d6e4258c5be22603073cc93174e67902 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/9496b106d6e4258c5be22603073cc93174e67902/test_misc.py |
dlg = wx.wxFileDialog(self, "Save As", ".", "", "*.*", wx.wxSAVE) | def OnFileSaveAs(self, event): import os dlg = wx.wxFileDialog(self, "Save As", ".", "", "*.*", wx.wxSAVE) wildcard = "PNG files (*.png)|*.png|" \ "BMP files (*.bmp)|*.bmp|" \ "JPEG files (*.jpg)|*.jpg|" \ "PCX files (*.pcx)|*.pcx|" \ "TIFF files (*.tif)|*.tif" dlg.SetWildcard(wildcard) dlg.SetWildcard(wildcard) if dlg... | 1624b66f750e0de9c6b5a88fb2e7e4e852266e3c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1624b66f750e0de9c6b5a88fb2e7e4e852266e3c/wxplt.py | |
"TIFF files (*.tif)|*.tif" dlg.SetWildcard(wildcard) dlg.SetWildcard(wildcard) | "TIFF files (*.tif)|*.tif|" \ "All Files |*|" dlg = wx.wxFileDialog(self, "Save As", ".", "", wildcard, wx.wxSAVE) | def OnFileSaveAs(self, event): import os dlg = wx.wxFileDialog(self, "Save As", ".", "", "*.*", wx.wxSAVE) wildcard = "PNG files (*.png)|*.png|" \ "BMP files (*.bmp)|*.bmp|" \ "JPEG files (*.jpg)|*.jpg|" \ "PCX files (*.pcx)|*.pcx|" \ "TIFF files (*.tif)|*.tif" dlg.SetWildcard(wildcard) dlg.SetWildcard(wildcard) if dlg... | 1624b66f750e0de9c6b5a88fb2e7e4e852266e3c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1624b66f750e0de9c6b5a88fb2e7e4e852266e3c/wxplt.py |
if (_obj.search(line) is not None): if atype not in scipy_base.typecodes['Complex']: scipy_base.disp("Warning: Complex data detected, but requested typecode was not complex.") | if _not_warned: if (_obj.search(line) is not None): warn = 1 for k in range(len(atype)): if atype[k] in scipy_base.typecodes['Complex']: warn = 0 if warn: scipy_base.disp("Warning: Complex data detected, but no requested typecode was complex.") _not_warned = 0 | def process_line(line, separator, collist, atype, missing): strlist = [] line = _obj.sub(r"\1\3\5",line) # remove spaces between real # and imaginary parts of complex numbers if (_obj.search(line) is not None): if atype not in scipy_base.typecodes['Complex']: scipy_base.disp("Warning: Complex data detected, but reques... | a87c3471b990f92c7277936c8f678afc5f027940 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a87c3471b990f92c7277936c8f678afc5f027940/array_import.py |
elif isinstance(key, int): | elif isintlike(key): | def __getitem__(self, key): if isinstance(key, tuple): row = key[0] col = key[1] if isinstance(col, slice): raise IndexError, "csc_matrix supports slices only of a single"\ " column" elif isinstance(row, slice): return self._getcolslice(row, col) M, N = self.shape if (row < 0): row = M + row if (col < 0): col = N + col... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
elif isinstance(key, int): | elif isintlike(key): | def __getitem__(self, key): if isinstance(key, tuple): row = key[0] col = key[1] if isinstance(row, slice): raise IndexError, "csr_matrix supports slices only of a single"\ " row" elif isinstance(col, slice): return self._getrowslice(row, col) M, N = self.shape if (row < 0): row = M + row if (col < 0): col = N + col if... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
assert isinstance(i, int) and isinstance(j, int) | assert isintlike(i) and isintlike(j) | def get(self, key, default=0.): """This overrides the dict.get method, providing type checking but otherwise equivalent functionality. """ try: i, j = key assert isinstance(i, int) and isinstance(j, int) except (AssertionError, TypeError, ValueError): raise IndexError, "index must be a pair of integers" try: assert not... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(i, int): | if isintlike(i): | def __getitem__(self, key): """If key=(i,j) is a pair of integers, return the corresponding element. If either i or j is a slice or sequence, return a new sparse matrix with just these elements. """ try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers or sli... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(j, int): | if isintlike(j): | def __getitem__(self, key): """If key=(i,j) is a pair of integers, return the corresponding element. If either i or j is a slice or sequence, return a new sparse matrix with just these elements. """ try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers or sli... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(i, int) and isinstance(j, int): | if isintlike(i) and isintlike(j): | def __getitem__(self, key): """If key=(i,j) is a pair of integers, return the corresponding element. If either i or j is a slice or sequence, return a new sparse matrix with just these elements. """ try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers or sli... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if not isinstance(i, int): | if not isintlike(i): | def __getitem__(self, key): """If key=(i,j) is a pair of integers, return the corresponding element. If either i or j is a slice or sequence, return a new sparse matrix with just these elements. """ try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers or sli... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(j, int): | if isintlike(j): | def __getitem__(self, key): """If key=(i,j) is a pair of integers, return the corresponding element. If either i or j is a slice or sequence, return a new sparse matrix with just these elements. """ try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers or sli... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(i, int) and isinstance(j, int): | if isintlike(i) and isintlike(j): | def __setitem__(self, key, value): try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers, slices, or" \ " sequences" i, j = key | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(value, int) and value == 0: | if isintlike(value) and value == 0: | def __setitem__(self, key, value): try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers, slices, or" \ " sequences" i, j = key | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(value, float) or isinstance(value, int) or \ isinstance(value, complex): dict.__setitem__(self, key, value) | if isinstance(value, float) or isintlike(value) or \ isinstance(value, complex): dict.__setitem__(self, key, self.dtype.type(value)) | def __setitem__(self, key, value): try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers, slices, or" \ " sequences" i, j = key | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if not isinstance(i, int): | if not isintlike(i): | def __setitem__(self, key, value): try: assert len(key) == 2 except (AssertionError, TypeError): raise TypeError, "index must be a pair of integers, slices, or" \ " sequences" i, j = key | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if not isinstance(dims, tuple) or not isinstance(dims[0], int): | if not isinstance(dims, tuple) or not isintlike(dims[0]): | def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij = arg1 except: raise TypeError, "invalid input format" elif arg1 is None: # clumsy! We should make ALL arguments # keyword arguments instead! # Initialize an empty matrix. if not isinstance(dims, tupl... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
elif isinstance(i, int): | elif isintlike(i): | def __getitem__(self, index): """Return the element(s) index=(i, j), where j may be a slice. This always returns a copy for consistency, since slices into Python lists return copies. """ try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if type(i) is slice: r... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
elif isinstance(j, int): | elif isintlike(j): | def __getitem__(self, index): """Return the element(s) index=(i, j), where j may be a slice. This always returns a copy for consistency, since slices into Python lists return copies. """ try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if type(i) is slice: r... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(i, int): | if isintlike(i): | def __setitem__(self, index, x): try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if isinstance(i, int): if not (i>=0 and i<self.shape[0]): raise IndexError, "lil_matrix index out of range" else: if isinstance(i, slice): seq = xrange(i.start or 0, i.stop or ... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
if isinstance(j, int): | if isintlike(j): | def __setitem__(self, index, x): try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if isinstance(i, int): if not (i>=0 and i<self.shape[0]): raise IndexError, "lil_matrix index out of range" else: if isinstance(i, slice): seq = xrange(i.start or 0, i.stop or ... | 1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1b4d620ba0b6a4971bb8e328ef4ed29cb29759a7/sparse.py |
def remove_bad_vals(x): # !! Fix axis order when interface changed. # mapping: # NaN -> 0 # Inf -> scipy.limits.double_max # -Inf -> scipy.limits.double_min y = nan_to_num(x) big = scipy.limits.double_max / 10 small = scipy.limits.double_min / 10 y = clip(y,small,big) return y | 5b43b2d6620ff522c8d669022f140895e631dfe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5b43b2d6620ff522c8d669022f140895e631dfe3/interface.py | ||
big = scipy.limits.double_max / 10 small = scipy.limits.double_min / 10 | big = limits.double_max / 10 small = limits.double_min / 10 | def remove_bad_vals(x): # !! Fix axis order when interface changed. # mapping: # NaN -> 0 # Inf -> scipy.limits.double_max # -Inf -> scipy.limits.double_min y = nan_to_num(x) big = scipy.limits.double_max / 10 small = scipy.limits.double_min / 10 y = clip(y,small,big) return y | 5b43b2d6620ff522c8d669022f140895e631dfe3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5b43b2d6620ff522c8d669022f140895e631dfe3/interface.py |
if a[0] != 0.0: outb = b / a[0] outa = a / a[0] else: outb, outa = b, a | b,a = map(MLab.asarray,(b,a)) while a[0] == 0.0: a = a[1:] while b[0] == 0.0: b = b[1:] outb = b * (1.0) / a[0] outa = a * (1.0) / a[0] | def normalize(b,a): if a[0] != 0.0: outb = b / a[0] outa = a / a[0] else: outb, outa = b, a return outb, outa | 52477d3d8b9098fa5178fb8886e5ea9d40db9bb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/52477d3d8b9098fa5178fb8886e5ea9d40db9bb3/filter_design.py |
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. | def iirdesign(wp, ws, gpass, gstop, analog=0, ftype='ellip', output='ba'): """Complete IIR digital and analog filter design. """ try: ordfunc = filter_dict[ftype][1] except KeyError: raise ValueError, "Invalid IIR filter type." except IndexError: raise ValueError, "%s does not have order selection use iirfilter functi... | def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*ta... | 52477d3d8b9098fa5178fb8886e5ea9d40db9bb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/52477d3d8b9098fa5178fb8886e5ea9d40db9bb3/filter_design.py |
Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. | Design an Nth order lowpass digital or analog filter and return the filter coefficients in (B,A) (numerator, denominator) or (Z,P,K) form. | def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*ta... | 52477d3d8b9098fa5178fb8886e5ea9d40db9bb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/52477d3d8b9098fa5178fb8886e5ea9d40db9bb3/filter_design.py |
""" | N -- the order of the filter. Wn -- a scalar or length-2 sequence giving the critical frequencies. rp, rs -- For chebyshev and elliptic filters provides the maximum ripple in the passband and the minimum attenuation in the stop band. btype -- the type of filter (lowpass, highpass, bandpass, or bandstop). analog -- non... | def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*ta... | 52477d3d8b9098fa5178fb8886e5ea9d40db9bb3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/52477d3d8b9098fa5178fb8886e5ea9d40db9bb3/filter_design.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.