bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,400 |
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,401 |
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,402 |
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,403 |
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,404 |
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk) | 1,405 |
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) ... | 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 = old_fval ... | 1,406 |
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) ... | 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) ... | 1,407 |
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) ... | 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) ... | 1,408 |
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) ... | 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) ... | 1,409 |
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) ... | 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) ... | 1,410 |
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... | 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... | 1,411 |
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... | 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... | 1,412 |
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... | 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... | 1,413 |
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... | 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... | 1,414 |
def _scalarfunc(*params): params = squeeze(asarray(params)) return func(params,*args) | def _scalarfunc(*params): params = squeeze(asarray(params)) return func(params,*args) | 1,415 |
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 ... | 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 ... | 1,416 |
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 | 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 | 1,417 |
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) | 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 return where(cond > 0,val1**ic,val2**ic) | 1,418 |
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... | 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(target,'w') f.write(tmpl_empty_clapack_pyf) f.close() else: ta... | 1,419 |
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... | 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... | 1,420 |
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... | 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... | 1,421 |
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... | 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... | 1,422 |
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... | 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... | 1,423 |
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... | 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... | 1,424 |
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 ... | 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 ... | 1,425 |
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 ... | 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 ... | 1,426 |
def _check(self): M,N = self.shape nnz = self.indptr[-1] nzmax = len(self.rowind) | def _check(self): M,N = self.shape nnz = self.indptr[-1] nzmax = len(self.rowind) | 1,427 |
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 =... | 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 if isinstance(bmat,csr_matrix): bmat._check() func = getattr(sparsetools,ftype+'cscmucsr') b = bmat.data rowb = bmat.colind ptrb = bmat.i... | 1,428 |
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) !=... | 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) !=... | 1,429 |
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 =... | def matmat(self, bmat): self._check() M,K1 = self.shape K2,N = bmat.shape a, rowa, ptra = self.data, self.colind, self.indptr if (K1 != K2): raise ValueError, "Shape mismatch error." if isinstance(bmat,csc_matrix): bmat._check() func = getattr(sparsetools,ftype+'csrmucsc') b = bmat.data colb = bmat.rowind ptrb = bmat.i... | 1,430 |
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 =... | 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 =... | 1,431 |
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... | 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.indptr,permc_spec, diag_pivot_thresh... | 1,432 |
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) | def check_1D_array(self): a = array((1,2,3,4),Float64) actual= stats.hmean(a) desired = 4. / (1./1 + 1./2 + 1./3 + 1./4) assert_almost_equal(desired,actual,decimal=14) | 1,433 |
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, '... | 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. The proxied class is wrapped by the smart_class that returns a proxied or normal instance depending on where the ... | 1,434 |
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, '... | 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 smart_class(wx_class, proxify(wx_class)) else: if ... | 1,435 |
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(%... | 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) dkw = dereference_dict(kw) %(arguments)s # inserts proxied object up front ret_val = None if in_pr... | 1,436 |
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(%... | 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(%... | 1,437 |
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(%... | 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(%... | 1,438 |
def is_proxy_attr(x): hasattr(x, 'x._proxy_attr__dont_mess_with_me_unless_you_know_what_youre_doing') | def is_proxy_attr(x): return hasattr(x, 'x._proxy_attr__dont_mess_with_me_unless_you_know_what_youre_doing') | 1,439 |
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 | 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): obj = get_proxy_attr_obj(arg) if is_proxy(obj): res.append(obj.wx_obj) else: res.append(obj) else: ... | 1,440 |
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... | 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... | 1,441 |
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... | 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... | 1,442 |
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... | def configuration(parent_package='',top_path=None): import numpy from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info config = Configuration( 'umfpack', parent_package, top_path ) config.add_data_dir('tests') umf_info = get_info( 'umfpack', notfound_action = 1 ) if umf_... | 1,443 |
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... | 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... | 1,444 |
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... | 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... | 1,445 |
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... | 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... | 1,446 |
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... | 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... | 1,447 |
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. ... | 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. ... | 1,448 |
def check_complex_expr(self): | def check_complex_expr(self): | 1,449 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,450 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,451 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,452 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,453 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,454 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,455 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,456 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,457 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,458 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,459 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,460 |
def complex(a, b): c = zeros(a.shape, dtype=complex_) | def complex(a, b): c = zeros(a.shape, dtype=complex_) | 1,461 |
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: ... | 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: ... | 1,462 |
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 | def take(self, cols_or_rows, columns=1): # Extract columns or rows as indictated from matrix res = dictmatrix() indx = int((columns == 1)) 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()... | 1,463 |
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... | 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(target,'w') f.write(tmpl_empty_cblas_pyf) f.close() else: target = ext.depen... | 1,464 |
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... | 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... | 1,465 |
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... | 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])... | 1,466 |
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... | 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]])... | 1,467 |
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) #--------------------------... | 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) #--------------------------... | 1,468 |
def initialize(self, subjects): | def initialize(self, subjects): | 1,469 |
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... | 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... | 1,470 |
def check_complex1(self): assert(isnan(array(1+1j)/0.) == 0) | def check_complex1(self): assert(isnan(array(0+0j)/0.) == 1) | 1,471 |
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)) | 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)) | 1,472 |
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)) | def check_complex_bad2(self): v = 1+1j v += array(-1+1.j)/0. vals = nan_to_num(v) assert(isfinite(vals)) # !! This is actually (unexpectedly) positive # !! inf. Comment out for now, and see if it # !! changes #assert(vals.real < -1e10 and isfinite(vals)) | 1,473 |
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... | def OnFileSaveAs(self, event): import os 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.ShowModal() == wx.wxID_OK: f = dlg.GetPath() dummy, ftype = os.pa... | 1,474 |
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... | 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|" \ "All Files |*|" dlg = wx.wxFileDialog(self, "Save As", ... | 1,475 |
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... | 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 _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 =... | 1,476 |
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... | 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... | 1,477 |
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... | 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... | 1,478 |
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... | def get(self, key, default=0.): """This overrides the dict.get method, providing type checking but otherwise equivalent functionality. """ try: i, j = key assert isintlike(i) and isintlike(j) except (AssertionError, TypeError, ValueError): raise IndexError, "index must be a pair of integers" try: assert not (i < 0 or i... | 1,479 |
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... | 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... | 1,480 |
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... | 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... | 1,481 |
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... | 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... | 1,482 |
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... | 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... | 1,483 |
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... | 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... | 1,484 |
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 | 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 | 1,485 |
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 | 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 | 1,486 |
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 | 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 | 1,487 |
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 | 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 | 1,488 |
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... | 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... | 1,489 |
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... | 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... | 1,490 |
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... | 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... | 1,491 |
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 ... | def __setitem__(self, index, x): try: assert len(index) == 2 except (AssertionError, TypeError): raise IndexError, "invalid index" i, j = index if isintlike(i): 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 self.s... | 1,492 |
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 ... | 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 ... | 1,493 |
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 | 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 | 1,494 |
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 | 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 = limits.double_max / 10 small = limits.double_min / 10 y = clip(y,small,big) return y | 1,495 |
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 | def normalize(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] return outb, outa | 1,496 |
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... | 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... | 1,497 |
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... | def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. 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. Inputs: """ #pre-warp frequencies for digital filter desi... | 1,498 |
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... | 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: N -- the order of the filter. Wn -- a scalar or length-2 sequence giving the critica... | 1,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.