bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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... | 0 |
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 |
def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator. | def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator. | 2 |
def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator. | def __init__(self, x, y, z, kind='linear', copy=True, bounds_error=False, fill_value=np.nan): """ Initialize a 2D interpolator. | 3 |
def check_broadcasting(self): a = arange(100).reshape(10,10)[::2] c = arange(10) d = arange(5).reshape(5,1) assert_array_equal(evaluate("a+c"), a+c) assert_array_equal(evaluate("a+d"), a+d) | defexpr = numexpr("2.0*a+3.0*c",[('a',float),('c', float)]) assert_array_equal(expr(a,c), 2.0*a+3.0*c) def check_all_scalar(self): a = 3. b = 4. assert_equal(evaluate("a+b"), a+b) expr = numexpr("2*a+3*b",[('a',float),('b', float)]) assert_equal(expr(a,b), 2*a+3*b) def check_run(self): a = arange(100).reshape(10,10)[... | 4 |
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | 5 |
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csc_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | 6 |
def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec... | def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data *= other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec(other) | 7 |
def __rsub__(self, other): # implement other - self ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'c... | def __rsub__(self, other): # implement other - self ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'c... | 8 |
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco... | def __pow__(self, other): """ Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shap... | 9 |
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco... | def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data ** other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inc... | 10 |
def transpose(self, copy=False): M,N = self.shape new = csr_matrix(N,M,nzmax=0,dtype=self._dtypechar) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new | def transpose(self, copy=False): M,N = self.shape new = csr_matrix((N,M), nzmax=0, dtype=self._dtypechar) if copy: new.data = self.data.copy() new.colind = self.rowind.copy() new.indptr = self.indptr.copy() else: new.data = self.data new.colind = self.rowind new.indptr = self.indptr new._check() return new | 11 |
def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if not (0<=row<M) or not (0<=col<N): raise KeyError, "Index out of bounds." ind, val = func(self.data, self.rowind, self.indptr, row, col) return val elif isinsta... | def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if not (0<=row<M) or not (0<=col<N): raise KeyError, "Index out of bounds." ind, val = func(self.data, self.rowind, self.indptr, row, col) return val elif type(k... | 12 |
def copy(self): M, N = self.shape dtype = self._dtypechar new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | def copy(self): dtype = self._dtypechar new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | 13 |
def copy(self): M, N = self.shape dtype = self._dtypechar new = csc_matrix.Construct(M, N, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | def copy(self): M, N = self.shape dtype = self._dtypechar new = csc_matrix(self.shape, nzmax=0, dtype=dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | 14 |
def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csr_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | def Construct(s, ij=None, M=None ,N=None, nzmax=100, dtype='d', copy=False): """ Allows constructing a csr_matrix by passing: - data, ij, {M,N,nzmax} a[ij[k,0],ij[k,1]] = data[k] - data, (row, ptr) """ # Moved out of the __init__ function for now for simplicity. # I think this should eventually be moved to be a module-... | 15 |
def _check(self): M,N = self.shape nnz = self.indptr[-1] nzmax = len(self.colind) 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) != nzmax): raise ValueError, "Data and row list should have ... | def _check(self): M, N = self.shape nnz = self.indptr[-1] nzmax = len(self.colind) 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) != nzmax): raise ValueError, "Data and row list should have... | 16 |
def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec... | def __mul__(self, other): # implement matrix multiplication and matrix-vector multiplication if isspmatrix(other): return self.matmat(other) elif isscalar(other): new = self.copy() new.data *= other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return self.matvec(other) | 17 |
def __rsub__(self, other): # implement other - self ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] data1, data2 = _convert_data(self.data, other.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar... | def __rsub__(self, other):# implement other - self ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] data1, data2 = _convert_data(self.data, other.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+... | 18 |
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco... | def __pow__(self, other): """ Element-by-element power (unless other is a scalar, in which case return the matrix power.) """ if isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shap... | 19 |
def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data * other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inco... | def __pow__(self, other): if isinstance(other, type(3)): raise NotImplementedError elif isscalar(other): new = self.copy() new.data = new.data ** other new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: ocs = csr_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inc... | 20 |
def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if (row < 0): row = M + row if (col < 0): col = N + col if (row >= M ) or (col >= N) or (row < 0) or (col < 0): raise IndexError, "Index out of bounds." ind, val ... | def __getitem__(self, key): if isinstance(key,types.TupleType): row = key[0] col = key[1] func = getattr(sparsetools,self.ftype+'cscgetel') M, N = self.shape if (row < 0): row = M + row if (col < 0): col = N + col if (row >= M ) or (col >= N) or (row < 0) or (col < 0): raise IndexError, "Index out of bounds." ind, val ... | 21 |
def copy(self): M, N = self.shape new = csr_matrix(M, N, nzmax=0, dtype=self._dtypechar) new.data = self.data.copy() new.colind = self.colind.copy() new.indptr = self.indptr.copy() new._check() return new | def copy(self): new = csr_matrix(self.shape, nzmax=0, dtype=self._dtypechar) new.data = self.data.copy() new.colind = self.colind.copy() new.indptr = self.indptr.copy() new._check() return new | 22 |
def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." keys = self.keys() res = [0]*self.shape[0] for key in keys: res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res) | def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." res = [0]*self.shape[0] for key in keys: res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res) | 23 |
def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." keys = self.keys() res = [0]*self.shape[0] for key in keys: res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res) | def matvec(self, other): other = asarray(other) if other.shape[0] != self.shape[1]: raise ValueError, "Dimensions do not match." keys = self.keys() res = [0]*self.shape[0] for key in self.keys(): res[int(key[0])] += self[key] * other[int(key[1]),...] return array(res) | 24 |
def rmatvec(self, other): other = asarray(other) | def rmatvec(self, other): other = asarray(other) | 25 |
def rmatvec(self, other): other = asarray(other) | def rmatvec(self, other): other = asarray(other) | 26 |
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i... | def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = int(amax(ij[0])) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) ... | 27 |
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i... | def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = int(amax(ij[1])) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) i... | 28 |
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i... | def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = int(amax(aij[:,0])) i... | 29 |
def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i... | def __init__(self, obj, ij, M=None, N=None, nzmax=None, dtype=None): spmatrix.__init__(self) if type(ij) is type(()) and len(ij)==2: if M is None: M = amax(ij[0]) if N is None: N = amax(ij[1]) self.row = asarray(ij[0],'i') self.col = asarray(ij[1],'i') else: aij = asarray(ij,'i') if M is None: M = amax(aij[:,0]) if N i... | 30 |
def solve(A,b,permc_spec=2): if not hasattr(A, 'tocsr') and not hasattr(A, 'tocsc'): raise ValueError, "Sparse matrix must be able to return CSC format--"\ "A.tocsc()--or CSR format--A.tocsr()" if not hasattr(A,'shape'): raise ValueError, "Sparse matrix must be able to return shape (rows,cols) = A.shape" M,N = A.shape ... | def solve(A,b,permc_spec=2): if not hasattr(A, 'tocsr') and not hasattr(A, 'tocsc'): raise ValueError, "Sparse matrix must be able to return CSC format--"\ "A.tocsc()--or CSR format--A.tocsr()" if not hasattr(A,'shape'): raise ValueError, "Sparse matrix must be able to return shape (rows,cols) = A.shape" M, N = A.shape... | 31 |
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... | 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_thres... | 32 |
def _compute_convex_hull(self): """Extract the convex hull from the triangulation information. | def _compute_convex_hull(self): """Extract the convex hull from the triangulation information. | 33 |
def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package) config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config | def configuration(parent_package='',top_path=None): from scipy.distutils.misc_util import Configuration config = Configuration('cluster',parent_package,top_path) config.add_data_dir('tests') config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config | 34 |
def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package) config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config | def configuration(parent_package='',parent_path=None): from scipy.distutils.system_info import get_info package = 'cluster' local_path = get_path(__name__,parent_path) config = Configuration(package,parent_package) config.add_extension('_vq', sources=[join('src', 'vq_wrap.cpp')]) return config | 35 |
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa... | def __init__(self, freq, year=None, month=None, day=None, seconds=None,quarter=None, mxDate=None, val=None): if hasattr(freq, 'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+ori... | 36 |
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa... | def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa... | 37 |
def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa... | def __init__(self,freq,year=None, month=None, day=None, seconds=None,quarter=None, date=None, val=None): if hasattr(freq,'freq'): self.freq = corelib.fmtFreq(freq.freq) else: self.freq = corelib.fmtFreq(freq) self.type = corelib.freqToType(self.freq) if val is not None: if self.freq == 'D': self.__date = val+originDa... | 38 |
def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX",str(self.quarter())) | def strfmt(self, fmt): qFmt = fmt.replace("%q", "XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX",str(self.quarter())) | 39 |
def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX",str(self.quarter())) | def strfmt(self,fmt): qFmt = fmt.replace("%q","XXXX") tmpStr = self.__date.strftime(qFmt) return tmpStr.replace("XXXX", str(self.quarter())) | 40 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B", "D"): return self.strfmt("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return str(self.... | 41 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.strfmt("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return str(self.y... | 42 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.strfmt("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return str(self.y... | 43 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return self.strfmt("%Yq%q") elif self.freq == "A": return str(self.year()) else... | 44 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | 45 |
def __str__(self): if self.freq in ("B","D"): return self.__date.strftime("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return s... | def __str__(self): if self.freq in ("B","D"): return self.strfmt("%d-%b-%y") elif self.freq == "S": return self.__date.strftime("%d-%b-%Y %H:%M:%S") elif self.freq == "M": return self.__date.strftime("%b-%Y") elif self.freq == "Q": return str(self.year())+"q"+str(self.quarter()) elif self.freq == "A": return str(self.y... | 46 |
def __sub__(self, other): try: return self + (-1) * other except: pass try: if self.freq <> other.freq: raise ValueError("Cannont subtract dates of different frequency (" + str(self.freq) + " <> " + str(other.freq) + ")") return int(self) - int(other) except TypeError: raise TypeError("Could not subtract types " + str(... | def __sub__(self, other): try: return self + (-1) * other except: pass try: if self.freq != other.freq: raise ValueError("Cannont subtract dates of different frequency (" + str(self.freq) + " != " + str(other.freq) + ")") return int(self) - int(other) except TypeError: raise TypeError("Could not subtract types " + str(... | 47 |
def __eq__(self, other): if self.freq <> other.freq: raise TypeError("frequencies are not equal!") return int(self) == int(other) | def __eq__(self, other): if self.freq != other.freq: raise TypeError("frequencies are not equal!") return int(self) == int(other) | 48 |
def __cmp__(self, other): if self.freq <> other.freq: raise TypeError("frequencies are not equal!") return int(self)-int(other) | def __cmp__(self, other): if self.freq != other.freq: raise TypeError("frequencies are not equal!") return int(self)-int(other) | 49 |
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, mxDate=tempDat... | 50 |
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | 51 |
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | 52 |
def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | def thisday(freq): freq = corelib.fmtFreq(freq) tempDate = mx.DateTime.now() # if it is Saturday or Sunday currently, freq==B, then we want to use Friday if freq == 'B' and tempDate.day_of_week >= 5: tempDate -= (tempDate.day_of_week - 4) if freq == 'B' or freq == 'D' or freq == 'S': return Date(freq, date=tempDate)... | 53 |
def prevbusday(day_end_hour=18,day_end_min=0): tempDate = mx.DateTime.localtime() dateNum = tempDate.hour + float(tempDate.minute)/60 checkNum = day_end_hour + float(day_end_min)/60 if dateNum < checkNum: return thisday('B') - 1 else: return thisday('B') | def prevbusday(day_end_hour=18,day_end_min=0): tempDate = mx.DateTime.localtime() dateNum = tempDate.hour + float(tempDate.minute)/60 checkNum = day_end_hour + float(day_end_min)/60 if dateNum < checkNum: return thisday('B') - 1 else: return thisday('B') | 54 |
def configuration(parent_package=''): if sys.platform == 'win32': import scipy_distutils.mingw32_support from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path, default_config_dict from scipy_distutils.misc_util import fortran_library_item, dot_join from scipy_distutils.system_info ... | def configuration(parent_package=''): if sys.platform == 'win32': import scipy_distutils.mingw32_support from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path, default_config_dict from scipy_distutils.misc_util import fortran_library_item, dot_join from scipy_distutils.system_info ... | 55 |
def get_package_config(name): sys.path.insert(0,os.path.join('scipy_core',name)) try: mod = __import__('setup_'+name) config = mod.configuration() finally: del sys.path[0] return config | def get_package_config(name): sys.path.insert(0,os.path.join('scipy_core',name)) try: mod = __import__('setup_'+name) config = mod.configuration() finally: del sys.path[0] return config | 56 |
def friedmanchisquare(*args): """ | def friedmanchisquare(*args): """ | 57 |
def friedmanchisquare(*args): """ | def friedmanchisquare(*args): """ | 58 |
def __del__(self): | def__del__(self): | 59 |
def information(self, b, ties='breslow'): | def information(self, b, ties='breslow'): | 60 |
def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func -- the Python ... | def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None, direc=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func --... | 61 |
def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func -- the Python ... | def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): """Minimize a function using modified Powell's method. Description: Uses a modification of Powell's method to find the minimum of a function of N variables Inputs: func -- the Python ... | 62 |
def check_gegenbauer(self): a = 5*rand()-0.5 if any(a==0): a = -0.2 print "Gegenbauer, a = ", a Ca0 = gegenbauer(0,a) Ca1 = gegenbauer(1,a) Ca2 = gegenbauer(2,a) Ca3 = gegenbauer(3,a) Ca4 = gegenbauer(4,a) Ca5 = gegenbauer(5,a) | def check_gegenbauer(self): a = 5*rand()-0.5 if any(a==0): a = -0.2 Ca0 = gegenbauer(0,a) Ca1 = gegenbauer(1,a) Ca2 = gegenbauer(2,a) Ca3 = gegenbauer(3,a) Ca4 = gegenbauer(4,a) Ca5 = gegenbauer(5,a) | 63 |
def check_jv(self): jc = jv(0,.1) assert_almost_equal(jc,0.99750156206604002,8) | def check_jv(self): jc = jv(0,.1) assert_almost_equal(jc,0.99750156206604002,8) | 64 |
def fmin_tnc(func, x0, fprime=None, args=(), approx_grad=False, bounds=None, epsilon=1e-8, scale=None, messages=MSG_ALL, maxCGit=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=0, rescale=-1): """Minimize a function with variables subject to bounds, using gradient information. returns (rc, nfeval, x). Inp... | def fmin_tnc(func, x0, fprime=None, args=(), approx_grad=False, bounds=None, epsilon=1e-8, scale=None, messages=MSG_ALL, maxCGit=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=0, rescale=-1): """Minimize a function with variables subject to bounds, using gradient information. returns (rc, nfeval, x). Inp... | 65 |
def func_and_grad(x): x = asarray(x) f = func(x, *args) g = fprime(x, *args) return f, list(g) | def func_and_grad(x): x = asarray(x) f = func(x, *args) g = fprime(x, *args) return f, list(g) | 66 |
def function(x): f = pow(x[0],2.0)+pow(abs(x[1]),3.0) g = [0,0] g[0] = 2.0*x[0] g[1] = 3.0*pow(abs(x[1]),2.0) if x[1]<0: g[1] = -g[1] return f, g | def function(x): f = pow(x[0],2.0)+pow(abs(x[1]),3.0) g = [0,0] g[0] = 2.0*x[0] g[1] = 3.0*pow(abs(x[1]),2.0) if x[1]<0: g[1] = -g[1] return f, g | 67 |
def test(fg, x, bounds, xopt): print "** Test", fg.__name__ rc, nf, x = minimize(fg, x, bounds=bounds, messages = MSG_NONE, maxnfeval = 200) print "After", nf, "function evaluations, TNC returned:", RCSTRINGS[rc] print "x =", x print "exact value =", xopt enorm = 0.0 norm = 1.0 for y,yo in zip(x, xopt): enorm += (y-yo... | def test(fg, x, bounds, xopt): print "** Test", fg.__name__ rc, nf, x = fmin_tnc(fg, x, bounds=bounds, messages = MSG_NONE, maxnfeval = 200) print "After", nf, "function evaluations, TNC returned:", RCSTRINGS[rc] print "x =", x print "exact value =", xopt enorm = 0.0 norm = 1.0 for y,yo in zip(x, xopt): enorm += (y-yo... | 68 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr... | 69 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSC format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: #s = asarr... | 70 |
def copy(self): new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | def copy(self): new = csc_matrix(self.shape, nzmax=self.nzmax, dtype=self.dtype) new.data = self.data.copy() new.rowind = self.rowind.copy() new.indptr = self.indptr.copy() new._check() return new | 71 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | 72 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | 73 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | 74 |
def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | def __init__(self, arg1, dims=None, nzmax=NZMAX, dtype=None, copy=False): spmatrix.__init__(self) if isdense(arg1): self.dtype = getdtype(dtype, arg1) # Convert the dense array or matrix arg1 to CSR format if rank(arg1) == 1: # Convert to a row vector arg1 = arg1.reshape(1, arg1.shape[0]) if rank(arg1) == 2: s = arg1 o... | 75 |
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | 76 |
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | 77 |
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | 78 |
def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | def resize(self, shape): """ Resize the matrix to dimensions given by 'shape', removing any non-zero elements that lie outside. """ M, N = self.shape try: newM, newN = shape assert newM == int(newM) and newM > 0 assert newN == int(newN) and newN > 0 except (TypeError, ValueError, AssertionError): raise TypeError, "dime... | 79 |
def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij_in = 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, t... | 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... | 80 |
def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij_in = 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, t... | def __init__(self, arg1, dims=None, dtype=None): spmatrix.__init__(self) if isinstance(arg1, tuple): try: obj, ij_in = 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, t... | 81 |
def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex) c.real = a c.imag = b return c | def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c | 82 |
def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex) c.real = a c.imag = b return c | def complex(a, b, complex=__builtins__.complex): c = zeros(a.shape, dtype=complex) c.real = a c.imag = b return c | 83 |
def seed(x=0,y=0): """seed(x, y), set the seed using the integers x, y; Set a random one from clock if y == 0 """ if type (x) != types.IntType or type (y) != types.IntType : raise ArgumentError, "seed requires integer arguments." if y == 0: import random y = int(rv.initial_seed()) x = random.randint(1,2**31-1) rand.se... | def seed(x=0,y=0): """seed(x, y), set the seed using the integers x, y; Set a random one from clock if y == 0 """ if type (x) != types.IntType or type (y) != types.IntType : raise ArgumentError, "seed requires integer arguments." if y == 0: import random y = int(rv.initial_seed()) x = random.randint(1,2**31-2) rand.s... | 84 |
def _getIndx( self, mtx ): | def _getIndx( self, mtx ): | 85 |
def _getIndx( self, mtx ): | def _getIndx( self, mtx ): | 86 |
def report_info( self ): """Print all status information.""" self.funs.report_info( self.control, self.info ) | def report_info( self ): """Print all status information. Output depends on self.control[UMFPACK_PRL].""" self.funs.report_info( self.control, self.info ) | 87 |
def test_smallest_int_sctype(self): # Smallest int sctype with testing recaster params = sctype_attributes() mmax = params[N.int32]['max'] mmin = params[N.int32]['min'] for kind in ('int', 'uint'): for T in N.sctypes[kind]: mx = params[T]['max'] mn = params[T]['min'] rt = self.recaster.smallest_int_sctype(mx, mn) if mx... | def test_smallest_int_sctype(self): # Smallest int sctype with testing recaster params = sctype_attributes() mmax = params[N.int32]['max'] mmin = params[N.int32]['min'] for kind in ('int', 'uint'): for T in N.sctypes[kind]: mx = params[T]['max'] mn = params[T]['min'] rt = self.recaster.smallest_int_sctype(mx, mn) if mx... | 88 |
## def __del__(self): | ## def __del__(self): | 89 |
def __init__(self, parent): | def__init__(self,parent): | 90 |
def __init__(self, parent): | def __init__(self, parent): | 91 |
def __init__(self, parent): | def __init__(self, parent): | 92 |
def is_alive(obj): if obj() is None: return 0 else: return 1 | 93 | |
def check_wx_class(self): "Checking a wxFrame proxied class" for i in range(5): f = gui_thread.register(TestFrame) a = f(None) p = weakref.ref(a) a.Close(1) del a time.sleep(0.25) # sync threads # this checks for memory leaks self.assertEqual(is_alive(p), 0) | def check_wx_class(self): "Checking a wxFrame proxied class" for i in range(5): f = gui_thread.register(TestFrame) a = f(None) p = weakref.ref(a) a.Close(1) del a yield() # sync threads # this checks for memory leaks self.assertEqual(is_alive(p), 0) | 94 |
def check_normal_class(self): "Checking non-wxWindows proxied class " f = gui_thread.register(TestClass) a = f() p = weakref.ref(a) # the reference count has to be 2. self.assertEqual(sys.getrefcount(a), 2) del a self.assertEqual(is_alive(p), 0) | def check_normal_class(self): "Checking non-wxWindows proxied class " f = gui_thread.register(TestClass) a = f() p = weakref.ref(a) # the reference count has to be 2. self.assertEqual(sys.getrefcount(a), 2) del a self.assertEqual(is_alive(p), 0) | 95 |
def test(): all_tests = test_suite() runner = unittest.TextTestRunner(verbosity=2) runner.run(all_tests) | def test(): all_tests = test_suite() runner = unittest.TextTestRunner(verbosity=2) runner.run(all_tests) | 96 |
def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Hello Test") test() self.Close(1) | def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Tester") self.CreateStatusBar() sizer = wxBoxSizer(wxHORIZONTAL) ID = NewId() btn = wxButton(self, ID, "Start Test") EVT_BUTTON(self, ID, self.OnStart) msg = "Click to start running tests. "\ "Tester Output will be shown on the shell." btn.SetToolTip(wxTo... | 97 |
def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Hello Test") test() self.Close(1) | def __init__(self, parent): wxFrame.__init__(self, parent, -1, "Hello Test") test() self.Close(1) | 98 |
def configuration(parent_package='',parent_path=None): from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path,\ default_config_dict, dot_join from scipy_distutils.system_info import dict_append, get_info package = 'special' config = default_config_dict(package,parent_package) local_p... | def configuration(parent_package='',parent_path=None): from scipy_distutils.core import Extension from scipy_distutils.misc_util import get_path,\ default_config_dict, dot_join from scipy_distutils.system_info import dict_append, get_info package = 'special' config = default_config_dict(package,parent_package) local_p... | 99 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.