rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
ocs = csr_matrix(other)
ocs = other.tocsc()
def __rmul__(self, other): # other * self if isspmatrix(other): ocs = csr_matrix(other) return occ.matmat(self) elif isscalar(other): new = self.copy() new.data = other * new.data new._dtypechar = new.data.dtypechar new.ftype = _transtabl[new._dtypechar] return new else: return transpose(self.rmatvec(transpose(other),...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
new.data = -new.data
new.data *= -1
def __neg__(self): new = self.copy() new.data = -new.data return new
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
ocs = csr_matrix(other)
if isscalar(other): raise NotImplementedError('subtracting a scalar from a sparse matrix is not yet supported') elif isspmatrix(other): ocs = other.tocsr() if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar, ocs._dtypechar)] data1, data2 = _convert_data(s...
def __sub__(self, other): 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]+'cscadd') c,colc,ptrc,ier...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] data1, data2 = _convert_data(self.data, other.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'cscadd') c,colc,ptrc,ierr = func(data1,self.colind,self.indptr,-data2,other.colind,other.indptr) if ierr: raise ValueError, "Ran out of space (bu...
dtypechar = _coerce_rules[(self._dtypechar, ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar)
def __sub__(self, other): 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]+'cscadd') c,colc,ptrc,ier...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
ocs = csr_matrix(other)
ocs = other.tocsr()
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.sha...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)]
dtypechar = _coerce_rules[(self._dtypechar, ocs._dtypechar)]
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.sha...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
c,colc,ptrc,ierr = func(data1,self.colind,self.indptr,data2,ocs.colind,ocs.indptr)
c,colc,ptrc,ierr = func(data1,self.colind,self.indptr,data2, ocs.colind, ocs.indptr)
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.sha...
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
if isinstance(other, dok_matrix):
if isscalar(other): raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') elif isinstance(other, dok_matrix):
def __add__(self, other): if isinstance(other, dok_matrix): res = dok_matrix() res.update(self) res.shape = self.shape res.nnz = self.nnz for key in other.keys(): res[key] += other[key] else: csc = self.tocsc() res = csc + other return res
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
if isinstance(other, dok_matrix):
if isscalar(other): raise NotImplementedError('subtracting a scalar from a sparse matrix is not yet supported') elif isinstance(other, dok_matrix):
def __sub__(self, other): if isinstance(other, dok_matrix): res = dok_matrix() res.update(self) res.shape = self.shape res.nnz = self.nnz for key in other.keys(): res[key] -= other[key] else: csc = self.tocsc() res = csc - other return res
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
if isinstance(other, spmatrix):
if isspmatrix(other):
def __mul__(self, other): if isinstance(other, spmatrix): return self.matmat(other) other = asarray(other) if rank(other) > 0: return self.matvec(other) res = dok_matrix() for key in self.keys(): res[key] = other * self[key] return res
bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std.
def bayes_mvs(data,alpha=0.90): """Return Bayesian confidence intervals for the mean, var, and std.
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior for variance and std. alpha gives the probability that the returned interval contains the true parameter. """ x = ravel(data) n = len(x) assert(...
8eb9a24ddb25de152b74631da8a514f5ff59eb4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8eb9a24ddb25de152b74631da8a514f5ff59eb4f/morestats.py
alpha gives the probability that the returned interval contains the true parameter.
alpha gives the probability that the returned interval contains the true parameter. Uses peak of conditional pdf as starting center.
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior for variance and std. alpha gives the probability that the returned interval contains the true parameter. """ x = ravel(data) n = len(x) assert(...
8eb9a24ddb25de152b74631da8a514f5ff59eb4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8eb9a24ddb25de152b74631da8a514f5ff59eb4f/morestats.py
q1 = (1-alpha)/2.0 q2 = (1+alpha)/2.0 a = (n-1)/2.0
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior for variance and std. alpha gives the probability that the returned interval contains the true parameter. """ x = ravel(data) n = len(x) assert(...
8eb9a24ddb25de152b74631da8a514f5ff59eb4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8eb9a24ddb25de152b74631da8a514f5ff59eb4f/morestats.py
va = fac*distributions.invgamma.ppf(q1,a)
peak = 2/(n+1.) a = (n-1)/2.0 F_peak = distributions.invgamma.cdf(peak,a) q1 = F_peak - alpha/2.0 q2 = F_peak + alpha/2.0 if (q1 < 0): q2 = alpha va = 0.0 else: va = fac*distributions.invgamma.ppf(q1,a)
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior for variance and std. alpha gives the probability that the returned interval contains the true parameter. """ x = ravel(data) n = len(x) assert(...
8eb9a24ddb25de152b74631da8a514f5ff59eb4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8eb9a24ddb25de152b74631da8a514f5ff59eb4f/morestats.py
return (ma,mb),(va,vb),(sqrt(va),sqrt(vb))
fac = sqrt(fac) peak = sqrt(2./n) F_peak = distributions.gengamma.cdf(peak,a,-2) q1 = F_peak - alpha/2.0 q2 = F_peak + alpha/2.0 if (q1 < 0): q2 = alpha sta = 0.0 else: sta = fac*distributions.gengamma.ppf(q1,a,-2) stb = fac*distributions.gengamma.ppf(q2,a,-2) return (ma,mb),(va,vb),(sta,stb)
def bayes_mvs(data,alpha=0.95): """Return bayesian confidence intervals for the mean, var, and std. Assumes 1-d data all has same mean and variance and uses Jeffrey's prior for variance and std. alpha gives the probability that the returned interval contains the true parameter. """ x = ravel(data) n = len(x) assert(...
8eb9a24ddb25de152b74631da8a514f5ff59eb4f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8eb9a24ddb25de152b74631da8a514f5ff59eb4f/morestats.py
return special.bdtr(k,n,pr)
sv = errp(0) vals = special.bdtr(k,n,pr) sv = errp(sv) return where(k>=0,vals,0.0)
def binomcdf(k, n, pr=0.5): return special.bdtr(k,n,pr)
1212fca291b906e7a58aa4b6ff07210ab8396548 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1212fca291b906e7a58aa4b6ff07210ab8396548/distributions.py
return special.bdtrc(k,n,pr)
sv = errp(0) vals = special.bdtrc(k,n,pr) sv = errp(sv) return where(k>=0,vals,1.0)
def binomsf(k, n, pr=0.5): return special.bdtrc(k,n,pr)
1212fca291b906e7a58aa4b6ff07210ab8396548 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1212fca291b906e7a58aa4b6ff07210ab8396548/distributions.py
cond2 = (pr >= 1) || (pr <=0)
cond2 = (pr >= 1) | (pr <=0)
def nbinompdf(k, n, pr=0.5): k = arr(k) cond2 = (pr >= 1) || (pr <=0) cond1 = arr((k > n) & (k == floor(k))) sv =errp(0) temp = special.nbdtr(k,n,pr) temp2 = special.nbdtr(k-1,n,pr) sv = errp(sv) return select([cond2,cond1,k==n], [scipy.nan,temp-temp2,temp],0.0)
1212fca291b906e7a58aa4b6ff07210ab8396548 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1212fca291b906e7a58aa4b6ff07210ab8396548/distributions.py
k, K = 0, len(stream._buffer)
k, K = stream.linelist[0], len(stream._buffer)
def getcolumns(stream, columns, separator): comment = stream.comment lenc = stream.lencomment k, K = 0, len(stream._buffer) while k < K: firstline = stream._buffer[k] if firstline != '' and firstline[:lenc] != comment: break k = k + 1 if k == K: raise ValueError, "No data found in file." firstline = stream._buffer[k] N...
2c7ddabac96db7f22e42a1a9842367473ecf7f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2c7ddabac96db7f22e42a1a9842367473ecf7f28/array_import.py
raise ValueError, "No data found in file."
raise ValueError, "First line to read not within %d lines of top." % K
def getcolumns(stream, columns, separator): comment = stream.comment lenc = stream.lencomment k, K = 0, len(stream._buffer) while k < K: firstline = stream._buffer[k] if firstline != '' and firstline[:lenc] != comment: break k = k + 1 if k == K: raise ValueError, "No data found in file." firstline = stream._buffer[k] N...
2c7ddabac96db7f22e42a1a9842367473ecf7f28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2c7ddabac96db7f22e42a1a9842367473ecf7f28/array_import.py
assert_array_almost_equal(row*M, row*M.todense())
def check_rmatvec(self): M = self.spmatrix(matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]])) assert_array_almost_equal([1,2,3,4]*M, dot([1,2,3,4], M.toarray())) row = matrix([[1,2,3,4]]) # This doesn't work since row*M computes incorrectly when row is 2d. # NumPy needs special hooks for this. # assert_array_almost_equal(row...
8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e/test_sparse.py
assert_array_almost_equal((a*bsp).todense(), a*b)
def check_matmat(self): a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) a2 = array([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) b = matrix([[0,1],[1,0],[0,2]],'d') asp = self.spmatrix(a) bsp = self.spmatrix(b) assert_array_almost_equal((asp*bsp).todense(), a*b) assert_array_almost_equal((asp*b).todense(), a*b) # The following ...
8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e/test_sparse.py
assert_array_almost_equal((a*csp).todense(), a*c)
def check_matmat(self): a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) a2 = array([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) b = matrix([[0,1],[1,0],[0,2]],'d') asp = self.spmatrix(a) bsp = self.spmatrix(b) assert_array_almost_equal((asp*bsp).todense(), a*b) assert_array_almost_equal((asp*b).todense(), a*b) # The following ...
8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e/test_sparse.py
assert_array_almost_equal((a*csp).todense(), a*c)
def check_matmat(self): a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) a2 = array([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) b = matrix([[0,1],[1,0],[0,2]],'d') asp = self.spmatrix(a) bsp = self.spmatrix(b) assert_array_almost_equal((asp*bsp).todense(), a*b) assert_array_almost_equal((asp*b).todense(), a*b) # The following ...
8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e/test_sparse.py
assert_array_almost_equal((a*csp).todense(), a*c)
def check_matmat(self): a = matrix([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) a2 = array([[3,0,0],[0,1,0],[2,0,3.0],[2,3,0]]) b = matrix([[0,1],[1,0],[0,2]],'d') asp = self.spmatrix(a) bsp = self.spmatrix(b) assert_array_almost_equal((asp*bsp).todense(), a*b) assert_array_almost_equal((asp*b).todense(), a*b) # The following ...
8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/8bd9c0df1a0f69f33a82dd75ce309f60bfaa670e/test_sparse.py
z = self.dot(x) + self.dot(y) - 2*self.dot(x, y)
z = self.dot(x, x) + self.dot(y, y) - 2*self.dot(x, y)
def __call__(self, x, y): z = self.dot(x) + self.dot(y) - 2*self.dot(x, y) return N.exp(-self.gamma*z)
2b9d8523e995155e18bf5d5776dd3d9351dacdb9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2b9d8523e995155e18bf5d5776dd3d9351dacdb9/kernel.py
def blackman(M):
def triang(M,sym=1): """The M-point triangular window. """ if M < 1: return Numeric.array([]) if M == 1: return Numeric.ones(1,'d') odd = M % 2 if not sym and not odd: M = M + 1 n = grid[1:(M+1)/2+1] if M % 2 == 0: w = (2*n-1.0)/M w = r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = r_[w, w[-2::-1]] if not sym and not odd: w ...
def blackman(M): """The M-point Blackman window. """ n = arange(0,M) return 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1)) def bartlett(M):
w = 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1)) if not sym and not odd: w = w[:-1] return w def bartlett(M,sym=1):
def blackman(M): """The M-point Blackman window. """ n = arange(0,M) return 0.42-0.5*cos(2.0*pi*n/(M-1)) + 0.08*cos(4.0*pi*n/(M-1))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) def hanning(M):
w = where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) if not sym and not odd: w = w[:-1] return w def hanning(M,sym=1):
def bartlett(M): """The M-point Bartlett window. """ n = arange(0,M) return where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return 0.5-0.5*cos(2.0*pi*n/(M-1)) def hamming(M):
w = 0.5-0.5*cos(2.0*pi*n/(M-1)) if not sym and not odd: w = w[:-1] return w def hamming(M,sym=1):
def hanning(M): """The M-point Hanning window. """ n = arange(0,M) return 0.5-0.5*cos(2.0*pi*n/(M-1))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
n = arange(0,M) return 0.54-0.46*cos(2.0*pi*n/(M-1)) def kaiser(M,beta):
if M < 1: return Numeric.array([]) if M == 1: return Numeric.ones(1,'d') odd = M % 2 if not sym and not odd: M = M+1 n = arange(0,M) w = 0.54-0.46*cos(2.0*pi*n/(M-1)) if not sym and not odd: w = w[:-1] return w def kaiser(M,beta,sym=1):
def hamming(M): """The M-point Hamming window. """ n = arange(0,M) return 0.54-0.46*cos(2.0*pi*n/(M-1))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta) def gaussian(M,std):
w = special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta) if not sym and not odd: w = w[:-1] return w def gaussian(M,std,sym=1):
def kaiser(M,beta): """Returns a Kaiser window of length M with shape parameter beta. """ n = arange(0,M) alpha = (M-1)/2.0 return special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta)
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return exp(-n**2 / sig2) def general_gaussian(M,p,sig):
w = exp(-n**2 / sig2) if not sym and not odd: w = w[:-1] return w def general_gaussian(M,p,sig,sym=1):
def gaussian(M,std): """Returns a Gaussian window of length M with standard-deviation std. """ n = arange(0,M)-(M-1.0)/2.0 sig2 = 2*std*std return exp(-n**2 / sig2)
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return exp(-0.5*(n/sig)**(2*p))
w = exp(-0.5*(n/sig)**(2*p)) if not sym and not odd: w = w[:-1] return w
def general_gaussian(M,p,sig): """Returns a window with a generalized Gaussian shape. exp(-0.5*(x/sig)**(2*p)) half power point is at (2*log(2)))**(1/(2*p))*sig """ n = arange(0,M)-(M-1.0)/2.0 return exp(-0.5*(n/sig)**(2*p))
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1]
a(s) a[0] x**(N-1) + a[1] x**(N-2) + ... + a[N-1]
def invres(r,p,k,tol=1e-3,rtype='avg'): """Compute b(s) and a(s) from partial fraction expansion: r,p,k If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1]
b(s) b[0] s**(M-1) + b[1] s**(M-2) + ... + b[M-1]
def residue(b,a,tol=1e-3,rtype='avg'): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] ...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1]
a(s) a[0] s**(N-1) + a[1] s**(N-2) + ... + a[N-1]
def residue(b,a,tol=1e-3,rtype='avg'): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] ...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
def residuez(b,a,tol=1e-3): pass def _get_window(window,Nx):
def residuez(b,a,tol=1e-3,rtype='avg'): """Compute partial-fraction expansion of b(z) / a(z). If M = len(b) and N = len(a) b(z) b[0] + b[1] z**(-1) + ... + b[M-1] z**(-M+1) H(z) = ------ = ---------------------------------------------- a(z) a[0] + a[1] z**(-1) + ... + a[N-1] z**(-N+1) r[0] ...
def residuez(b,a,tol=1e-3): pass
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
def _get_window(window,Nx): try: beta = float(window) except (TypeError, ValueError): args = () if isinstance(window, types.TupleType): winstr = window[0] if len(window) > 1: args = window[1:] elif isinstance(window, types.StringType): if window in ['kaiser', 'ksr', 'gaussian', 'gauss', 'gss', 'general gaussian', 'gene...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
params = (Nx,)+args
params = (Nx,)+args + (sym,)
def _get_window(window,Nx): try: beta = float(window) except (TypeError, ValueError): args = () if isinstance(window, types.TupleType): winstr = window[0] if len(window) > 1: args = window[1:] elif isinstance(window, types.StringType): if window in ['kaiser', 'ksr', 'gaussian', 'gauss', 'gss', 'general gaussian', 'gene...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
params = (Nx,beta)
params = (Nx,beta,sym)
def _get_window(window,Nx): try: beta = float(window) except (TypeError, ValueError): args = () if isinstance(window, types.TupleType): winstr = window[0] if len(window) > 1: args = window[1:] elif isinstance(window, types.StringType): if window in ['kaiser', 'ksr', 'gaussian', 'gauss', 'gss', 'general gaussian', 'gene...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
def resample(x,num,axis=0,window=None):
def resample(x,num,t=None,axis=0,window=None):
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
non, band-limited signals.
sampled signals you didn't intend to be interpreted as band-limited.
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
from scipy import fft,ifft
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
W = _get_window(window,Nx)
W = ifftshift(get_window(window,Nx)) newshape = ones(len(x.shape)) newshape[axis] = len(W) W.shape = newshape
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return y.real
y = y.real if t is None: return y
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
return y
new_t = arange(0,num)*(t[1]-t[0])* Nx / float(num) + t[0] return y, new_t
def resample(x,num,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. Window controls a Fourier-domain window that tapers the Fourier spectrum before zero-padding to aleviate ringing in the resampled values for non, band-limited signals. If window is a string then use the named...
c910a765560a2edce76e1be8b2a9eead5b434b0d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c910a765560a2edce76e1be8b2a9eead5b434b0d/signaltools.py
"""Triangular Distribution up-sloping line from loc to (loc + c*scale) and then downsloping for (loc + c*scale) to (loc+scale). standard form is in range [0,1] with c the mode location parameter shifts the start to loc scale changes the width from 1 to scale """
def _entropy(self): return 0.64472988584940017414
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
class truncnorm_gen(norm_gen):
class truncnorm_gen(rv_continuous):
def _entropy(self, b): eB = exp(b) return log(eB-1)+(1+eB*(b-1.0))/(1.0-eB)
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
self.nb = norm_gen._cdf(self,b) self.na = norm_gen._cdf(self,a)
self.nb = norm._cdf(b) self.na = norm._cdf(a)
def _argcheck(self, a, b): self.a = a self.b = b self.nb = norm_gen._cdf(self,b) self.na = norm_gen._cdf(self,a) return (a != b)
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
return norm_gen._pdf(self, x) / (self.nb - self.na)
return norm._pdf(x) / (self.nb - self.na)
def _pdf(self, x, a, b): return norm_gen._pdf(self, x) / (self.nb - self.na)
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
return (norm_gen._cdf(self, x) - self.na) / (self.nb - self.na)
return (norm._cdf(x) - self.na) / (self.nb - self.na)
def _cdf(self, x, a, b): return (norm_gen._cdf(self, x) - self.na) / (self.nb - self.na)
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
return norm_gen._ppf(self, q*self.nb + self.na*(1.0-q))
return norm._ppf(q*self.nb + self.na*(1.0-q))
def _ppf(self, q, a, b): return norm_gen._ppf(self, q*self.nb + self.na*(1.0-q))
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
pA, pB = norm_gen._pdf(self, a), norm_gen._pdf(self, b)
pA, pB = norm._pdf(a), norm._pdf(b)
def _stats(self, a, b): nA, nB = self.na, self.nb d = nB - nA pA, pB = norm_gen._pdf(self, a), norm_gen._pdf(self, b) mu = (pB - pA) / d mu2 = 1 + (a*pA - b*pB) / d - mu*mu return mu, mu2, None, None
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
Truncated Normal distribution
Truncated Normal distribution. The standard form of this distribution is a standard normal truncated to the range [a,b] --- notice that a and b are defined over the domain of the standard normal.
def _stats(self, a, b): nA, nB = self.na, self.nb d = nB - nA pA, pB = norm_gen._pdf(self, a), norm_gen._pdf(self, b) mu = (pB - pA) / d mu2 = 1 + (a*pA - b*pB) / d - mu*mu return mu, mu2, None, None
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
def integ(p): return log(pow(p,lam-1)+pow(1-p,lam-1))
a8eec3d63a6c9d8f74c368b9fcf817909bb48d71 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a8eec3d63a6c9d8f74c368b9fcf817909bb48d71/distributions.py
nbd = NA.zeros((n,), NA.Int)
nbd = NA.zeros((n,), NA.Int32)
def func_and_grad(x): f = func(x, *args) g = fprime(x, *args) return f, g
4f45d3d90a3ca78491a1a589df0d34c7a011e42d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4f45d3d90a3ca78491a1a589df0d34c7a011e42d/lbfgsb.py
iwa = NA.zeros((3*n,), NA.Int)
iwa = NA.zeros((3*n,), NA.Int32)
def func_and_grad(x): f = func(x, *args) g = fprime(x, *args) return f, g
4f45d3d90a3ca78491a1a589df0d34c7a011e42d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4f45d3d90a3ca78491a1a589df0d34c7a011e42d/lbfgsb.py
lsave = NA.zeros((4,), NA.Int) isave = NA.zeros((44,), NA.Int)
lsave = NA.zeros((4,), NA.Int32) isave = NA.zeros((44,), NA.Int32)
def func_and_grad(x): f = func(x, *args) g = fprime(x, *args) return f, g
4f45d3d90a3ca78491a1a589df0d34c7a011e42d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/4f45d3d90a3ca78491a1a589df0d34c7a011e42d/lbfgsb.py
v v v v v v v ^ ^ ^ ^ ^ ^ ^
def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c
3c827c0dae0868310f46bb6461df6f4fd5baa007 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3c827c0dae0868310f46bb6461df6f4fd5baa007/test_numexpr.py
v v v v v v v ^ ^ ^ ^ ^ ^ ^
def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c
3c827c0dae0868310f46bb6461df6f4fd5baa007 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3c827c0dae0868310f46bb6461df6f4fd5baa007/test_numexpr.py
v v v v v v v ^ ^ ^ ^ ^ ^ ^
def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c
3c827c0dae0868310f46bb6461df6f4fd5baa007 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3c827c0dae0868310f46bb6461df6f4fd5baa007/test_numexpr.py
v v v v v v v ^ ^ ^ ^ ^ ^ ^
def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c
3c827c0dae0868310f46bb6461df6f4fd5baa007 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3c827c0dae0868310f46bb6461df6f4fd5baa007/test_numexpr.py
v v v v v v v ^ ^ ^ ^ ^ ^ ^
def complex(a, b): c = zeros(a.shape, dtype=complex_) c.real = a c.imag = b return c
3c827c0dae0868310f46bb6461df6f4fd5baa007 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3c827c0dae0868310f46bb6461df6f4fd5baa007/test_numexpr.py
idx = numpy.where(m.mask == False) if len(idx) != 0 and len(idx[0]) != 0: idx = idx[0][relpos]
if m.mask is ma.nomask: return 0
def __unmasked(m, get_val, relpos): idx = numpy.where(m.mask == False) if len(idx) != 0 and len(idx[0]) != 0: idx = idx[0][relpos] else: idx = None if get_val: if idx is None: return ma.masked else: return m[idx] else: return idx
38fb194d7a54336da6e7ef8abde138ea3a9cda2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/38fb194d7a54336da6e7ef8abde138ea3a9cda2f/corelib.py
idx = None if get_val: if idx is None: return ma.masked else: return m[idx] else: return idx
idx = numpy.where(m.mask == False) if len(idx) != 0 and len(idx[0]) != 0: idx = idx[0][relpos] else: idx = None if get_val: if idx is None: return ma.masked else: return m[idx] else: return idx
def __unmasked(m, get_val, relpos): idx = numpy.where(m.mask == False) if len(idx) != 0 and len(idx[0]) != 0: idx = idx[0][relpos] else: idx = None if get_val: if idx is None: return ma.masked else: return m[idx] else: return idx
38fb194d7a54336da6e7ef8abde138ea3a9cda2f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/38fb194d7a54336da6e7ef8abde138ea3a9cda2f/corelib.py
return 0.0
shape = list(a.shape) del shape[axis] if shape: return np.zeros(shape, dtype=float) else: return np.float64(0.0)
def moment(a, moment=1, axis=0): """Calculates the nth moment about the mean for a sample. Generally used to calculate coefficients of skewness and kurtosis. Parameters ---------- a : array moment : int axis : int or None Returns ------- The appropriate moment along the given axis or over all values if axis is None....
e3d105196833281d415e401e3cfd7b50cfd474b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/e3d105196833281d415e401e3cfd7b50cfd474b3/stats.py
mn = np.expand_dims(np.mean(a,axis),axis)
mn = np.expand_dims(np.mean(a,axis), axis)
def moment(a, moment=1, axis=0): """Calculates the nth moment about the mean for a sample. Generally used to calculate coefficients of skewness and kurtosis. Parameters ---------- a : array moment : int axis : int or None Returns ------- The appropriate moment along the given axis or over all values if axis is None....
e3d105196833281d415e401e3cfd7b50cfd474b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/e3d105196833281d415e401e3cfd7b50cfd474b3/stats.py
return np.mean(s,axis)
return np.mean(s, axis)
def moment(a, moment=1, axis=0): """Calculates the nth moment about the mean for a sample. Generally used to calculate coefficients of skewness and kurtosis. Parameters ---------- a : array moment : int axis : int or None Returns ------- The appropriate moment along the given axis or over all values if axis is None....
e3d105196833281d415e401e3cfd7b50cfd474b3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/e3d105196833281d415e401e3cfd7b50cfd474b3/stats.py
wxPython_thread = ppimport_attr(ppimport('gui_thread'),wxPython_thread)
wxPython_thread = ppimport_attr(ppimport('gui_thread'),'wxPython_thread')
def _import_packages(): """ Import packages in scipy directory that implement info_<packagename>.py. See DEVELOPERS.txt for more info. """ from glob import glob import os frame = sys._getframe(1) for info_file in glob(os.path.join(__path__[0],'*','info_*.py')): package_name = os.path.basename(os.path.dirname(info_fil...
c47b7b679a60504deb11b7cfbfe6a41f163f262a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c47b7b679a60504deb11b7cfbfe6a41f163f262a/__init__.py
if self.iter >= GeneralizedLinearModel.niter:
if self.iter >= Model.niter:
def cont(self, results, tol=1.0e-05): """ Continue iterating, or has convergence been obtained? """ if self.iter >= GeneralizedLinearModel.niter: return False
3cf47dd5efca0dca776237d624ba4c2ee4f314f1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/3cf47dd5efca0dca776237d624ba4c2ee4f314f1/glm.py
self.mu = lband self.ml = uband
self.mu = uband self.ml = lband
def __init__(self, method = 'adams', with_jacobian = 0, rtol=1e-6,atol=1e-12, lband=None,uband=None, order = 12, nsteps = 500, max_step = 0.0, # corresponds to infinite min_step = 0.0, first_step = 0.0, # determined by solver ):
d5d4b86accb2c99855ee07df55d89758b0af0d82 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d5d4b86accb2c99855ee07df55d89758b0af0d82/ode.py
print "x = ", x print "f = ", f
def calcfc(x, con): f = func(x, *args) k = 0 print "x = ", x print "f = ", f for constraints in cons: con[k] = constraints(x, *consargs) k += 1 print "con = ", con return f
328715caec5294fd0f0dc7d91b5592780c14c50e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/328715caec5294fd0f0dc7d91b5592780c14c50e/cobyla.py
print "con = ", con
def calcfc(x, con): f = func(x, *args) k = 0 print "x = ", x print "f = ", f for constraints in cons: con[k] = constraints(x, *consargs) k += 1 print "con = ", con return f
328715caec5294fd0f0dc7d91b5592780c14c50e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/328715caec5294fd0f0dc7d91b5592780c14c50e/cobyla.py
def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, xtol=1e-14, badvalue=None, name=None)
def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, xtol=1e-14, badvalue=None, name=None):
def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, xtol=1e-14, badvalue=None, name=None) if badvalue is None: badvalue = nan self.badvalue = badvalue self.name = name self.a = a self.b = b if a is None: self.a = -scipy.inf if b is None: self.b = scipy.inf self.xa = xa self.xb = xb self.xtol = xtol self._s...
bbab7a0e318679ec7ec23e8ef47d19a91d90721c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bbab7a0e318679ec7ec23e8ef47d19a91d90721c/distributions.py
alpha = alpha_gen(a=0.0,name='alpha',d1='this',d2='is',d3='a test')
alpha = alpha_gen(a=0.0,name='alpha')
def _stats(self): return [scipy.inf]*2 + [scipy.nan]*2
bbab7a0e318679ec7ec23e8ef47d19a91d90721c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bbab7a0e318679ec7ec23e8ef47d19a91d90721c/distributions.py
result = result + cast[imag.typecode()](1j) * imag
try: result = result + _unit_imag[imag.typecode()] * imag except KeyError: result = result + 1j*imag
def _parse_mimatrix(fid,bytes): dclass, cmplx, nzmax =_parse_array_flags(fid) dims = _get_element(fid)[0] name = ''.join(asarray(_get_element(fid)[0]).astype('c')) tupdims = tuple(dims[::-1]) if dclass in mxArrays: result, unused =_get_element(fid) if type == mxCHAR_CLASS: result = ''.join(asarray(result).astype('c')) ...
82336923e46646b284fc869728411818f823ced2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/82336923e46646b284fc869728411818f823ced2/mio.py
res = res + cast[imag.typecode()](1j)*imag
try: res = res + _unit_imag[imag.typecode()] * imag except KeyError: res = res + 1j*imag
def _parse_mimatrix(fid,bytes): dclass, cmplx, nzmax =_parse_array_flags(fid) dims = _get_element(fid)[0] name = ''.join(asarray(_get_element(fid)[0]).astype('c')) tupdims = tuple(dims[::-1]) if dclass in mxArrays: result, unused =_get_element(fid) if type == mxCHAR_CLASS: result = ''.join(asarray(result).astype('c')) ...
82336923e46646b284fc869728411818f823ced2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/82336923e46646b284fc869728411818f823ced2/mio.py
a = ConstantNode(a)
a = ConstantNode(a)
def sum_func(a, axis=-1): axis = encode_axis(axis) if isinstance(a, ConstantNode): return a if isinstance(a, (bool, int, float, complex)): a = ConstantNode(a) kind = a.astKind if kind == 'bool': kind = 'int' return FuncNode('sum', [a, axis], kind=kind)
2d37c93cfa01f8fde8d1d373288e726c9b10203a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2d37c93cfa01f8fde8d1d373288e726c9b10203a/expressions.py
a = ConstantNode(a)
a = ConstantNode(a)
def prod_func(a, axis=-1): axis = encode_axis(axis) if isinstance(a, (bool, int, float, complex)): a = ConstantNode(a) if isinstance(a, ConstantNode): return a kind = a.astKind if kind == 'bool': kind = 'int' return FuncNode('prod', [a, axis], kind=kind)
2d37c93cfa01f8fde8d1d373288e726c9b10203a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2d37c93cfa01f8fde8d1d373288e726c9b10203a/expressions.py
xplt_path = os.path.join(local_path,'xplt')
xplt_path = os.path.join(dot_join(parent_package,'xplt'))
def configuration(parent_package=''): """ gist only works with an X-windows server This will install *.gs and *.gp files to '%spython%s/site-packages/scipy/xplt' % (sys.prefix,sys.version[:3]) """ x11 = x11_info().get_info() if not x11: return config = default_config_dict('xplt',parent_package) local_path = get_path(_...
88da5d766bfcfe1c85800c1b8ab53033fafec032 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/88da5d766bfcfe1c85800c1b8ab53033fafec032/setup_xplt.py
from scipy import real_if_close def invres(r,p,k,tol=1e-3):
from scipy import real_if_close, r1array def invres(r,p,k,tol=1e-3,rtype='avg'):
def unique_roots(p,tol=1e-3,rtype='min'): """Determine the unique roots and their multiplicities in two lists Inputs: p -- The list of roots tol --- The tolerance for two roots to be considered equal. rtype --- How to determine the returned root from the close ones: 'max': pick the maximum 'min': pick the minimum 'a...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
See also: residue, poly, polyval
See also: residue, poly, polyval, unique_roots
def invres(r,p,k,tol=1e-3): """Compute b(s) and a(s) from partial fraction expansion: r,p,k If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
pout, mult = unique_roots(p,tol=tol,rtype='avg')
pout, mult = unique_roots(p,tol=tol,rtype=rtype)
def invres(r,p,k,tol=1e-3): """Compute b(s) and a(s) from partial fraction expansion: r,p,k If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
a = poly(p)
a = r1array(poly(p))
def invres(r,p,k,tol=1e-3): """Compute b(s) and a(s) from partial fraction expansion: r,p,k If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
def residue(b,a,tol=1e-3):
def residue(b,a,tol=1e-3,rtype='avg'):
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
See also: invres, poly, polyval
See also: invres, poly, polyval, unique_roots
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
pout, mult = unique_roots(p,tol=tol,rtype='avg')
pout, mult = unique_roots(p,tol=tol,rtype=rtype)
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
an = poly(pn)
an = r1array(poly(pn))
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
term2 = polymul(bn,polyder(dn))
term2 = polymul(bn,polyder(an,1))
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
r[indx] = polyval(bn,pout[n]) / polyval(an,pout[n]) \ / factorial(sig-m) indx += 1
r[indx+m-1] = polyval(bn,pout[n]) / polyval(an,pout[n]) \ / factorial(sig-m) indx += sig
def residue(b,a,tol=1e-3): """Compute partial-fraction expansion of b(s) / a(s). If M = len(b) and N = len(a) b(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] H(s) = ------ = ---------------------------------------------- a(s) b[0] x**(M-1) + b[1] x**(M-2) + ... + b[M-1] r[0] r[1] r[-1] = ...
5ad9293154026a38dcb1bb1e97c174ebe011b29a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/5ad9293154026a38dcb1bb1e97c174ebe011b29a/signaltools.py
dc.SetClippingRegion(int(gb.left()-1),int(gb.top()-1)), int(gb.width()+2),int(gb.height()+2)))
dc.SetClippingRegion(int(gb.left()-1),int(gb.top()-1), int(gb.width()+2),int(gb.height()+2))
def draw_graph_area(self,dc=None): if not dc: dc = wx.wxClientDC(self) self.layout_data() # just to check how real time plot would go...
c7a02282f03c8695b99f79899d765f2659322c17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c7a02282f03c8695b99f79899d765f2659322c17/wxplt.py
}
'cblas':['generic_cblas.pyf', 'generic_cblas1.pyf'], 'flapack':['generic_flapack.pyf'], 'clapack':['generic_clapack.pyf']}
def configuration(parent_package=''): from interface_gen import generate_interface config = default_config_dict('linalg',parent_package) local_path = get_path(__name__) test_path = os.path.join(local_path,'tests') config['packages'].append(dot_join(parent_package,'linalg.tests')) config['package_dir']['linalg.tests'] ...
2016f4d99fc02e616a8aeb36054f9b4429dd30ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/2016f4d99fc02e616a8aeb36054f9b4429dd30ab/setup_linalg.py
k,b = krev[::-1],brev[::-1]
if krev == []: k = [] else: k = krev[::-1] b = brev[::-1]
def residuez(b,a,tol=1e-3,rtype='avg'): """Compute partial-fraction expansion of b(z) / a(z). If M = len(b) and N = len(a) b(z) b[0] + b[1] z**(-1) + ... + b[M-1] z**(-M+1) H(z) = ------ = ---------------------------------------------- a(z) a[0] + a[1] z**(-1) + ... + a[N-1] z**(-N+1) r[0] ...
e7d3c56f5ce76ef6fec431cd6376da6d821b989b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/e7d3c56f5ce76ef6fec431cd6376da6d821b989b/signaltools.py
fc = gc = 0
def zoom(a_lo, a_hi, phi_lo, phi_hi, derphi_lo, phi, derphi, phi0, derphi0, c1, c2): fc = gc = 0 maxiter = 10 i = 0 while 1: # interpolate to find a trial step length between a_lo and a_hi A = phi_lo; B = derphi_lo; dalpha = a_hi-a_lo; C = (phi_hi - phi_lo - dalpha*derphi_lo)/dalpha**2; if (c<=0) or (i%3)==2): # Use bi...
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py
if (c<=0) or (i%3)==2):
if (C<=0) or ((i%3)==2):
def zoom(a_lo, a_hi, phi_lo, phi_hi, derphi_lo, phi, derphi, phi0, derphi0, c1, c2): fc = gc = 0 maxiter = 10 i = 0 while 1: # interpolate to find a trial step length between a_lo and a_hi A = phi_lo; B = derphi_lo; dalpha = a_hi-a_lo; C = (phi_hi - phi_lo - dalpha*derphi_lo)/dalpha**2; if (c<=0) or (i%3)==2): # Use bi...
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py
fc += 1
def zoom(a_lo, a_hi, phi_lo, phi_hi, derphi_lo, phi, derphi, phi0, derphi0, c1, c2): fc = gc = 0 maxiter = 10 i = 0 while 1: # interpolate to find a trial step length between a_lo and a_hi A = phi_lo; B = derphi_lo; dalpha = a_hi-a_lo; C = (phi_hi - phi_lo - dalpha*derphi_lo)/dalpha**2; if (c<=0) or (i%3)==2): # Use bi...
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py
gc += 1
def zoom(a_lo, a_hi, phi_lo, phi_hi, derphi_lo, phi, derphi, phi0, derphi0, c1, c2): fc = gc = 0 maxiter = 10 i = 0 while 1: # interpolate to find a trial step length between a_lo and a_hi A = phi_lo; B = derphi_lo; dalpha = a_hi-a_lo; C = (phi_hi - phi_lo - dalpha*derphi_lo)/dalpha**2; if (c<=0) or (i%3)==2): # Use bi...
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py
return a_star, fc, gc def line_search(f, fprime, xk, pk, gfk, args=(), c1=1e-4, c2=0.9, amax=50):
return a_star, val_star def line_search(f, fprime, xk, pk, gfk, old_fval, old_old_fval, args=(), c1=1e-4, c2=0.9, amax=50):
def zoom(a_lo, a_hi, phi_lo, phi_hi, derphi_lo, phi, derphi, phi0, derphi0, c1, c2): fc = gc = 0 maxiter = 10 i = 0 while 1: # interpolate to find a trial step length between a_lo and a_hi A = phi_lo; B = derphi_lo; dalpha = a_hi-a_lo; C = (phi_hi - phi_lo - dalpha*derphi_lo)/dalpha**2; if (c<=0) or (i%3)==2): # Use bi...
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py
fc = 0 gc = 0 alpha0 = 1.0 phi0 = f(xk,*args) phi_a0 = phi(alpha0) fc = fc + 2
alpha0 = 0 phi0 = old_fval
def phiprime(alpha): return Num.dot(fprime(xk+alpha*pk,*args),pk)
d00f433519cbe9ce0d4306fb9512ac79d655e1fc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d00f433519cbe9ce0d4306fb9512ac79d655e1fc/optimize.py