bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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... | 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... | 1,200 |
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... | 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... | 1,201 |
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... | 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... | 1,202 |
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... | 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... | 1,203 |
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... | 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... | 1,204 |
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... | 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... | 1,205 |
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... | 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... | 1,206 |
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... | 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... | 1,207 |
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... | 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... | 1,208 |
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... | 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... | 1,209 |
def boxcar(M,sym=1): """The M-point boxcar window. """ return Numeric.ones(M,Numeric.Float) | def boxcar(M,sym=1): """The M-point boxcar window. """ return ones(M, float) | 1,210 |
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 ... | def triang(M,sym=1): """The M-point triangular window. """ if M < 1: return 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 sym and ... | 1,211 |
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 ... | def triang(M,sym=1): """The M-point triangular window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 sym and ... | 1,212 |
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 ... | 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 = r_[w, w[::-1]] else: w = 2*n/(M+1.0) w = numpy.r_[w, w[-2::-1]] if not sym an... | 1,213 |
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 ... | 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 = r_[w, w[-2::-1]] if not sym an... | 1,214 |
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... | def parzen(M,sym=1): """The M-point Parzen window """ if M < 1: return 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 wb = 1-... | 1,215 |
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... | def parzen(M,sym=1): """The M-point Parzen window """ if M < 1: return Numeric.array([]) if M == 1: return 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 wb = 1-... | 1,216 |
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... | 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 = 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 wb = 1-... | 1,217 |
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... | 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... | 1,218 |
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 | def bohman(M,sym=1): """The M-point Bohman window """ if M < 1: return 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 | 1,219 |
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 | def bohman(M,sym=1): """The M-point Bohman window """ if M < 1: return Numeric.array([]) if M == 1: return 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 | 1,220 |
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 | 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 = r_[0,w,0] if not sym and not odd: w = w[:-1] return w | 1,221 |
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 | def blackman(M,sym=1): """The M-point Blackman window. """ if M < 1: return 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 | 1,222 |
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 | def blackman(M,sym=1): """The M-point Blackman window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 | 1,223 |
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) +... | def nuttall(M,sym=1): """A minimum 4-term Blackman-Harris window according to Nuttall. """ if M < 1: return 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) + a[2]*co... | 1,224 |
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) +... | 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 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) + a[2]*co... | 1,225 |
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... | def blackmanharris(M,sym=1): """The M-point minimum 4-term Blackman-Harris window. """ if M < 1: return 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*fac) - ... | 1,226 |
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... | def blackmanharris(M,sym=1): """The M-point minimum 4-term Blackman-Harris window. """ if M < 1: return Numeric.array([]) if M == 1: return 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*fac) - ... | 1,227 |
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 | def bartlett(M,sym=1): """The M-point Bartlett window. """ if M < 1: return 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 | 1,228 |
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 | def bartlett(M,sym=1): """The M-point Bartlett window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 | 1,229 |
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 | 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(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 | 1,230 |
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 | def hanning(M,sym=1): """The M-point Hanning window. """ if M < 1: return 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 | 1,231 |
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 | def hanning(M,sym=1): """The M-point Hanning window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 | 1,232 |
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... | def barthann(M,sym=1): """Return the M-point modified Bartlett-Hann window. """ if M < 1: return 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 w | 1,233 |
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... | def barthann(M,sym=1): """Return the M-point modified Bartlett-Hann window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 w | 1,234 |
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 | def hamming(M,sym=1): """The M-point Hamming window. """ if M < 1: return 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 | 1,235 |
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 | def hamming(M,sym=1): """The M-point Hamming window. """ if M < 1: return Numeric.array([]) if M == 1: return 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 | 1,236 |
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... | def kaiser(M,beta,sym=1): """Returns a Kaiser window of length M with shape parameter beta. """ if M < 1: return 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 not sym... | 1,237 |
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... | 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 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 not sym... | 1,238 |
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... | def gaussian(M,std,sym=1): """Returns a Gaussian window of length M with standard-deviation std. """ if M < 1: return 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] return... | 1,239 |
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... | 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 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] return... | 1,240 |
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 ... | 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 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 = exp(-0... | 1,241 |
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 ... | 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 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 = exp(-0... | 1,242 |
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... | 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 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[:,NewAxis] ... | 1,243 |
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... | 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 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[:,NewAxis] ... | 1,244 |
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] ... | 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 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] = h[N/... | 1,245 |
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] ... | 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 = real(x) Xf = fft(x,N,axis=0) h = Numeric.zeros(N) if N % 2 == 0: h[0] = h[N/... | 1,246 |
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] ... | 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 = zeros(N) if N % 2 == 0: h[0] = h[N/2]... | 1,247 |
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] ... | 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] ... | 1,248 |
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... | 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 iscomplexobj(x): print "Warning: imaginary part of x ignored." x = numpy.real(x) print N Xf = fft2(x,N... | 1,249 |
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... | 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 = real(x) print N Xf = fft2(x,N... | 1,250 |
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... | 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... | 1,251 |
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... | 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... | 1,252 |
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 | def cmplx_sort(p): "sort roots based on magnitude." p = asarray(p) if iscomplexobj(p): indx = argsort(abs(p)) else: indx = Numeric.argsort(p) return Numeric.take(p,indx), indx | 1,253 |
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 | def cmplx_sort(p): "sort roots based on magnitude." p = asarray(p) if numpy.iscomplexobj(p): indx = Numeric.argsort(abs(p)) else: indx = argsort(p) return take(p,indx), indx | 1,254 |
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... | 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... | 1,255 |
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[... | 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[... | 1,256 |
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[... | 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[... | 1,257 |
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] ... | 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] ... | 1,258 |
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... | 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... | 1,259 |
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... | 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... | 1,260 |
def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, mode=None,channel_axis=None): """Takes a Numeric array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to ... | def toimage(arr,high=255,low=0,cmin=None,cmax=None,pal=None, mode=None,channel_axis=None): """Takes a Numeric array and returns a PIL image. The mode of the PIL image depends on the array shape, the pal keyword, and the mode keyword. For 2-D arrays, if pal is a valid (N,3) byte-array giving the RGB values (from 0 to ... | 1,261 |
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 | 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 | 1,262 |
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... | 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: N = ikey1-current_col row_... | 1,263 |
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... | def tocsc(self): # Return Compressed Sparse Column format arrays for this matrix keys = self.keys() keys.sort(csc_cmp) nnz = len(keys) data = [0]*nnz rowind = [0]*nnz col_ptr = [0]*(self.shape[1]+1) current_col = 0 k = 0 for key in keys: ikey0 = int(key[0]) ikey1 = int(key[1]) if ikey1 != current_col: current_col = ike... | 1,264 |
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... | 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... | 1,265 |
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... | 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... | 1,266 |
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... | 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... | 1,267 |
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... | 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... | 1,268 |
def threshold(a, threshmin=None, threshmax=None, newval=0): """Clip array to a given value. | def threshold(a, threshmin=None, threshmax=None, newval=0): """Clip array to a given value. | 1,269 |
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 ) ... | 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, axis=0) flag = ediff1d( aux, 1 ) !... | 1,270 |
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... | def ppcc_max(x, brack=(0.0,1.0), 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 n... | 1,271 |
def tempfunc(shape, mi, yvals, func): xvals = func(mi, shape) slope, intercept, r, prob, sterrest = stats.linregress(xvals, yvals) return 1-r | def tempfunc(shape, mi, yvals, func): xvals = func(mi, shape) slope, intercept, r, prob, sterrest = stats.linregress(xvals, yvals) return 1-r | 1,272 |
def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | def check_log_0(self): """ log(0) should print warning, but succeed. """ try: val = logn(3,0) assert(0) except OverflowError: pass | 1,273 |
def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) except: assert(0) def check_log_neg(self): """ log(-1) should print warning, but still raises error. """ try: val = logn(3,-1) except OverflowError: pass | 1,274 |
def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | 1,275 |
def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | def check_log_0(self): """ log(0) should print warning, but succeed. """ try: val = logn(3,0) assert(0) except OverflowError: pass | 1,276 |
def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | def check_log_0(self): """ Later have log(0) raise warning, not error """ try: val = logn(3,0) assert(0) except OverflowError: pass | 1,277 |
def check_log_neg(self): """ Later have log(-1) raise warning, not error """ try: val = logn(3,-1) assert(0) except ValueError: pass | def check_log_neg(self): """ Later have log(-1) raise warning, not error """ try: val = log2(-1) assert(0) except OverflowError: pass | 1,278 |
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, ... | 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, ... | 1,279 |
def __add__(self, other): csc = self.tocsc() res = csc + other return res | def __add__(self, other): csc = self.tocsc() res = csc + other return res | 1,280 |
def __sub__(self, other): csc = self.tocsc() res = csc - other return res | def __sub__(self, other): csc = self.tocsc() res = csc - other return res | 1,281 |
def __rsub__(self, other): # other - self csc = self.tocsc() res = csc.__rsub__(other) return res | def __rsub__(self, other): # other - self csc = self.tocsc() res = csc.__rsub__(other) return res | 1,282 |
def __mul__(self, other): csc = self.tocsc() res = csc * other return res | def __mul__(self, other): csc = self.tocsc() res = csc * other return res | 1,283 |
def __rmul__(self, other): csc = self.tocsc() res = csc.__rmul__(other) return res | def __rmul__(self, other): csc = self.tocsc() return csc.__rmul__(other) | 1,284 |
def __neg__(self): csc = self.tocsc() res = -csc return res | def __neg__(self): csc = self.tocsc() res = -csc return res | 1,285 |
def transpose(self): csc = self.tocsc() res = csc.transpose() return res | def transpose(self): csc = self.tocsc() res = csc.transpose() return res | 1,286 |
def matrixmultiply(self, other): """ A generic interface for matrix-matrix or matrix-vector multiplication. """ csc = self.tocsc() res = csc.matrixmultiply(other) return res | def matrixmultiply(self, other): """ A generic interface for matrix-matrix or matrix-vector multiplication. """ csc = self.tocsc() return csc.matrixmultiply(other) | 1,287 |
def matmat(self, other): csc = self.tocsc() res = csc.matmat(other) return res | def matmat(self, other): csc = self.tocsc() res = csc.matmat(other) return res | 1,288 |
def matvec(self, vec): csc = self.tocsc() res = csc.matvec(vec) return res | def matvec(self, vec): csc = self.tocsc() res = csc.matvec(vec) return res | 1,289 |
def rmatvec(self, vec, conj=1): csc = self.tocsc() res = csc.rmatvec(vec, conj=conj) return res | def rmatvec(self, vec, conj=1): csc = self.tocsc() res = csc.rmatvec(vec, conj=conj) return res | 1,290 |
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... | 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... | 1,291 |
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),... | def __rmul__(self, other): # other * self if isspmatrix(other): ocs = other.tocsc() 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),conj... | 1,292 |
def __neg__(self): new = self.copy() new.data = -new.data return new | def __neg__(self): new = self.copy() new.data *= -1 return new | 1,293 |
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 = ... | 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 = ... | 1,294 |
def __rsub__(self, other): # implement other - self ocs = csc_matrix(other) if (ocs.shape != self.shape): raise ValueError, "Inconsistent shapes." dtypechar = _coerce_rules[(self._dtypechar,ocs._dtypechar)] data1, data2 = _convert_data(self.data, ocs.data, dtypechar) func = getattr(sparsetools,_transtabl[dtypechar]+'c... | def __rsub__(self, other): # implement other - self 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.... | 1,295 |
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... | 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 = other.tocsc() if (ocs.shape !... | 1,296 |
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... | 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... | 1,297 |
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... | 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... | 1,298 |
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... | 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... | 1,299 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.