rem stringlengths 1 322k | add stringlengths 0 2.05M | context stringlengths 4 228k | meta stringlengths 156 215 |
|---|---|---|---|
"""Perform a wiener filter on an N-dimensional array. | """Perform a Wiener filter on an N-dimensional array. | def wiener(im,mysize=None,noise=None): """Perform a wiener filter on an N-dimensional array. Description: Apply a wiener filter to the N-dimensional array in. Inputs: in -- an N-dimensional array. kernel_size -- A scalar or an N-length list giving the size of the median filter window in each dimension. Elements of... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
Apply a wiener filter to the N-dimensional array in. | Apply a Wiener filter to the N-dimensional array in. | def wiener(im,mysize=None,noise=None): """Perform a wiener filter on an N-dimensional array. Description: Apply a wiener filter to the N-dimensional array in. Inputs: in -- an N-dimensional array. kernel_size -- A scalar or an N-length list giving the size of the median filter window in each dimension. Elements of... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
lMean = correlate(im,Numeric.ones(mysize),1) / Numeric.product(mysize) | lMean = correlate(im,ones(mysize),1) / product(mysize) | def wiener(im,mysize=None,noise=None): """Perform a wiener filter on an N-dimensional array. Description: Apply a wiener filter to the N-dimensional array in. Inputs: in -- an N-dimensional array. kernel_size -- A scalar or an N-length list giving the size of the median filter window in each dimension. Elements of... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
lVar = correlate(im**2,Numeric.ones(mysize),1) / Numeric.product(mysize) - lMean**2 | lVar = correlate(im**2,ones(mysize),1) / product(mysize) - lMean**2 | def wiener(im,mysize=None,noise=None): """Perform a wiener filter on an N-dimensional array. Description: Apply a wiener filter to the N-dimensional array in. Inputs: in -- an N-dimensional array. kernel_size -- A scalar or an N-length list giving the size of the median filter window in each dimension. Elements of... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
noise = mean(Numeric.ravel(lVar)) | noise = mean(ravel(lVar)) | def wiener(im,mysize=None,noise=None): """Perform a wiener filter on an N-dimensional array. Description: Apply a wiener filter to the N-dimensional array in. Inputs: in -- an N-dimensional array. kernel_size -- A scalar or an N-length list giving the size of the median filter window in each dimension. Elements of... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
N = Numeric.size(a)-1 M = Numeric.size(b)-1 | N = size(a)-1 M = size(b)-1 | def lfiltic(b,a,y,x=None): """Given a linear filter (b,a) and initial conditions on the output y and the input x, return the inital conditions on the state vector zi which is used by lfilter to generate the output given the input. If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given in the vectors x a... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
L = Numeric.size(x) | L = size(x) | def lfiltic(b,a,y,x=None): """Given a linear filter (b,a) and initial conditions on the output y and the input x, return the inital conditions on the state vector zi which is used by lfilter to generate the output given the input. If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given in the vectors x a... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
L = Numeric.size(y) | L = size(y) | def lfiltic(b,a,y,x=None): """Given a linear filter (b,a) and initial conditions on the output y and the input x, return the inital conditions on the state vector zi which is used by lfilter to generate the output given the input. If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given in the vectors x a... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
zi[m] = Numeric.sum(b[m+1:]*x[:M-m]) | zi[m] = sum(b[m+1:]*x[:M-m]) | def lfiltic(b,a,y,x=None): """Given a linear filter (b,a) and initial conditions on the output y and the input x, return the inital conditions on the state vector zi which is used by lfilter to generate the output given the input. If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given in the vectors x a... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
zi[m] -= Numeric.sum(a[m+1:]*y[:N-m]) | zi[m] -= sum(a[m+1:]*y[:N-m]) | def lfiltic(b,a,y,x=None): """Given a linear filter (b,a) and initial conditions on the output y and the input x, return the inital conditions on the state vector zi which is used by lfilter to generate the output given the input. If M=len(b)-1 and N=len(a)-1. Then, the initial conditions are given in the vectors x a... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(M,Numeric.Float) | return ones(M, float) | def boxcar(M,sym=1): """The M-point boxcar window. """ return Numeric.ones(M,Numeric.Float) | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | 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 = arange(1,int((M+1)/2)+1) if M % 2 == 0: w = (2*n-1.0)/M w = numpy.r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = numpy.r_[w, w[-2::-1]] if not ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | 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 = arange(1,int((M+1)/2)+1) if M % 2 == 0: w = (2*n-1.0)/M w = numpy.r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = numpy.r_[w, w[-2::-1]] if not ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
w = numpy.r_[w, w[::-1]] | w = r_[w, w[::-1]] | 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 = arange(1,int((M+1)/2)+1) if M % 2 == 0: w = (2*n-1.0)/M w = numpy.r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = numpy.r_[w, w[-2::-1]] if not ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
w = numpy.r_[w, w[-2::-1]] | w = r_[w, w[-2::-1]] | 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 = arange(1,int((M+1)/2)+1) if M % 2 == 0: w = (2*n-1.0)/M w = numpy.r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = numpy.r_[w, w[-2::-1]] if not ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def parzen(M,sym=1): """The M-point Parzen 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 = Numeric.arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) na = extract(n < -(M-1)/4.0, n) nb = extract(abs(n) <= (M-1)/4.0, n) wa = 2*(1-abs(na)/(M/2.0))**3.0... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def parzen(M,sym=1): """The M-point Parzen 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 = Numeric.arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) na = extract(n < -(M-1)/4.0, n) nb = extract(abs(n) <= (M-1)/4.0, n) wa = 2*(1-abs(na)/(M/2.0))**3.0... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
n = Numeric.arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) | n = arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) | def parzen(M,sym=1): """The M-point Parzen 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 = Numeric.arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) na = extract(n < -(M-1)/4.0, n) nb = extract(abs(n) <= (M-1)/4.0, n) wa = 2*(1-abs(na)/(M/2.0))**3.0... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
w = numpy.r_[wa,wb,wa[::-1]] | w = r_[wa,wb,wa[::-1]] | def parzen(M,sym=1): """The M-point Parzen 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 = Numeric.arange(-(M-1)/2.0,(M-1)/2.0+0.5,1.0) na = extract(n < -(M-1)/4.0, n) nb = extract(abs(n) <= (M-1)/4.0, n) wa = 2*(1-abs(na)/(M/2.0))**3.0... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def bohman(M,sym=1): """The M-point Bohman 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 fac = abs(linspace(-1,1,M)[1:-1]) w = (1 - fac)* cos(pi*fac) + 1.0/pi*sin(pi*fac) w = numpy.r_[0,w,0] if not sym and not odd: w = w[:-1] return w | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def bohman(M,sym=1): """The M-point Bohman 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 fac = abs(linspace(-1,1,M)[1:-1]) w = (1 - fac)* cos(pi*fac) + 1.0/pi*sin(pi*fac) w = numpy.r_[0,w,0] if not sym and not odd: w = w[:-1] return w | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
w = numpy.r_[0,w,0] | w = r_[0,w,0] | def bohman(M,sym=1): """The M-point Bohman 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 fac = abs(linspace(-1,1,M)[1:-1]) w = (1 - fac)* cos(pi*fac) + 1.0/pi*sin(pi*fac) w = numpy.r_[0,w,0] if not sym and not odd: w = w[:-1] return w | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def blackman(M,sym=1): """The M-point Blackman 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 = arange(0,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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def blackman(M,sym=1): """The M-point Blackman 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 = arange(0,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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def nuttall(M,sym=1): """A minimum 4-term Blackman-Harris window according to Nuttall. """ 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 a = [0.3635819, 0.4891775, 0.1365995, 0.0106411] n = arange(0,M) fac = n*2*pi/(M-1.0) w = a[0] - a[1]*cos(fac) +... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def nuttall(M,sym=1): """A minimum 4-term Blackman-Harris window according to Nuttall. """ 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 a = [0.3635819, 0.4891775, 0.1365995, 0.0106411] n = arange(0,M) fac = n*2*pi/(M-1.0) w = a[0] - a[1]*cos(fac) +... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def blackmanharris(M,sym=1): """The M-point minimum 4-term Blackman-Harris 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 a = [0.35875, 0.48829, 0.14128, 0.01168]; n = arange(0,M) fac = n*2*pi/(M-1.0) w = a[0] - a[1]*cos(fac) + a[2]*cos(2... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def blackmanharris(M,sym=1): """The M-point minimum 4-term Blackman-Harris 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 a = [0.35875, 0.48829, 0.14128, 0.01168]; n = arange(0,M) fac = n*2*pi/(M-1.0) w = a[0] - a[1]*cos(fac) + a[2]*cos(2... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def bartlett(M,sym=1): """The M-point Bartlett 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 = arange(0,M) w = where(Numeric.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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def bartlett(M,sym=1): """The M-point Bartlett 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 = arange(0,M) w = where(Numeric.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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
w = where(Numeric.less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) | w = where(less_equal(n,(M-1)/2.0),2.0*n/(M-1),2.0-2.0*n/(M-1)) | def bartlett(M,sym=1): """The M-point Bartlett 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 = arange(0,M) w = where(Numeric.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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def hanning(M,sym=1): """The M-point Hanning 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 = arange(0,M) w = 0.5-0.5*cos(2.0*pi*n/(M-1)) if not sym and not odd: w = w[:-1] return w | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def hanning(M,sym=1): """The M-point Hanning 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 = arange(0,M) w = 0.5-0.5*cos(2.0*pi*n/(M-1)) if not sym and not odd: w = w[:-1] return w | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def barthann(M,sym=1): """Return the M-point modified Bartlett-Hann 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 = arange(0,M) fac = abs(n/(M-1.0)-0.5) w = 0.62 - 0.48*fac + 0.38*cos(2*pi*fac) if not sym and not odd: w = w[:-1] return... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def barthann(M,sym=1): """Return the M-point modified Bartlett-Hann 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 = arange(0,M) fac = abs(n/(M-1.0)-0.5) w = 0.62 - 0.48*fac + 0.38*cos(2*pi*fac) if not sym and not odd: w = w[:-1] return... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def hamming(M,sym=1): """The M-point Hamming 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 = 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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def hamming(M,sym=1): """The M-point Hamming 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 = 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 | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def kaiser(M,beta,sym=1): """Returns a Kaiser window of length M with shape parameter 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) alpha = (M-1)/2.0 w = special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta) if... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def kaiser(M,beta,sym=1): """Returns a Kaiser window of length M with shape parameter 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) alpha = (M-1)/2.0 w = special.i0(beta * sqrt(1-((n-alpha)/alpha)**2.0))/special.i0(beta) if... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def gaussian(M,std,sym=1): """Returns a Gaussian window of length M with standard-deviation std. """ 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)-(M-1.0)/2.0 sig2 = 2*std*std w = exp(-n**2 / sig2) if not sym and not odd: w = w[:-1... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def gaussian(M,std,sym=1): """Returns a Gaussian window of length M with standard-deviation std. """ 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)-(M-1.0)/2.0 sig2 = 2*std*std w = exp(-n**2 / sig2) if not sym and not odd: w = w[:-1... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def general_gaussian(M,p,sig,sym=1): """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 """ 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)-(M-1.0)/2.0 w ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def general_gaussian(M,p,sig,sym=1): """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 """ 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)-(M-1.0)/2.0 w ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.array([]) | return array([]) | def slepian(M,width,sym=1): if (M*width > 27.38): raise ValueError, "Cannot reliably obtain slepian sequences for"\ " M*width > 27.38." 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 twoF = width/2.0 alpha = (M-1)/2.0 m = arange(0,M)-alpha n = m[:,N... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
return Numeric.ones(1,'d') | return ones(1,'d') | def slepian(M,width,sym=1): if (M*width > 27.38): raise ValueError, "Cannot reliably obtain slepian sequences for"\ " M*width > 27.38." 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 twoF = width/2.0 alpha = (M-1)/2.0 m = arange(0,M)-alpha n = m[:,N... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
if numpy.iscomplexobj(x): | if iscomplexobj(x): | def hilbert(x, N=None): """Return the hilbert transform of x of length N. """ x = asarray(x) if N is None: N = len(x) if N <=0: raise ValueError, "N must be positive." if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) Xf = fft(x,N,axis=0) h = Numeric.zeros(N) if N % 2 == 0: h[0] ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
x = numpy.real(x) | x = real(x) | def hilbert(x, N=None): """Return the hilbert transform of x of length N. """ x = asarray(x) if N is None: N = len(x) if N <=0: raise ValueError, "N must be positive." if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) Xf = fft(x,N,axis=0) h = Numeric.zeros(N) if N % 2 == 0: h[0] ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
h = Numeric.zeros(N) | h = zeros(N) | def hilbert(x, N=None): """Return the hilbert transform of x of length N. """ x = asarray(x) if N is None: N = len(x) if N <=0: raise ValueError, "N must be positive." if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) Xf = fft(x,N,axis=0) h = Numeric.zeros(N) if N % 2 == 0: h[0] ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
h = h[:,Numeric.NewAxis] | h = h[:, NewAxis] | def hilbert(x, N=None): """Return the hilbert transform of x of length N. """ x = asarray(x) if N is None: N = len(x) if N <=0: raise ValueError, "N must be positive." if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) Xf = fft(x,N,axis=0) h = Numeric.zeros(N) if N % 2 == 0: h[0] ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
if numpy.iscomplexobj(x): | if iscomplexobj(x): | def hilbert2(x,N=None): """Return the '2-D' hilbert transform of x of length N. """ x = asarray(x) x = asarray(x) if N is None: N = x.shape if len(N) < 2: if N <=0: raise ValueError, "N must be positive." N = (N,N) if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) print N Xf = ff... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
x = numpy.real(x) | x = real(x) | def hilbert2(x,N=None): """Return the '2-D' hilbert transform of x of length N. """ x = asarray(x) x = asarray(x) if N is None: N = x.shape if len(N) < 2: if N <=0: raise ValueError, "N must be positive." N = (N,N) if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) print N Xf = ff... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
h1 = Numeric.zeros(N[0],'d') h2 = Numeric.zeros(N[1],'d') | h1 = zeros(N[0],'d') h2 = zeros(N[1],'d') | def hilbert2(x,N=None): """Return the '2-D' hilbert transform of x of length N. """ x = asarray(x) x = asarray(x) if N is None: N = x.shape if len(N) < 2: if N <=0: raise ValueError, "N must be positive." N = (N,N) if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) print N Xf = ff... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
h = h[:,Numeric.NewAxis] | h = h[:, NewAxis] | def hilbert2(x,N=None): """Return the '2-D' hilbert transform of x of length N. """ x = asarray(x) x = asarray(x) if N is None: N = x.shape if len(N) < 2: if N <=0: raise ValueError, "N must be positive." N = (N,N) if numpy.iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) print N Xf = ff... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
if numpy.iscomplexobj(p): indx = Numeric.argsort(abs(p)) | if iscomplexobj(p): indx = argsort(abs(p)) | def cmplx_sort(p): "sort roots based on magnitude." p = asarray(p) if numpy.iscomplexobj(p): indx = Numeric.argsort(abs(p)) else: indx = Numeric.argsort(p) return Numeric.take(p,indx), indx | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
indx = Numeric.argsort(p) return Numeric.take(p,indx), indx | indx = argsort(p) return take(p,indx), indx | def cmplx_sort(p): "sort roots based on magnitude." p = asarray(p) if numpy.iscomplexobj(p): indx = Numeric.argsort(abs(p)) else: indx = Numeric.argsort(p) return Numeric.take(p,indx), indx | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
from numpy import real_if_close, atleast_1d | 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... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py | |
r = Numeric.take(r,indx) | r = take(r,indx) | 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) a[0] x**(N-1) + a[1] x**(N-2) + ... + a[N-1] r[0] r[... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
while Numeric.allclose(b[0], 0, rtol=1e-14) and (b.shape[-1] > 1): | while allclose(b[0], 0, rtol=1e-14) and (b.shape[-1] > 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) a[0] x**(N-1) + a[1] x**(N-2) + ... + a[N-1] r[0] r[... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
r = Numeric.take(r,indx) | r = take(r,indx) | def invresz(r,p,k,tol=1e-3,rtype='avg'): """Compute b(z) and a(z) from partial fraction expansion: r,p,k 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] ... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
N = int(Numeric.minimum(num,Nx)) Y = Numeric.zeros(newshape,'D') | N = int(numpy.minimum(num,Nx)) Y = zeros(newshape,'D') | def resample(x,num,t=None,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. The resampled signal starts at the same value of x but is sampled with a spacing of len(x) / num * (spacing of x). Because a Fourier method is used, the signal is assumed periodic. Window controls a F... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py |
from numpy import expand_dims, unique, prod, sort, zeros, ones, \ reshape, r_, any, c_, transpose, take, dot import scipy.linalg as linalg | def resample(x,num,t=None,axis=0,window=None): """Resample to num samples using Fourier method along the given axis. The resampled signal starts at the same value of x but is sampled with a spacing of len(x) / num * (spacing of x). Because a Fourier method is used, the signal is assumed periodic. Window controls a F... | 936da8591e6b92539aeda1c0c884ca93d37a2754 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/936da8591e6b92539aeda1c0c884ca93d37a2754/signaltools.py | |
if mode == 'F': image = Image.fromstring(mode,shape,data.astype('f').tostring()) elif mode == 'I': | if mode == 'I': | def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, mode=None,channel_axis=None): """Takes a Numeric array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to ... | 42178e27612a7fe5b5734ae22063456e6338a414 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/42178e27612a7fe5b5734ae22063456e6338a414/pilutil.py |
if isinstance(other, dok_matrix): | if isinstance(other, spmatrix): | def __mul__(self, other): if isinstance(other, dok_matrix): 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 | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
current_row = ikey0 row_ptr[ikey0] = k | N = ikey1-current_col row_ptr[current_row+1:ikey0+1] = [k]*N current_row = ikey0 | def tocsr(self): # Return Compressed Sparse Row format arrays for this matrix keys = self.keys() keys.sort() nnz = len(keys) data = [0]*nnz colind = [0]*nnz row_ptr = [0]*(self.shape[0]+1) current_row = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey0 != current_row: current_row = ikey0 row_pt... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 | data = [0]*nnz rowind = [0]*nnz col_ptr = [0]*(self.shape[1]+1) current_col = 0 | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
col_ptr[ikey1] = k | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py | |
colind[k] = ikey0 | rowind[k] = ikey0 | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
colind = array(colind) | rowind = array(rowind) | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
return csc_matrix(data, (colind, col_ptr)) | return csc_matrix(data, (rowind, col_ptr)) | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [None]*nnz colind = [None]*nnz col_ptr = [None]*(self.shape[1]+1) current_col = -1 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current... | 1e1de936eca9d78cf7f56312b3f8a5c1badf7b93 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/1e1de936eca9d78cf7f56312b3f8a5c1badf7b93/Sparse.py |
mask = (a < threshmin) | mask |= (a < threshmin) | def threshold(a, threshmin=None, threshmax=None, newval=0): """Clip array to a given value. | 105f9006d6823d54ababf218e8d61d356e54e700 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/105f9006d6823d54ababf218e8d61d356e54e700/stats.py |
aux = numpy.take( ar, perm 0,axis=0) | aux = numpy.take( ar, perm, axis=0) | def unique1d( ar1, retIndx = False ): """Unique elements of 1D array. When retIndx is True, return also the indices indx such that ar1[indx] is the resulting array of unique elements.""" ar = numpy.array( ar1 ).ravel() if retIndx: perm = numpy.argsort( ar ) aux = numpy.take( ar, perm 0,axis=0) flag = ediff1d( aux, 1 ) ... | a9cc2a04d5448e5b6e7f01cc330879aa9029ee04 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/a9cc2a04d5448e5b6e7f01cc330879aa9029ee04/arraysetops.py |
def ppcc_max(x, dist='tukeylambda'): | def ppcc_max(x, brack=(0.0,1.0), dist='tukeylambda'): | def ppcc_max(x, dist='tukeylambda'): """Returns the shape parameter that maximizes the probability plot correlation coefficient for the given data to a one-parameter family of distributions. See also ppcc_plot """ try: ppf_func = eval('distributions.%sppf'%dist) except AttributError: raise dist, "is not a valid distri... | 871e698215989e20feab368164bfb8ffbba0114e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/871e698215989e20feab368164bfb8ffbba0114e/morestats.py |
return optimize.brent(tempfunc, args=(Ui, osr, ppf_func)) | return optimize.brent(tempfunc, brack=brack, args=(Ui, osr, ppf_func)) | def tempfunc(shape, mi, yvals, func): xvals = func(mi, shape) slope, intercept, r, prob, sterrest = stats.linregress(xvals, yvals) return 1-r | 871e698215989e20feab368164bfb8ffbba0114e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/871e698215989e20feab368164bfb8ffbba0114e/morestats.py |
""" Later have log(0) raise warning, not error | """ log(0) should print warning, but succeed. | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py |
assert(0) | except: assert(0) def check_log_neg(self): """ log(-1) should print warning, but still raises error. """ try: val = logn(3,-1) | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py |
pass def check_log_neg(self): """ Later have log(-1) raise warning, not error """ try: val = logn(3,-1) assert(0) except ValueError: | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py | |
""" Later have log(0) raise warning, not error | """ log(0) should print warning, but succeed. | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py |
val = logn(3,0) assert(0) except OverflowError: pass | val = log2(0) except: assert(0) | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py |
val = logn(3,-1) assert(0) except ValueError: | val = log2(-1) assert(0) except OverflowError: | def check_log_neg(self): """ Later have log(-1) raise warning, not error """ try: val = logn(3,-1) assert(0) except ValueError: pass | c9316d1d2ba5e114019481f968becf25226dff17 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/c9316d1d2ba5e114019481f968becf25226dff17/test_misc.py |
ftype, lastel, data, index0, index1 = \ mat.ftype, mat.nnz, mat.data, mat.rowind, mat.indptr | if csc: index0 = mat.rowind else: index0 = mat.colind ftype, lastel, data, index1 = mat.ftype, mat.nnz, mat.data, mat.indptr | def spsolve(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, ... | d181697e0f9d3cb08cc1f181833d2136acb2a3c5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/d181697e0f9d3cb08cc1f181833d2136acb2a3c5/linsolve.py |
res = csc + other return res | return csc + other | def __add__(self, other): csc = self.tocsc() res = csc + other return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc - other return res | return csc - other | def __sub__(self, other): csc = self.tocsc() res = csc - other return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.__rsub__(other) return res | return csc.__rsub__(other) | def __rsub__(self, other): # other - self csc = self.tocsc() res = csc.__rsub__(other) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc * other return res | return csc * other | def __mul__(self, other): csc = self.tocsc() res = csc * other return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.__rmul__(other) return res | return csc.__rmul__(other) | def __rmul__(self, other): csc = self.tocsc() res = csc.__rmul__(other) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = -csc return res | return -csc | def __neg__(self): csc = self.tocsc() res = -csc return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.transpose() return res | return csc.transpose() | def transpose(self): csc = self.tocsc() res = csc.transpose() return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.matrixmultiply(other) return res | return csc.matrixmultiply(other) | def matrixmultiply(self, other): """ A generic interface for matrix-matrix or matrix-vector multiplication. """ csc = self.tocsc() res = csc.matrixmultiply(other) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.matmat(other) return res | return csc.matmat(other) | def matmat(self, other): csc = self.tocsc() res = csc.matmat(other) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.matvec(vec) return res | return csc.matvec(vec) | def matvec(self, vec): csc = self.tocsc() res = csc.matvec(vec) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
res = csc.rmatvec(vec, conj=conj) return res | return csc.rmatvec(vec, conj=conj) | def rmatvec(self, vec, conj=1): csc = self.tocsc() res = csc.rmatvec(vec, conj=conj) return res | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] nnz1, nnz2 = self.nnz, other.nnz data1, data2 = _convert_data(self.data[:nnz1], ocs.data[:nnz2], dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'cscad... | if isscalar(other): raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') elif isspmatrix(other): ocs = other.tocsc() if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar, ocs._dtypechar)] nnz1, nnz2 = self.nnz, other.nnz data1,... | def __add__(self, other): ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,other._dtypechar)] nnz1, nnz2 = self.nnz, other.nnz data1, data2 = _convert_data(self.data[:nnz1], ocs.data[:nnz2], dtypechar) func = getattr(sparsetools,_t... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
ocs = csc_matrix(other) | ocs = other.tocsc() | def __rmul__(self, other): # other * self if isspmatrix(other): ocs = csc_matrix(other) return ocs.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 = 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]+'cscadd') c,rowc,ptrc,ierr = func(data1,self.rowind,sel... | if isscalar(other): raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') elif isspmatrix(other): ocs = other.tocsc() if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ... | def __sub__(self, other): 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]+'cscadd') c,rowc,ptrc,ierr = ... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
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]+'cscadd') c,rowc,ptrc,ierr = func(-data1,self.rowind,se... | if isscalar(other): raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') elif isspmatrix(other): ocs = other.tocsc() if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ... | 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... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
ocs = csc_matrix(other) | ocs = other.tocsc() | 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.sha... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
try: m,n = other.shape except AttributeError: | if isscalar(other): | def __add__(self, other): # First check if argument is a scalar try: m,n = other.shape except AttributeError: # Okay, assume it's scalar # Now we would add this scalar to every element. raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') other_csr = other.tocsr() #ocs = csr_matrix(other... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
other_csr = other.tocsr() if (other_csr.shape != self.shape): | ocs = other.tocsr() if (ocs.shape != self.shape): | def __add__(self, other): # First check if argument is a scalar try: m,n = other.shape except AttributeError: # Okay, assume it's scalar # Now we would add this scalar to every element. raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') other_csr = other.tocsr() #ocs = csr_matrix(other... | 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) | dtypechar = _coerce_rules[(self._dtypechar, ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar) | def __add__(self, other): # First check if argument is a scalar try: m,n = other.shape except AttributeError: # Okay, assume it's scalar # Now we would add this scalar to every element. raise NotImplementedError('adding a scalar to a sparse matrix is not yet supported') other_csr = other.tocsr() #ocs = csr_matrix(other... | bdabf856b614694a8ef20c73a7d82bda3a7cf386 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12971/bdabf856b614694a8ef20c73a7d82bda3a7cf386/sparse.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.