bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
1,500
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
defif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) butter(N,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Wn,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) bandtype='band',if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) analog=0,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) output=''):if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) """Butterworthif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) digitalif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) andif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) analogif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) filterif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) design.if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Description:if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Designif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) anif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Nthif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) orderif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) lowpassif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) digitalif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Butterworthif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) filterif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) andif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) returnif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) theif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) filterif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) coefficientsif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) inif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) (B,A)if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) form.if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Inputs:if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) """if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #pre-warpif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) frequenciesif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) forif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) digitalif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) filterif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) designif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) ifif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) notif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) analog:if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) warpedif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) =if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) 2*fs*tan(pi*Wn/fs)if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) else:if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) warpedif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) =if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Wnif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) convertif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) toif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) low-passif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) prototypeif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Getif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) analogif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) lowpassif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) prototypeif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) transformif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) toif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) lowpass,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) bandpass,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) highpass,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) orif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) bandstopif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Findif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) discreteif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) equivalentif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) ifif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) necessaryif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) ifif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) notif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) analog:if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) passif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) #if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) Transformif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) toif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) properif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) outif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) typeif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) (pole-zero,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) state-space,if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) numer-denom)if btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1]) passif btype in ['lowpass', 'highpass']: wo = warped else: bw = warped[1] - warped[0] wo = sqrt(warped[0]*warped[1])
1,501
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
defif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) butter(N,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Wn,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) bandtype='band',if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) analog=0,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) output=''):if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) """Butterworthif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) digitalif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) andif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) analogif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) filterif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) design.if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Description:if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Designif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) anif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Nthif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) orderif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) lowpassif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) digitalif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Butterworthif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) filterif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) andif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) returnif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) theif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) filterif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) coefficientsif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) inif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) (B,A)if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) form.if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Inputs:if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) """if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #pre-warpif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) frequenciesif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) forif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) digitalif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) filterif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) designif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) ifif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) notif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) analog:if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) warpedif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) =if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) 2*fs*tan(pi*Wn/fs)if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) else:if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) warpedif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) =if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Wnif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) convertif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) toif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) low-passif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) prototypeif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Getif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) analogif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) lowpassif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) prototypeif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) transformif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) toif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) lowpass,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) bandpass,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) highpass,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) orif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) bandstopif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Findif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) discreteif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) equivalentif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) ifif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) necessaryif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) ifif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) notif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) analog:if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) passif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) #if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) Transformif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) toif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) properif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) outif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) typeif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) (pole-zero,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) state-space,if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) numer-denom)if typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) passif typefunc in [buttap, besselap]: z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." z, p, k = typefunc(N, rs) else: if rs is None or rp is None: raise ValueErrro, "Both rp and rs must be provided to design an elliptic filter." z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k)
1,502
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: b, a = bilinear(b, a, fs=fs) # Transform to proper out type (pole-zero, state-space, numer-denom) pass
1,503
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
def butter(N, Wn, bandtype='band', analog=0, output=''): """Butterworth digital and analog filter design. Description: Design an Nth order lowpass digital Butterworth filter and return the filter coefficients in (B,A) form. Inputs: """ #pre-warp frequencies for digital filter design if not analog: warped = 2*fs*tan(pi*Wn/fs) else: warped = Wn # convert to low-pass prototype # Get analog lowpass prototype # transform to lowpass, bandpass, highpass, or bandstop # Find discrete equivalent if necessary if not analog: pass # Transform to proper out type (pole-zero, state-space, numer-denom) pass
1,504
def vratio(u, ineps, mp): [s,c,d,phi] = special.ellpj(u,mp) ret = abs(ineps - s/c) try: return ret[0] except IndexError, TypeError: return ret
def vratio(u, ineps, mp): [s,c,d,phi] = special.ellpj(u,mp) ret = abs(ineps - s/c) return ret
1,505
def kratio(m, k_ratio): if m < 0: m = 0.0 if m > 1: m = 1.0 if abs(m) > EPSILON and (abs(m) + EPSILON) < 1: k = special.ellpk([1-m,m]) r = k[0] / k[1] - k_ratio elif abs(m) > EPSILON: r = -k_ratio else: r = 1e20 try: return abs(r)[0] except TypeError: return abs(r)
def kratio(m, k_ratio): if m < 0: m = 0.0 if m > 1: m = 1.0 if abs(m) > EPSILON and (abs(m) + EPSILON) < 1: k = special.ellpk([1-m,m]) r = k[0] / k[1] - k_ratio elif abs(m) > EPSILON: r = -k_ratio else: r = 1e20 return abs(r)
1,506
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down. Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, k eps = Num.sqrt(10**(0.1*rp)-1) ck1 = eps / Num.sqrt(10**(0.1*rs)-1) ck1p = Num.sqrt(1-ck1*ck1) if ck1p == 1: raise ValueError, "Cannot design a filter with given rp and rs specifications." wp = 1 val = special.ellpk([1-ck1*ck1,1-ck1p*ck1p]) if abs(1-ck1p*ck1p) < EPSILON: krat = 0 else: krat = N*val[0] / val[1] m = optimize.fmin(kratio, 0.5, args=(krat,), maxfun=250, maxiter=250, disp=0) if m < 0 or m > 1: m = optimize.fminbound(kratio, 0, 1, args=(krat,), maxfun=250, maxiter=250, disp=0) capk = special.ellpk(1-m) ws = wp / sqrt(m) m1 = 1-m j = arange(1-N%2,N,2) jj = len(j) [s,c,d,phi] = special.ellpj(j*capk/N,m*ones(jj)) snew = Num.compress(abs(s) > EPSILON, s) z = 1.0 / (sqrt(m)*snew) z = 1j*z z = Num.concatenate((z,conjugate(z))) r = optimize.fmin(vratio, special.ellpk(1-m), args=(1/eps, ck1p*ck1p), maxfun=250, maxiter=250, printmessg=0) v0 = capk * r / (N*capck1[0]) [sv,cv,dv,phi] = special.ellpj(v0,1-m) p = -(c*d*sv*cv + 1j*s*dv) / (1-(d*sv)**2.0) if N % 2: newp = Num.compress(abs(p.imag) > EPSILON*Num.sqrt(MLab.sum(p*Num.conjugate(p)).real), p) p = Num.concatenate((p,conjugate(newp))) else: p = Num.concatenate((p,conjugate(p))) k = (MLab.prod(-p) / MLab.prod(-z)).real if N % 2 == 0: k = k / Num.sqrt((1+eps*eps)) return z, p, k
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down. Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, k eps = Num.sqrt(10**(0.1*rp)-1) ck1 = eps / Num.sqrt(10**(0.1*rs)-1) ck1p = Num.sqrt(1-ck1*ck1) if ck1p == 1: raise ValueError, "Cannot design a filter with given rp and rs specifications." wp = 1 val = special.ellpk([1-ck1*ck1,1-ck1p*ck1p]) if abs(1-ck1p*ck1p) < EPSILON: krat = 0 else: krat = N*val[0] / val[1] m = optimize.fmin(kratio, 0.5, args=(krat,), maxfun=250, maxiter=250, disp=0) if m < 0 or m > 1: m = optimize.fminbound(kratio, 0, 1, args=(krat,), maxfun=250, maxiter=250, disp=0) capk = special.ellpk(1-m) ws = wp / sqrt(m) m1 = 1-m j = arange(1-N%2,N,2) jj = len(j) [s,c,d,phi] = special.ellpj(j*capk/N,m*ones(jj)) snew = Num.compress(abs(s) > EPSILON, s) z = 1.0 / (sqrt(m)*snew) z = 1j*z z = Num.concatenate((z,conjugate(z))) r = optimize.fmin(vratio, special.ellpk(1-m), args=(1/eps, ck1p*ck1p), maxfun=250, maxiter=250, disp=0) v0 = capk * r / (N*val[0]) [sv,cv,dv,phi] = special.ellpj(v0,1-m) p = -(c*d*sv*cv + 1j*s*dv) / (1-(d*sv)**2.0) if N % 2: newp = Num.compress(abs(p.imag) > EPSILON*Num.sqrt(MLab.sum(p*Num.conjugate(p)).real), p) p = Num.concatenate((p,conjugate(newp))) else: p = Num.concatenate((p,conjugate(p))) k = (MLab.prod(-p) / MLab.prod(-z)).real if N % 2 == 0: k = k / Num.sqrt((1+eps*eps)) return z, p, k
1,507
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down. Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, k eps = Num.sqrt(10**(0.1*rp)-1) ck1 = eps / Num.sqrt(10**(0.1*rs)-1) ck1p = Num.sqrt(1-ck1*ck1) if ck1p == 1: raise ValueError, "Cannot design a filter with given rp and rs specifications." wp = 1 val = special.ellpk([1-ck1*ck1,1-ck1p*ck1p]) if abs(1-ck1p*ck1p) < EPSILON: krat = 0 else: krat = N*val[0] / val[1] m = optimize.fmin(kratio, 0.5, args=(krat,), maxfun=250, maxiter=250, disp=0) if m < 0 or m > 1: m = optimize.fminbound(kratio, 0, 1, args=(krat,), maxfun=250, maxiter=250, disp=0) capk = special.ellpk(1-m) ws = wp / sqrt(m) m1 = 1-m j = arange(1-N%2,N,2) jj = len(j) [s,c,d,phi] = special.ellpj(j*capk/N,m*ones(jj)) snew = Num.compress(abs(s) > EPSILON, s) z = 1.0 / (sqrt(m)*snew) z = 1j*z z = Num.concatenate((z,conjugate(z))) r = optimize.fmin(vratio, special.ellpk(1-m), args=(1/eps, ck1p*ck1p), maxfun=250, maxiter=250, printmessg=0) v0 = capk * r / (N*capck1[0]) [sv,cv,dv,phi] = special.ellpj(v0,1-m) p = -(c*d*sv*cv + 1j*s*dv) / (1-(d*sv)**2.0) if N % 2: newp = Num.compress(abs(p.imag) > EPSILON*Num.sqrt(MLab.sum(p*Num.conjugate(p)).real), p) p = Num.concatenate((p,conjugate(newp))) else: p = Num.concatenate((p,conjugate(p))) k = (MLab.prod(-p) / MLab.prod(-z)).real if N % 2 == 0: k = k / Num.sqrt((1+eps*eps)) return z, p, k
def ellipap(N,rp,rs): """Return (z,p,k) zeros, poles, and gain of an Nth order normalized prototype elliptic analog lowpass filter with rp decibels of ripple in the passband and a stopband rs decibels down.Broken... """ if N == 1: p = -sqrt(1.0/(10**(0.1*rp)-1.0)) k = -p z = [] return z, p, keps = Num.sqrt(10**(0.1*rp)-1) ck1 = eps / Num.sqrt(10**(0.1*rs)-1) ck1p = Num.sqrt(1-ck1*ck1) if ck1p == 1: raise ValueError, "Cannot design a filter with given rp and rs specifications."wp = 1 val = special.ellpk([1-ck1*ck1,1-ck1p*ck1p]) if abs(1-ck1p*ck1p) < EPSILON: krat = 0 else: krat = N*val[0] / val[1]m = optimize.fmin(kratio, 0.5, args=(krat,), maxfun=250, maxiter=250, disp=0) if m < 0 or m > 1: m = optimize.fminbound(kratio, 0, 1, args=(krat,), maxfun=250, maxiter=250, disp=0)capk = special.ellpk(1-m) ws = wp / sqrt(m) m1 = 1-mj = arange(1-N%2,N,2) jj = len(j)[s,c,d,phi] = special.ellpj(j*capk/N,m*ones(jj)) snew = Num.compress(abs(s) > EPSILON, s) z = 1.0 / (sqrt(m)*snew) z = 1j*z z = Num.concatenate((z,conjugate(z)))r = optimize.fmin(vratio, special.ellpk(1-m), args=(1/eps, ck1p*ck1p), maxfun=250, maxiter=250, printmessg=0) v0 = capk * r / (N*capck1[0])[sv,cv,dv,phi] = special.ellpj(v0,1-m) p = -(c*d*sv*cv + 1j*s*dv) / (1-(d*sv)**2.0)if N % 2: newp = Num.compress(abs(p.imag) > EPSILON*Num.sqrt(MLab.sum(p*Num.conjugate(p)).real), p) p = Num.concatenate((p,conjugate(newp))) else: p = Num.concatenate((p,conjugate(p)))k = (MLab.prod(-p) / MLab.prod(-z)).real if N % 2 == 0: k = k / Num.sqrt((1+eps*eps))return z, p, k
1,508
def _cdf(self, x, a, c): val = special.gammainc(a,x**c) return where(c>0,val,1-val)
def _cdf(self, x, a, c): val = special.gammainc(a,x**c) return where(c>0,val,1-val)
1,509
def _ppf(self, q, a, c): val1 = special.gammaincinv(a,q) val2 = special.gammaincinv(a,1-q) ic = 1.0/c return where(c>0,pow(val1,ic),pow(val2,ic))
def _ppf(self, q, a, c): val1 = special.gammaincinv(a,q) val2 = special.gammaincinv(a,1.0-q) ic = 1.0/c return where(c>0,pow(val1,ic),pow(val2,ic))
1,510
def _ppf(self, q, a, c): val1 = special.gammaincinv(a,q) val2 = special.gammaincinv(a,1-q) ic = 1.0/c return where(c>0,pow(val1,ic),pow(val2,ic))
def _ppf(self, q, a, c): val1 = special.gammaincinv(a,q) val2 = special.gammaincinv(a,1-q) ic = 1.0/c return where(c>0,pow(val1,ic),pow(val2,ic))
1,511
def diff(x,order=1,period=None, _cache = _cache): """ diff(x, order=1, period=2*pi) -> y Return k-th derivative (or integral) of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = pow(sqrt(-1)*j*2*pi/period, order) * x_j y_0 = 0 if order is not 0. Optional input: order The order of differentiation. Default order is 1. If order is negative, then integration is carried out under the assumption that x_0==0. period The assumed period of the sequence. Default is 2*pi. Notes: If sum(x)=0 then diff(diff(x,k),-k)==x (within numerical accuracy) For odd order and even len(x), the Nyquist mode is taken zero. """ tmp = asarray(x) if order==0: return tmp if tmp.dtype in (scipy.Complex32, scipy.Complex64): return diff(tmp.real,order,period)+1j*diff(tmp.imag,order,period) if period is not None: c = 2*pi/period else: c = 1.0 n = len(x) omega = _cache.get((n,order,c)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,order=order,c=c): if k: return pow(c*k,order) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=order, zero_nyquist=1) _cache[(n,order,c)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=order%2, overwrite_x=overwrite_x)
def diff(x,order=1,period=None, _cache = _cache): """ diff(x, order=1, period=2*pi) -> y Return k-th derivative (or integral) of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = pow(sqrt(-1)*j*2*pi/period, order) * x_j y_0 = 0 if order is not 0. Optional input: order The order of differentiation. Default order is 1. If order is negative, then integration is carried out under the assumption that x_0==0. period The assumed period of the sequence. Default is 2*pi. Notes: If sum(x)=0 then diff(diff(x,k),-k)==x (within numerical accuracy) For odd order and even len(x), the Nyquist mode is taken zero. """ tmp = asarray(x) if order==0: return tmp if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return diff(tmp.real,order,period)+1j*diff(tmp.imag,order,period) if period is not None: c = 2*pi/period else: c = 1.0 n = len(x) omega = _cache.get((n,order,c)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,order=order,c=c): if k: return pow(c*k,order) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=order, zero_nyquist=1) _cache[(n,order,c)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=order%2, overwrite_x=overwrite_x)
1,512
def tilbert(x,h,period=None, _cache = _cache): """ tilbert(x, h, period=2*pi) -> y Return h-Tilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*coth(j*h*2*pi/period) * x_j y_0 = 0 Input: h Defines the parameter of the Tilbert transform. period The assumed period of the sequence. Default period is 2*pi. Notes: If sum(x)==0 and n=len(x) is odd then tilbert(itilbert(x)) == x If 2*pi*h/period is approximately 10 or larger then numerically tilbert == hilbert (theoretically oo-Tilbert == Hilbert). For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return tilbert(tmp.real,h,period)+\ 1j*tilbert(tmp.imag,h,period) if period is not None: h = h*2*pi/period n = len(x) omega = _cache.get((n,h)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,h=h): if k: return -1/tanh(h*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
def tilbert(x,h,period=None, _cache = _cache): """ tilbert(x, h, period=2*pi) -> y Return h-Tilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*coth(j*h*2*pi/period) * x_j y_0 = 0 Input: h Defines the parameter of the Tilbert transform. period The assumed period of the sequence. Default period is 2*pi. Notes: If sum(x)==0 and n=len(x) is odd then tilbert(itilbert(x)) == x If 2*pi*h/period is approximately 10 or larger then numerically tilbert == hilbert (theoretically oo-Tilbert == Hilbert). For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return tilbert(tmp.real,h,period)+\ 1j*tilbert(tmp.imag,h,period) if period is not None: h = h*2*pi/period n = len(x) omega = _cache.get((n,h)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,h=h): if k: return -1/tanh(h*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
1,513
def itilbert(x,h,period=None, _cache = _cache): """ itilbert(x, h, period=2*pi) -> y Return inverse h-Tilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sqrt(-1)*tanh(j*h*2*pi/period) * x_j y_0 = 0 Optional input: see tilbert.__doc__ """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return itilbert(tmp.real,h,period)+\ 1j*itilbert(tmp.imag,h,period) if period is not None: h = h*2*pi/period n = len(x) omega = _cache.get((n,h)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,h=h): if k: return tanh(h*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
def itilbert(x,h,period=None, _cache = _cache): """ itilbert(x, h, period=2*pi) -> y Return inverse h-Tilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sqrt(-1)*tanh(j*h*2*pi/period) * x_j y_0 = 0 Optional input: see tilbert.__doc__ """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return itilbert(tmp.real,h,period)+\ 1j*itilbert(tmp.imag,h,period) if period is not None: h = h*2*pi/period n = len(x) omega = _cache.get((n,h)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,h=h): if k: return tanh(h*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,h)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
1,514
def hilbert(x, _cache=_cache): """ hilbert(x) -> y Return Hilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*sign(j) * x_j y_0 = 0 Notes: If sum(x)==0 then hilbert(ihilbert(x)) == x For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return hilbert(tmp.real,tol)+1j*hilbert(tmp.imag) n = len(x) omega = _cache.get(n) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k): if k>0: return -1 elif k<0: return 1 return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[n] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
def hilbert(x, _cache=_cache): """ hilbert(x) -> y Return Hilbert transform of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*sign(j) * x_j y_0 = 0 Notes: If sum(x)==0 then hilbert(ihilbert(x)) == x For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return hilbert(tmp.real,tol)+1j*hilbert(tmp.imag) n = len(x) omega = _cache.get(n) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k): if k>0: return -1 elif k<0: return 1 return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[n] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
1,515
def cs_diff(x, a, b, period=None, _cache = _cache): """ cs_diff(x, a, b, period=2*pi) -> y Return (a,b)-cosh/sinh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*cosh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j y_0 = 0 Input: a,b Defines the parameters of the cosh/sinh pseudo-differential operator. period The period of the sequence. Default period is 2*pi. Notes: For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return cs_diff(tmp.real,a,b,period)+\ 1j*cs_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return -cosh(a*k)/sinh(b*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
def cs_diff(x, a, b, period=None, _cache = _cache): """ cs_diff(x, a, b, period=2*pi) -> y Return (a,b)-cosh/sinh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = -sqrt(-1)*cosh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j y_0 = 0 Input: a,b Defines the parameters of the cosh/sinh pseudo-differential operator. period The period of the sequence. Default period is 2*pi. Notes: For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return cs_diff(tmp.real,a,b,period)+\ 1j*cs_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return -cosh(a*k)/sinh(b*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
1,516
def sc_diff(x, a, b, period=None, _cache = _cache): """ sc_diff(x, a, b, period=2*pi) -> y Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j y_0 = 0 Input: a,b Defines the parameters of the sinh/cosh pseudo-differential operator. period The period of the sequence x. Default is 2*pi. Notes: sc_diff(cs_diff(x,a,b),b,a) == x For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return sc_diff(tmp.real,a,b,period)+\ 1j*sc_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return sinh(a*k)/cosh(b*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
def sc_diff(x, a, b, period=None, _cache = _cache): """ sc_diff(x, a, b, period=2*pi) -> y Return (a,b)-sinh/cosh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sqrt(-1)*sinh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j y_0 = 0 Input: a,b Defines the parameters of the sinh/cosh pseudo-differential operator. period The period of the sequence x. Default is 2*pi. Notes: sc_diff(cs_diff(x,a,b),b,a) == x For even len(x), the Nyquist mode of x is taken zero. """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return sc_diff(tmp.real,a,b,period)+\ 1j*sc_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return sinh(a*k)/cosh(b*k) return 0 omega = convolve.init_convolution_kernel(n,kernel,d=1) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,swap_real_imag=1,overwrite_x=overwrite_x)
1,517
def ss_diff(x, a, b, period=None, _cache = _cache): """ ss_diff(x, a, b, period=2*pi) -> y Return (a,b)-sinh/sinh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sinh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j y_0 = a/b * x_0 Input: a,b Defines the parameters of the sinh/sinh pseudo-differential operator. period The period of the sequence x. Default is 2*pi. Notes: ss_diff(ss_diff(x,a,b),b,a) == x """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return ss_diff(tmp.real,a,b,period)+\ 1j*ss_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return sinh(a*k)/sinh(b*k) return float(a)/b omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,overwrite_x=overwrite_x)
def ss_diff(x, a, b, period=None, _cache = _cache): """ ss_diff(x, a, b, period=2*pi) -> y Return (a,b)-sinh/sinh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = sinh(j*a*2*pi/period)/sinh(j*b*2*pi/period) * x_j y_0 = a/b * x_0 Input: a,b Defines the parameters of the sinh/sinh pseudo-differential operator. period The period of the sequence x. Default is 2*pi. Notes: ss_diff(ss_diff(x,a,b),b,a) == x """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return ss_diff(tmp.real,a,b,period)+\ 1j*ss_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): if k: return sinh(a*k)/sinh(b*k) return float(a)/b omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,overwrite_x=overwrite_x)
1,518
def cc_diff(x, a, b, period=None, _cache = _cache): """ cc_diff(x, a, b, period=2*pi) -> y Return (a,b)-cosh/cosh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = cosh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j Input: a,b Defines the parameters of the sinh/sinh pseudo-differential operator. Optional input: period The period of the sequence x. Default is 2*pi. Notes: cc_diff(cc_diff(x,a,b),b,a) == x """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return cc_diff(tmp.real,a,b,period)+\ 1j*cc_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): return cosh(a*k)/cosh(b*k) omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,overwrite_x=overwrite_x)
def cc_diff(x, a, b, period=None, _cache = _cache): """ cc_diff(x, a, b, period=2*pi) -> y Return (a,b)-cosh/cosh pseudo-derivative of a periodic sequence x. If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = cosh(j*a*2*pi/period)/cosh(j*b*2*pi/period) * x_j Input: a,b Defines the parameters of the sinh/sinh pseudo-differential operator. Optional input: period The period of the sequence x. Default is 2*pi. Notes: cc_diff(cc_diff(x,a,b),b,a) == x """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return cc_diff(tmp.real,a,b,period)+\ 1j*cc_diff(tmp.imag,a,b,period) if period is not None: a = a*2*pi/period b = b*2*pi/period n = len(x) omega = _cache.get((n,a,b)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel(k,a=a,b=b): return cosh(a*k)/cosh(b*k) omega = convolve.init_convolution_kernel(n,kernel) _cache[(n,a,b)] = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve(tmp,omega,overwrite_x=overwrite_x)
1,519
def shift(x, a, period=None, _cache = _cache): """ shift(x, a, period=2*pi) -> y Shift periodic sequence x by a: y(u) = x(u+a). If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = exp(j*a*2*pi/period*sqrt(-1)) * x_f Optional input: period The period of the sequences x and y. Default period is 2*pi. """ tmp = asarray(x) if tmp.dtype in (scipy.Complex32, scipy.Complex64): return shift(tmp.real,a,period)+1j*shift(tmp.imag,a,period) if period is not None: a = a*2*pi/period n = len(x) omega = _cache.get((n,a)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel_real(k,a=a): return cos(a*k) def kernel_imag(k,a=a): return sin(a*k) omega_real = convolve.init_convolution_kernel(n,kernel_real,d=0, zero_nyquist=0) omega_imag = convolve.init_convolution_kernel(n,kernel_imag,d=1, zero_nyquist=0) _cache[(n,a)] = omega_real,omega_imag else: omega_real,omega_imag = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve_z(tmp,omega_real,omega_imag, overwrite_x=overwrite_x)
def shift(x, a, period=None, _cache = _cache): """ shift(x, a, period=2*pi) -> y Shift periodic sequence x by a: y(u) = x(u+a). If x_j and y_j are Fourier coefficients of periodic functions x and y, respectively, then y_j = exp(j*a*2*pi/period*sqrt(-1)) * x_f Optional input: period The period of the sequences x and y. Default period is 2*pi. """ tmp = asarray(x) if tmp.dtypechar in (scipy.Complex32, scipy.Complex64): return shift(tmp.real,a,period)+1j*shift(tmp.imag,a,period) if period is not None: a = a*2*pi/period n = len(x) omega = _cache.get((n,a)) if omega is None: if len(_cache)>20: while _cache: _cache.popitem() def kernel_real(k,a=a): return cos(a*k) def kernel_imag(k,a=a): return sin(a*k) omega_real = convolve.init_convolution_kernel(n,kernel_real,d=0, zero_nyquist=0) omega_imag = convolve.init_convolution_kernel(n,kernel_imag,d=1, zero_nyquist=0) _cache[(n,a)] = omega_real,omega_imag else: omega_real,omega_imag = omega overwrite_x = tmp is not x and not hasattr(x,'__array__') return convolve.convolve_z(tmp,omega_real,omega_imag, overwrite_x=overwrite_x)
1,520
def _rvs(self, c): return abs(norm(loc=c,size=self._size))
def _rvs(self, c): return abs(norm(loc=c,size=self._size))
1,521
def _rvs(self, df, nc): return norm(loc=nc,size=self._size)*sqrt(df) / sqrt(chi2(df,size=self._size))
def _rvs(self, df, nc): return norm(loc=nc,size=self._size)*sqrt(df) / sqrt(chi2(df,size=self._size))
1,522
def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Numeric.Float, linesep='\n', rowsize=10000, missing=0): """Return an array or arrays from ascii_formatted data in |fileobject|. Inputs: fileobject -- An open file object or a string for a valid filename. The string can be prepended by "~/" or "~<name>/" to read a file from the home directory. separator -- a string or a tuple of strings to indicate the column separators. If the length of the string tuple is less than the total number of columns, then the last separator is assumed to be the separator for the rest of the columns. columns -- a tuple of integers and range-tuples which describe the columns to read from the file. A negative entry in the last column specifies the negative skip value to the end. Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) will read [1,4,5,6,7,8,11,14,17,19,21,23,...] If multiple arrays are to be returned, then this argument should be an ordered list of such tuples. There should be one entry in the list for each arraytype in the atype list. lines -- a tuple with the same structure as columns which indicates the lines to read. comment -- the comment character (line will be ignored even if it is specified by the lines tuple) linesep -- separator between rows. missing -- value to insert in array when conversion to number fails. atype -- the typecode of the output array. If multiple outputs are desired, then this should be a list of typecodes. The columns to fill the array represented by the given typecode is determined from the columns argument. If the length of atype does not match the length of the columns list, then, the smallest one is expanded to match the largest by repeatedly copying the last entry. rowsize -- the allocation row size (array grows by this amount as data is read in). Output -- the 1 or 2d array, or a tuple of output arrays of different types, sorted in order of the first column to be placed in the output array. """ # Make separator into a tuple of separators. if type(separator) in [types.StringType, type(default)]: sep = (separator,) else: sep = tuple(separator) # Create ascii_object from |fileobject| argument. ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) columns, atype = convert_to_equal_lists(columns, atype) numout = len(atype) # Get the number of columns to read and expand the columns argument colsize, collist = getcolumns(ascii_object, columns, sep) # Intialize the output arrays outrange = range(numout) outarr = [] for k in outrange: if not atype[k] in "".join(Numeric.typecodes.values()): raise ValueError, "One of the array types is invalid, k=%d" % k outarr.append(Numeric.zeros((rowsize, colsize[k]),atype[k])) row = 0 block_row = 0 for line in ascii_object: if line.strip() == '': continue vals = process_line(line, sep, collist, atype, missing) for k in outrange: outarr[k][row] = vals[k] row += 1 block_row += 1 if block_row >= rowsize: for k in outrange: outarr[k].resize((outarr[k].shape[0] + rowsize,colsize)) block_row = 0 for k in outrange: if outarr[k].shape[0] != row: outarr[k].resize((row,colsize[k])) a = outarr[k] if a.shape[0] == 1 or a.shape[1] == 1: outarr[k] = Numeric.ravel(a) if len(outarr) == 1: return outarr[0] else: return tuple(outarr)
def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Numeric.Float, linesep='\n', rowsize=10000, missing=0): """Return an array or arrays from ascii_formatted data in |fileobject|. Inputs: fileobject -- An open file object or a string for a valid filename. The string can be prepended by "~/" or "~<name>/" to read a file from the home directory. separator -- a string or a tuple of strings to indicate the column separators. If the length of the string tuple is less than the total number of columns, then the last separator is assumed to be the separator for the rest of the columns. columns -- a tuple of integers and range-tuples which describe the columns to read from the file. A negative entry in the last column specifies the negative skip value to the end. Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) will read [1,4,5,6,7,8,11,14,17,19,21,23,...] If multiple arrays are to be returned, then this argument should be an ordered list of such tuples. There should be one entry in the list for each arraytype in the atype list. lines -- a tuple with the same structure as columns which indicates the lines to read. comment -- the comment character (line will be ignored even if it is specified by the lines tuple) linesep -- separator between rows. missing -- value to insert in array when conversion to number fails. atype -- the typecode of the output array. If multiple outputs are desired, then this should be a list of typecodes. The columns to fill the array represented by the given typecode is determined from the columns argument. If the length of atype does not match the length of the columns list, then, the smallest one is expanded to match the largest by repeatedly copying the last entry. rowsize -- the allocation row size (array grows by this amount as data is read in). Output -- the 1 or 2d array, or a tuple of output arrays of different types, sorted in order of the first column to be placed in the output array. """ # Make separator into a tuple of separators. if type(separator) in [types.StringType, type(default)]: sep = (separator,) else: sep = tuple(separator) # Create ascii_object from |fileobject| argument. ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) columns, atype = convert_to_equal_lists(columns, atype) numout = len(atype) # Get the number of columns to read and expand the columns argument colsize, collist = getcolumns(ascii_object, columns, sep) # Intialize the output arrays outrange = range(numout) outarr = [] for k in outrange: if not atype[k] in typecodes: raise ValueError, "One of the array types is invalid, k=%d" % k outarr.append(Numeric.zeros((rowsize, colsize[k]),atype[k])) row = 0 block_row = 0 for line in ascii_object: if line.strip() == '': continue vals = process_line(line, sep, collist, atype, missing) for k in outrange: outarr[k][row] = vals[k] row += 1 block_row += 1 if block_row >= rowsize: for k in outrange: outarr[k].resize((outarr[k].shape[0] + rowsize,colsize)) block_row = 0 for k in outrange: if outarr[k].shape[0] != row: outarr[k].resize((row,colsize[k])) a = outarr[k] if a.shape[0] == 1 or a.shape[1] == 1: outarr[k] = Numeric.ravel(a) if len(outarr) == 1: return outarr[0] else: return tuple(outarr)
1,523
def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Numeric.Float, linesep='\n', rowsize=10000, missing=0): """Return an array or arrays from ascii_formatted data in |fileobject|. Inputs: fileobject -- An open file object or a string for a valid filename. The string can be prepended by "~/" or "~<name>/" to read a file from the home directory. separator -- a string or a tuple of strings to indicate the column separators. If the length of the string tuple is less than the total number of columns, then the last separator is assumed to be the separator for the rest of the columns. columns -- a tuple of integers and range-tuples which describe the columns to read from the file. A negative entry in the last column specifies the negative skip value to the end. Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) will read [1,4,5,6,7,8,11,14,17,19,21,23,...] If multiple arrays are to be returned, then this argument should be an ordered list of such tuples. There should be one entry in the list for each arraytype in the atype list. lines -- a tuple with the same structure as columns which indicates the lines to read. comment -- the comment character (line will be ignored even if it is specified by the lines tuple) linesep -- separator between rows. missing -- value to insert in array when conversion to number fails. atype -- the typecode of the output array. If multiple outputs are desired, then this should be a list of typecodes. The columns to fill the array represented by the given typecode is determined from the columns argument. If the length of atype does not match the length of the columns list, then, the smallest one is expanded to match the largest by repeatedly copying the last entry. rowsize -- the allocation row size (array grows by this amount as data is read in). Output -- the 1 or 2d array, or a tuple of output arrays of different types, sorted in order of the first column to be placed in the output array. """ # Make separator into a tuple of separators. if type(separator) in [types.StringType, type(default)]: sep = (separator,) else: sep = tuple(separator) # Create ascii_object from |fileobject| argument. ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) columns, atype = convert_to_equal_lists(columns, atype) numout = len(atype) # Get the number of columns to read and expand the columns argument colsize, collist = getcolumns(ascii_object, columns, sep) # Intialize the output arrays outrange = range(numout) outarr = [] for k in outrange: if not atype[k] in "".join(Numeric.typecodes.values()): raise ValueError, "One of the array types is invalid, k=%d" % k outarr.append(Numeric.zeros((rowsize, colsize[k]),atype[k])) row = 0 block_row = 0 for line in ascii_object: if line.strip() == '': continue vals = process_line(line, sep, collist, atype, missing) for k in outrange: outarr[k][row] = vals[k] row += 1 block_row += 1 if block_row >= rowsize: for k in outrange: outarr[k].resize((outarr[k].shape[0] + rowsize,colsize)) block_row = 0 for k in outrange: if outarr[k].shape[0] != row: outarr[k].resize((row,colsize[k])) a = outarr[k] if a.shape[0] == 1 or a.shape[1] == 1: outarr[k] = Numeric.ravel(a) if len(outarr) == 1: return outarr[0] else: return tuple(outarr)
def read_array(fileobject, separator=default, columns=default, comment="#", lines=default, atype=Numeric.Float, linesep='\n', rowsize=10000, missing=0): """Return an array or arrays from ascii_formatted data in |fileobject|. Inputs: fileobject -- An open file object or a string for a valid filename. The string can be prepended by "~/" or "~<name>/" to read a file from the home directory. separator -- a string or a tuple of strings to indicate the column separators. If the length of the string tuple is less than the total number of columns, then the last separator is assumed to be the separator for the rest of the columns. columns -- a tuple of integers and range-tuples which describe the columns to read from the file. A negative entry in the last column specifies the negative skip value to the end. Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) will read [1,4,5,6,7,8,11,14,17,19,21,23,...] If multiple arrays are to be returned, then this argument should be an ordered list of such tuples. There should be one entry in the list for each arraytype in the atype list. lines -- a tuple with the same structure as columns which indicates the lines to read. comment -- the comment character (line will be ignored even if it is specified by the lines tuple) linesep -- separator between rows. missing -- value to insert in array when conversion to number fails. atype -- the typecode of the output array. If multiple outputs are desired, then this should be a list of typecodes. The columns to fill the array represented by the given typecode is determined from the columns argument. If the length of atype does not match the length of the columns list, then, the smallest one is expanded to match the largest by repeatedly copying the last entry. rowsize -- the allocation row size (array grows by this amount as data is read in). Output -- the 1 or 2d array, or a tuple of output arrays of different types, sorted in order of the first column to be placed in the output array. """ # Make separator into a tuple of separators. if type(separator) in [types.StringType, type(default)]: sep = (separator,) else: sep = tuple(separator) # Create ascii_object from |fileobject| argument. ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) columns, atype = convert_to_equal_lists(columns, atype) numout = len(atype) # Get the number of columns to read and expand the columns argument colsize, collist = getcolumns(ascii_object, columns, sep) # Intialize the output arrays outrange = range(numout) outarr = [] for k in outrange: if not atype[k] in "".join(Numeric.typecodes.values()): raise ValueError, "One of the array types is invalid, k=%d" % k outarr.append(Numeric.zeros((rowsize, colsize[k]),atype[k])) row = 0 block_row = 0 for line in ascii_object: if line.strip() == '': continue vals = process_line(line, sep, collist, atype, missing) for k in outrange: outarr[k][row] = vals[k] row += 1 block_row += 1 if block_row >= rowsize: for k in outrange: outarr[k].resize((outarr[k].shape[0] + rowsize,colsize[k])) block_row = 0 for k in outrange: if outarr[k].shape[0] != row: outarr[k].resize((row,colsize[k])) a = outarr[k] if a.shape[0] == 1 or a.shape[1] == 1: outarr[k] = Numeric.ravel(a) if len(outarr) == 1: return outarr[0] else: return tuple(outarr)
1,524
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info config = Configuration('fftpack',parent_package, top_path) fft_opt_info = get_info('fft_opt') config.add_data_dir('tests') config.add_library('dfftpack', sources=[join('dfftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c'] config.add_extension('_fftpack', sources=sources, libraries=['dfftpack'], extra_info = fft_opt_info ) config.add_extension('convolve', sources = ['convolve.pyf','src/convolve.c'], libraries = ['dfftpack'], extra_info = fft_opt_info ) return config
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info config = Configuration('fftpack',parent_package, top_path) djbfft_info = {} mkl_info = get_info('mkl') if mkl_info: mkl_info.setdefault('define_macros', []).append(('SCIPY_MKL_H', None)) fft_opt_info = mkl_info else: fft_opt_info = get_info('fftw3') or get_info('fftw2') \ or get_info('dfftw') djbfft_info = get_info('djbfft') config.add_data_dir('tests') config.add_library('dfftpack', sources=[join('dfftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c'] config.add_extension('_fftpack', sources=sources, libraries=['dfftpack'], extra_info = fft_opt_info ) config.add_extension('convolve', sources = ['convolve.pyf','src/convolve.c'], libraries = ['dfftpack'], extra_info = fft_opt_info ) return config
1,525
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info config = Configuration('fftpack',parent_package, top_path) fft_opt_info = get_info('fft_opt') config.add_data_dir('tests') config.add_library('dfftpack', sources=[join('dfftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c'] config.add_extension('_fftpack', sources=sources, libraries=['dfftpack'], extra_info = fft_opt_info ) config.add_extension('convolve', sources = ['convolve.pyf','src/convolve.c'], libraries = ['dfftpack'], extra_info = fft_opt_info ) return config
def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration from numpy.distutils.system_info import get_info config = Configuration('fftpack',parent_package, top_path) fft_opt_info = get_info('fft_opt') config.add_data_dir('tests') config.add_library('dfftpack', sources=[join('dfftpack','*.f')]) sources = ['fftpack.pyf','src/zfft.c','src/drfft.c','src/zrfft.c', 'src/zfftnd.c'] config.add_extension('_fftpack', sources=sources, libraries=['dfftpack'], extra_info = [fft_opt_info, djbfft_info], ) config.add_extension('convolve', sources = ['convolve.pyf','src/convolve.c'], libraries = ['dfftpack'], extra_info = [fft_opt_info, djbfft_info], ) return config
1,526
def __init__(self, *params): if len(params) == 2: (width, height) = params self.name = "No Name" self.author = "No Author"
def __init__(self, *params): if len(params) == 2: (width, height) = params self.name = "No Name" self.author = "No Author"
1,527
def find(lst, obj): for i in lst: if i[0] == obj: return i return None
def find(lst, obj): for i in lst: if i[0] == obj: return i return None
1,528
def find(lst, obj): for i in lst: if i[0] == obj: return i return None
def find(lst, obj): for i in lst: if i[0] == obj: return i return None
1,529
def save(self, filename): f = file(filename, 'w') f.write(";; Generated by Flexlay Editor\n" "(supertux-level\n") f.write(" (version 1)\n") f.write(" (name \"%s\")\n" % self.name) f.write(" (author \"%s\")\n" % self.author) f.write(" (width %d)\n" % self.width) f.write(" (height %d)\n" % self.height)
def save(self, filename): f = file(filename, 'w') f.write(";; Generated by Flexlay Editor\n" "(supertux-level\n") f.write(" (version 1)\n") f.write(" (name \"%s\")\n" % self.name) f.write(" (author \"%s\")\n" % self.author) f.write(" (width %d)\n" % self.width) f.write(" (height %d)\n" % self.height)
1,530
def __init__(self, tileset, gui): self.selector_window = Panel(CL_Rect(CL_Point(800-134, 23+33), CL_Size(128 + 6, 558)), gui.get_component()) self.tileselector = TileSelector(CL_Rect(CL_Point(3, 3), CL_Size(128, 552)), self.selector_window) self.tileselector.set_tileset(tileset) self.tileselector.set_tiles(range(1,100)) self.tileselector.show(False)
def __init__(self, tileset, gui): self.selector_window = Panel(CL_Rect(CL_Point(800-134, 23+33), CL_Size(128 + 6, 558)), gui.get_component()) self.tileselector = TileSelector(CL_Rect(CL_Point(3, 3), CL_Size(128, 552)), self.selector_window) self.tileselector.set_tileset(tileset) self.tileselector.set_tiles(range(1,100)) self.tileselector.show(False)
1,531
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
1,532
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
1,533
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self
1,534
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
1,535
def __init__(self): self.tileselector_window = CL_Window(CL_Rect(CL_Point(150, 150), CL_Size(210, 210)), "Tile Selector", gui.get_component()) self.tileselector = TileSelector(5, 3, self.tileselector_window.get_client_area()) self.tileselector.set_tileset(tileset) self.tileselector.set_tiles(range(1,100))
def __init__(self): self.tileselector_window = CL_Window(CL_Rect(CL_Point(150, 150), CL_Size(210, 210)), "Tile Selector", gui.get_component()) self.tileselector = TileSelector(5, 3, self.tileselector_window.get_client_area()) self.tileselector.set_tileset(tileset) self.tileselector.set_tiles(range(1,100))
1,536
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
1,537
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
1,538
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
def load_game_tiles(tileset, filename): tree = sexpr_read_from_file(filename) tree = tree[1:] for i in tree: if i[0] == "tile": data = i[1:] id = get_value_from_tree(['id', '_'], data, -1) image = get_value_from_tree(['editor-images', '_'], data, False) if not(image): image = get_value_from_tree(['images', '_'], data, "notile.png") tileset.add_tile(id, Tile(supertux_datadir + 'images/tilesets/' + image, CL_Color(255, 255, 255, 255), CL_Color(255, 0, 0, 128)))
1,539
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self tree = sexpr_read_from_file(filename) data = tree[1:]
def __init__(self, filename): print "SuperTuxLevel:__init__" self.me = self tree = sexpr_read_from_file(filename) data = tree[1:]
1,540
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
1,541
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
1,542
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
def activate(self, workspace): #editor_tilemap_set_current(self.interactive.to_layer()) workspace.set_current_map(self.editormap)
1,543
def __init__(self, *params): if len(params) == 2: (width, height) = params self.name = "No Name" self.author = "No Author"
def __init__(self, *params): if len(params) == 2: (width, height) = params self.name = "No Name" self.author = "No Author"
1,544
def save(self, filename): f = file(filename, 'w') f.write(";; Generated by Flexlay Editor\n" "(supertux-level\n") f.write(" (version 1)\n") f.write(" (name \"%s\")\n" % self.name) f.write(" (author \"%s\")\n" % self.author) f.write(" (width %d)\n" % self.width) f.write(" (height %d)\n" % self.height)
def save(self, filename): f = file(filename, 'w') f.write(";; Generated by Flexlay Editor\n" "(supertux-level\n") f.write(" (version 1)\n") f.write(" (name \"%s\")\n" % self.name) f.write(" (author \"%s\")\n" % self.author) f.write(" (width %d)\n" % self.width) f.write(" (height %d)\n" % self.height)
1,545
def __repr__(self): return self.value
def __repr__(self): return self.value
1,546
def search_irc_logs(query, stats=None): if not stats: stats = SearchStats() # will be discarded, but, oh, well query = query.lower() for filename in sorted(glob.glob(os.path.join(logfile_path, '*.log'))): date = date_from_filename(filename) link = link_from_filename(filename) stats.files += 1 for time, event, info in LogParser(file(filename)): if event == LogParser.COMMENT: nick, text = info text = nick + ' ' + text elif event == LogParser.NICKCHANGE: text, oldnick, newnick = info else: text = str(info) stats.lines += 1 if query in text.lower(): stats.matches += 1 yield SearchResult(filename, link, date, time, event, info)
def search_irc_logs(query, stats=None): if not stats: stats = SearchStats() # will be discarded, but, oh, well query = query.lower() files = glob.glob(os.path.join(logfile_path, '*.log')) files.sort() for filename in files: date = date_from_filename(filename) link = link_from_filename(filename) stats.files += 1 for time, event, info in LogParser(file(filename)): if event == LogParser.COMMENT: nick, text = info text = nick + ' ' + text elif event == LogParser.NICKCHANGE: text, oldnick, newnick = info else: text = str(info) stats.lines += 1 if query in text.lower(): stats.matches += 1 yield SearchResult(filename, link, date, time, event, info)
1,547
def foot(self): print >> self.outfile, self.suffix self.navbar(prev, index, next) print >> self.outfile, """
def foot(self): print >> self.outfile, self.suffix self.navbar(self.prev, self.index, self.next) print >> self.outfile, """
1,548
def __iter__(self): for line in self.infile: line = line.rstrip('\r\n') if not line: continue
def __iter__(self): for line in self.infile: line = line.rstrip('\r\n') if not line: continue
1,549
def nickchange(self, oldnick, newnick): if oldnick in self.nick_colour: self.nick_colour[newnick] = self.nick_colour.pop(oldnick)
def change(self, oldnick, newnick): if oldnick in self.nick_colour: self.nick_colour[newnick] = self.nick_colour.pop(oldnick)
1,550
def servermsg(self, time, what, text): """Output a generic server message.
def servermsg(self, time, what, text): """Output a generic server message.
1,551
def nicktext(self, time, nick, text, htmlcolour): """Output a comment uttered by someone.
def nicktext(self, time, nick, text, htmlcolour): """Output a comment uttered by someone.
1,552
def servermsg(self, time, what, text): text = escape(text) text = createlinks(text)
def servermsg(self, time, what, text): text = escape(text) text = createlinks(text)
1,553
def nicktext(self, time, nick, text, htmlcolour): nick = escape(nick) text = escape(text) text = createlinks(text) text = text.replace(' ', '&nbsp;&nbsp;')
def nicktext(self, time, nick, text, htmlcolour): nick = escape(nick) text = escape(text) text = createlinks(text) text = text.replace(' ', '&nbsp;&nbsp;')
1,554
def tpRender(self, md, section, args): data=[] try: # see if we are being run as a sub-document root=md['tree-root-url'] url=md['tree-item-url'] state=md['tree-state'] or md['state'] substate=md['-tree-substate-'] colspan=md['tree-colspan'] level=md['tree-level'] except KeyError: # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: state=tpValuesIds(self) else: try: state=md['tree-state'] or md['state'] or md['-tree-state-'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] colspan=1+tpStateLevel(state) level = 0 substate=state root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' # Save state in a cookie if state: md['RESPONSE'].setCookie('tree-state',quote(str(state)[1:-1]+',')) else: md['RESPONSE'].expireCookie('tree-state') if substate==state: data.append('<TABLE CELLSPACING="0">\n') #level=0 treeData={'tree-root-url': root, 'tree-colspan': colspan, 'tree-state': state } md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,substate,data,colspan, section,md,treeData, level, args) if state is substate: data.append('</TABLE>\n') result=join(data,'') finally: md.pop(1) return result
def tpRender(self, md, section, args): data=[] try: # see if we are being run as a sub-document root=md['tree-root-url'] url=md['tree-item-url'] state=md['tree-state'] or md['state'] substate=md['-tree-substate-'] colspan=md['tree-colspan'] level=md['tree-level'] except KeyError: # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: state=tpValuesIds(self) else: try: state=md['tree-state'] or md['state'] or md['-tree-state-'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] colspan=1+tpStateLevel(state) level = 0 substate=state root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' # Save state in a cookie if state: md['RESPONSE'].setCookie('tree-state',quote(str(state)[1:-1]+',')) else: md['RESPONSE'].expireCookie('tree-state') if substate==state: data.append('<TABLE CELLSPACING="0">\n') #level=0 treeData={'tree-root-url': root, 'tree-colspan': colspan, 'tree-state': state } md._push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,substate,data,colspan, section,md,treeData, level, args) if state is substate: data.append('</TABLE>\n') result=join(data,'') finally: md.pop(1) return result
1,555
def tpRender(self, md, section, args): data=[] try: # see if we are being run as a sub-document root=md['tree-root-url'] url=md['tree-item-url'] state=md['tree-state'] or md['state'] substate=md['-tree-substate-'] colspan=md['tree-colspan'] level=md['tree-level'] except KeyError: # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: state=tpValuesIds(self) else: try: state=md['tree-state'] or md['state'] or md['-tree-state-'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] colspan=1+tpStateLevel(state) level = 0 substate=state root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' # Save state in a cookie if state: md['RESPONSE'].setCookie('tree-state',quote(str(state)[1:-1]+',')) else: md['RESPONSE'].expireCookie('tree-state') if substate==state: data.append('<TABLE CELLSPACING="0">\n') #level=0 treeData={'tree-root-url': root, 'tree-colspan': colspan, 'tree-state': state } md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,substate,data,colspan, section,md,treeData, level, args) if state is substate: data.append('</TABLE>\n') result=join(data,'') finally: md.pop(1) return result
def tpRender(self, md, section, args): data=[] try: # see if we are being run as a sub-document root=md['tree-root-url'] url=md['tree-item-url'] state=md['tree-state'] or md['state'] substate=md['-tree-substate-'] colspan=md['tree-colspan'] level=md['tree-level'] except KeyError: # Check for collapse all, expand all, and state try: collapse_all=md['collapse_all'] except: collapse_all=None if collapse_all: state=[] else: try: expand_all=md['expand_all'] except: expand_all=None if expand_all: state=tpValuesIds(self) else: try: state=md['tree-state'] or md['state'] or md['-tree-state-'] if state[0] != '[': state=unquote(state) state=list(eval(state,{'__builtins__':{}})) except: state=[] colspan=1+tpStateLevel(state) level = 0 substate=state root=md['URL'] l=rfind(root, '/') if l >= 0: root=root[l+1:] url='' # Save state in a cookie if state: md['RESPONSE'].setCookie('tree-state',quote(str(state)[1:-1]+',')) else: md['RESPONSE'].expireCookie('tree-state') if substate==state: data.append('<TABLE CELLSPACING="0">\n') #level=0 treeData={'tree-root-url': root, 'tree-colspan': colspan, 'tree-state': state } md.push(treeData) try: for item in self.tpValues(): data=tpRenderTABLE(item,root,url,state,substate,data,colspan, section,md,treeData, level, args) if state is substate: data.append('</TABLE>\n') result=join(data,'') finally: md._pop(1) return result
1,556
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
1,557
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
1,558
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md._push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
1,559
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md.pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md.pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
def tpRenderTABLE(self, root_url, url, state, substate, data, colspan, section, md, treeData, level=0, args=None): have_arg=args.has_key try: items=self.tpValues() except: items=None if not items and have_arg('leaves'): items=1 tpUrl=self.tpURL() url = (url and ('%s/%s' % (url, tpUrl))) or tpUrl treeData['tree-item-url']=url treeData['tree-level']=level treeData['tree-item-expanded']=0 try: id=self.tpId() except: id=None if id is None: try: id=self._p_oid except: id=None if id is None: id=pyid(self) exp=0 sub=None output=data.append # Add prefix output('<TR>\n') # Add +/- icon if items: if level: if level > 3: output( '<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') output('<TD WIDTH="16" VALIGN="TOP">') for i in range(len(substate)): sub=substate[i] if sub[0]==id: exp=i+1 break if exp: treeData['tree-item-expanded']=1 del substate[exp-1] output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoMinus)) substate.append(sub) else: substate.append([id]) output('<A HREF="%s?tree-state=%s">%s</A>' % (root_url,quote(str(state)[1:-1]+','), icoPlus)) del substate[-1] output('</TD>\n') else: level=level+1 if level > 3: output('<TD COLSPAN="%s"></TD>' % (level-1)) elif level > 1: output('<TD></TD>' * (level-1)) output('<TD WIDTH="16"></TD>\n') # add item text dataspan=colspan-level output('<TD COLSPAN="%s" VALIGN="TOP">' % dataspan) output(section(self, md)) output('</TD>\n</TR>\n') if exp: level=level+1 if level > 2: h='<TD COLSPAN="%s"></TD>' % (level-1) elif level > 1: h='<TD></TD>' * (level-1) else: h='' if have_arg('header'): if md.has_key(args['header']): output(md.getitem(args['header'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) if items==1: # leaves treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['leaves'],0)( self,md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) md._pop(1) elif have_arg('expand'): treeData['-tree-substate-']=sub treeData['tree-level']=level md.push(treeData) output(md.getitem(args['expand'],0)(self,md)) md._pop(1) else: __traceback_info__=sub, args, state, substate for item in items: if len(sub)==1: sub.append([]) data=tpRenderTABLE(item, root_url,url,state,sub[1],data, colspan, section, md, treeData, level, args) if not sub[1]: del sub[1] if have_arg('footer'): if md.has_key(args['footer']): output(md.getitem(args['footer'],0)( self, md, standard_html_header=( '<TR>%s<TD WIDTH="16"></TD>' '<TD COLSPAN="%s" VALIGN="TOP">' % (h, dataspan-1)), standard_html_footer='</TD></TR>', )) return data
1,560
def attrAction(self, item): name, value, action = item[:3] if action == 1 or (action > 1 and not self.showtal): return 0, name, value macs = self.macroStack if action == 2 and self.metal and macs: if len(macs) > 1 or not macs[-1][2]: # Drop all METAL attributes at a use-depth above one. return 0, name, value # Clear 'entering' flag macs[-1][2] = 0 # Convert or drop depth-one METAL attributes. i = rfind(name, ":") + 1 prefix, suffix = name[:i], name[i:] if suffix == "define-macro": # Convert define-macro as we enter depth one. name = prefix + "use-macro" value = macs[-1][0] # Macro name elif suffix == "define-slot": name = prefix + "fill-slot" elif suffix == "fill-slot": pass else: return 0, name, value
def attrAction(self, item): name, value, action = item[:3] if action == 1 or (action > 1 and not self.showtal): return 0, name, value macs = self.macroStack if action == 2 and self.metal and macs: if len(macs) > 1 or not macs[-1][2]: # Drop all METAL attributes at a use-depth above one. return 0, name, value # Clear 'entering' flag macs[-1][2] = 0 # Convert or drop depth-one METAL attributes. i = name.rfind(":") + 1 prefix, suffix = name[:i], name[i:] if suffix == "define-macro": # Convert define-macro as we enter depth one. name = prefix + "use-macro" value = macs[-1][0] # Macro name elif suffix == "define-slot": name = prefix + "fill-slot" elif suffix == "fill-slot": pass else: return 0, name, value
1,561
def attrAction_tal(self, item): name, value, action = item[:3] if action > 1: return self.attrAction(item) ok = 1 if self.html and lower(name) in BOOLEAN_HTML_ATTRS: evalue = self.engine.evaluateBoolean(item[3]) if evalue is self.Default: if action == 1: # Cancelled insert ok = 0 elif evalue: value = None else: ok = 0 else: evalue = self.engine.evaluateText(item[3]) if evalue is self.Default: if action == 1: # Cancelled insert ok = 0 else: if evalue is None: ok = 0 value = evalue if ok: if value is None: value = name value = "%s=%s" % (name, quote(value)) return ok, name, value
def attrAction_tal(self, item): name, value, action = item[:3] if action > 1: return self.attrAction(item) ok = 1 if self.html and name.lower() in BOOLEAN_HTML_ATTRS: evalue = self.engine.evaluateBoolean(item[3]) if evalue is self.Default: if action == 1: # Cancelled insert ok = 0 elif evalue: value = None else: ok = 0 else: evalue = self.engine.evaluateText(item[3]) if evalue is self.Default: if action == 1: # Cancelled insert ok = 0 else: if evalue is None: ok = 0 value = evalue if ok: if value is None: value = name value = "%s=%s" % (name, quote(value)) return ok, name, value
1,562
def do_insertText_tal(self, stuff): text = self.engine.evaluateText(stuff[0]) if text is None: return if text is self.Default: self.interpret(stuff[1]) return s = escape(text) self._stream_write(s) i = rfind(s, '\n') if i < 0: self.col = self.col + len(s) else: self.col = len(s) - (i + 1)
def do_insertText_tal(self, stuff): text = self.engine.evaluateText(stuff[0]) if text is None: return if text is self.Default: self.interpret(stuff[1]) return s = escape(text) self._stream_write(s) i = s.rfind('\n') if i < 0: self.col = self.col + len(s) else: self.col = len(s) - (i + 1)
1,563
def package_home(globals_dict): __name__=globals_dict['__name__'] return sys.modules[__name__].__path__[0]
def package_home(globals_dict): __name__=globals_dict['__name__'] m=sys.modules[__name__] if hasattr(m,'__path__'): return m.__path__[0] return sys.modules[__name__[:rfind(__name__,'.')]].__path__[0]
1,564
def new(self, key):
def new(self, key):
1,565
def notifyAdd(self, item): if self._addCallback: try: self._addCallback(item, self) # Use self as context except: pass # Eat all errors
def notifyAdd(self, item): callback = self._addCallback if type(callback) is type(''): callback = self.aq_parent.unrestrictedTraverse(callback) if callable(callback): try: self._addCallback(item, self) # Use self as context except: pass # Eat all errors
1,566
def notifyAdd(self, item): if self._addCallback: try: self._addCallback(item, self) # Use self as context except: pass # Eat all errors
def notifyAdd(self, item): if self._addCallback: try: callback(item, self) # Use self as context except: pass # Eat all errors
1,567
def notifyDestruct(self, item): if self._delCallback: try: self._delCallback(item, self) # Use self as context except: pass # Eat all errors
def notifyDestruct(self, item): callback = self._delCallback if type(callback) is type(''): callback = self.aq_parent.unrestrictedTraverse(callback) if callable(callback): try: self._delCallback(item, self) # Use self as context except: pass # Eat all errors
1,568
def notifyDestruct(self, item): if self._delCallback: try: self._delCallback(item, self) # Use self as context except: pass # Eat all errors
def notifyDestruct(self, item): if self._delCallback: try: callback(item, self) # Use self as context except: pass # Eat all errors
1,569
def _clean(self, b, index):
def _clean(self, b, index):
1,570
def get_startup_cmd(self, python, more): cmdline = ( '%s -c "from Zope import configure;' 'configure(\'%s\');' % (python, self.options.configfile) ) return cmdline + more + '\"'
def get_startup_cmd(self, python, more): cmdline = ( '%s -c "from Zope2 import configure;' 'configure(\'%s\');' % (python, self.options.configfile) ) return cmdline + more + '\"'
1,571
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
1,572
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
def taste(spam): "a favorable reviewer" return spam,'yum yum, I like ' + spam
1,573
def function_with_empty_signature(): pass
def function_with_empty_signature(): pass
1,574
def function_with_empty_signature(): pass
def function_with_empty_signature(): pass
1,575
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
1,576
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
1,577
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
1,578
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
1,579
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
def doc_img( self, s, expr1=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+)').search, expr2=re.compile('\"([ _a-zA-Z0-9*.:/;,\-\n\~]+)\":img:([a-zA-Z0-9\-.:/;,\n\~]+):([a-zA-Z0-9\-.:/;,\n\~]+)').search ):
1,580
def manage_test(self, REQUEST):
def manage_test(self, REQUEST):
1,581
def testSetupStartupHandler(self): import zLOG import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode on <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.assert_(not zLOG._call_initialize) self.assertEqual(starter.startup_handler.formatter, zLOG.EventLogger.formatters['file']) self.assertEqual(starter.startup_handler.level, logging.DEBUG) self.assertEqual(starter.startup_handler, zLOG.EventLogger.EventLogger.logger.handlers[0]) self.assertEqual(len(zLOG.EventLogger.EventLogger.logger.handlers), 1) self.assertEqual(zLOG.EventLogger.EventLogger.logger.level, logging.DEBUG) self.assertEqual(starter.startup_handler.level, logging.DEBUG) self.failUnlessEqual(starter.startup_handler.stream, sys.stderr) conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.failIfEqual(starter.startup_handler.stream, sys.stderr)
def testSetupStartupHandler(self): import zLOG import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode on <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.assert_(not zLOG._call_initialize) self.assertEqual(starter.startup_handler.formatter, zLOG.EventLogger.formatters['file']) self.assertEqual(starter.startup_handler.level, 15) self.assertEqual(starter.startup_handler, zLOG.EventLogger.EventLogger.logger.handlers[0]) self.assertEqual(len(zLOG.EventLogger.EventLogger.logger.handlers), 1) self.assertEqual(zLOG.EventLogger.EventLogger.logger.level, logging.DEBUG) self.assertEqual(starter.startup_handler.level, 15) self.failUnlessEqual(starter.startup_handler.stream, sys.stderr) conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.failIfEqual(starter.startup_handler.stream, sys.stderr)
1,582
def testSetupStartupHandler(self): import zLOG import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode on <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.assert_(not zLOG._call_initialize) self.assertEqual(starter.startup_handler.formatter, zLOG.EventLogger.formatters['file']) self.assertEqual(starter.startup_handler.level, logging.DEBUG) self.assertEqual(starter.startup_handler, zLOG.EventLogger.EventLogger.logger.handlers[0]) self.assertEqual(len(zLOG.EventLogger.EventLogger.logger.handlers), 1) self.assertEqual(zLOG.EventLogger.EventLogger.logger.level, logging.DEBUG) self.assertEqual(starter.startup_handler.level, logging.DEBUG) self.failUnlessEqual(starter.startup_handler.stream, sys.stderr) conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.failIfEqual(starter.startup_handler.stream, sys.stderr)
def testSetupStartupHandler(self): import zLOG import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode on <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.assert_(not zLOG._call_initialize) self.assertEqual(starter.startup_handler.formatter, zLOG.EventLogger.formatters['file']) self.assertEqual(starter.startup_handler.level, logging.DEBUG) self.assertEqual(starter.startup_handler, zLOG.EventLogger.EventLogger.logger.handlers[0]) self.assertEqual(len(zLOG.EventLogger.EventLogger.logger.handlers), 1) self.failUnlessEqual(starter.startup_handler.stream, sys.stderr) conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog>""") starter = ZopeStarter(conf) starter.setupStartupHandler() self.failIfEqual(starter.startup_handler.stream, sys.stderr)
1,583
def testSetupConfiguredLoggers(self): import zLOG import logging import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog> <logger access> level info <logfile> path <<INSTANCE_HOME>>/Z2.log </logfile> </logger> <logger trace> level info <logfile> path <<INSTANCE_HOME>>/trace.log </logfile> </logger> """) try: starter = ZopeStarter(conf) starter.setupStartupHandler() starter.info('hello') starter.removeStartupHandler() starter.setupConfiguredLoggers() starter.flushStartupHandlerBuffer() l = open(os.path.join(TEMPNAME, 'event.log')).read() self.failUnless(l.find('hello') > -1) self.failUnless(os.path.exists(os.path.join(TEMPNAME, 'Z2.log'))) self.failUnless(os.path.exists(os.path.join(TEMPNAME,'trace.log'))) finally: for name in ('event.log', 'Z2.log', 'trace.log'): try: os.unlink(os.path.join(TEMPNAME, name)) except: pass
def testSetupConfiguredLoggers(self): import zLOG import logging import sys conf = self.load_config_text(""" instancehome <<INSTANCE_HOME>> debug-mode off <eventlog> level info <logfile> path <<INSTANCE_HOME>>/event.log level info </logfile> </eventlog> <logger access> level info <logfile> path <<INSTANCE_HOME>>/Z2.log </logfile> </logger> <logger trace> level info <logfile> path <<INSTANCE_HOME>>/trace.log </logfile> </logger> """) try: starter = ZopeStarter(conf) starter.setupStartupHandler() starter.info('hello') starter.removeStartupHandler() starter.setupConfiguredLoggers() starter.flushStartupHandlerBuffer() l = open(os.path.join(TEMPNAME, 'event.log')).read() self.failUnless(l.find('hello') > -1) self.failUnless(os.path.exists(os.path.join(TEMPNAME, 'Z2.log'))) self.failUnless(os.path.exists(os.path.join(TEMPNAME,'trace.log'))) finally: for name in ('event.log', 'Z2.log', 'trace.log'): try: os.unlink(os.path.join(TEMPNAME, name)) except: pass
1,584
def __str__(self): context=getattr(self, 'aq_parent', None) if context is None: return self.__name__ return "(%s: %s of %s)" % (uid(self), self.aq_self, context)
def __str__(self): context=getattr(self, 'aq_parent', None) if context is None: return self.__name__ return "(%s: %s of %s)" % (uid(self), self.aq_self, context)
1,585
def manage_addExternalMethod(self, id, title, module, function, REQUEST=None): """Add an external method to a folder Un addition to the standard Principia object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """ i=ExternalMethod(id,title,module,function) self._setObject(id,i) return self.manage_main(self,REQUEST)
def manage_addExternalMethod(self, id, title, module, function, REQUEST=None): """Add an external method to a folder Un addition to the standard Principia object-creation arguments, 'id' and title, the following arguments are defined: function -- The name of the python function. This can be a an ordinary Python function, or a bound method. module -- The name of the file containing the function definition. The module normally resides in the 'Extensions' directory, however, the file name may have a prefix of 'product.', indicating that it should be found in a product directory. For example, if the module is: 'ACMEWidgets.foo', then an attempt will first be made to use the file 'lib/python/Products/ACMEWidgets/Extensions/foo.py'. If this failes, then the file 'Extensions/ACMEWidgets.foo.py' will be used. """ i=ExternalMethod(id,title,module,function) self._setObject(id,i) return self.manage_main(self,REQUEST)
1,586
def isFolderish(self): return self.getClassAttr('isPrincipiaFolderish', 0)
def isFolderish(self): return self.getClassAttr('isPrincipiaFolderish', 0)
1,587
def addIndex(self, name, type,extra=None): # Convert the type by finding an appropriate product which supports # this interface by that name. Bleah
def addIndex(self, name, type,extra=None): # Convert the type by finding an appropriate product which supports # this interface by that name. Bleah
1,588
def addIndex(self, name, type,extra=None): # Convert the type by finding an appropriate product which supports # this interface by that name. Bleah
def addIndex(self, name, type,extra=None): # Convert the type by finding an appropriate product which supports # this interface by that name. Bleah
1,589
def index_html(self, REQUEST=None): "View the Help Topic" if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
def index_html(self, REQUEST=None): "View the Help Topic" if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
1,590
def index_html(self, REQUEST=None): """ View the STX Help Topic """ if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
def index_html(self, REQUEST=None): """ View the STX Help Topic """ if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
1,591
def index_html(self, REQUEST, RESPONSE): "View the Help Topic" if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
def index_html(self, REQUEST, RESPONSE): "View the Help Topic" if 0 and Globals.DevelopmentMode: try: mtime=os.stat(self.file) except: mtime=0 if mtime != self._v_last_read: self.obj = open(self.file).read() self._v_last_read=mtime self.reindex_object()
1,592
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
def registerClass(self, instance_class=None, meta_type='', permission=None, constructors=(), icon=None, permissions=None, legacy=(), ): """Register a constructor
1,593
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=1, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: bases.append(getattr(self, b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=0, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: bases.append(getattr(self, b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
1,594
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=1, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: bases.append(getattr(self, b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
def manage_addZClass(self, id, title='', baseclasses=[], meta_type='', CreateFactory=1, REQUEST=None): """Add a Z Class """ bases=[] for b in baseclasses: if Products.meta_classes.has_key(b): bases.append(Products.meta_classes[b]) else: bases.append(self._getOb(b)) Z=ZClass(id,title,bases) if meta_type: Z._zclass_.meta_type=meta_type self._setObject(id, Z) if CreateFactory and meta_type: self.manage_addDTMLMethod( id+'_addForm', id+' constructor input form', addFormDefault % {'id': id, 'meta_type': meta_type}, ) self.manage_addDTMLMethod( id+'_add', id+' constructor', addDefault % {'id': id}, ) self.manage_addPrincipiaFactory( id+'_factory', id+' factory', meta_type, id+'_addForm', ) if REQUEST is not None: return self.manage_main(self,REQUEST)
1,595
def __init__(self,
def __init__(self,
1,596
def HEAD(self, REQUEST, RESPONSE): """Retrieve resource information without a response body.""" self.dav__init(REQUEST, RESPONSE) if hasattr(self, 'content_type'): RESPONSE.setHeader('Content-Type', absattr(self.content_type)) if hasattr(self, 'getSize'): RESPONSE.setHeader('Content-Length', absattr(self.getSize)) RESPONSE.setStatus(200) return RESPONSE
def HEAD(self, REQUEST, RESPONSE): """Retrieve resource information without a response body.""" self.dav__init(REQUEST, RESPONSE) if hasattr(self, 'content_type'): RESPONSE.setHeader('Content-Type', absattr(self.content_type)) else: url=urlfix(REQUEST['URL'], 'HEAD') name=filter(None, string.split(url, '/'))[-1] ct, ce=mimetypes.guess_type(name) ct=ct or 'application/octet-stream' ct=string.lower(ct) RESPONSE.setHeader('Content-Type', ct) if hasattr(aq_base(self), 'get_size'): RESPONSE.setHeader('Content-Length', absattr(self.get_size)) if hasattr(self, '_p_mtime'): mtime=rfc1123_date(self._p_mtime) RESPONSE.setHeader('Last-Modified', mtime) RESPONSE.setStatus(200) return RESPONSE
1,597
def __getitem__(self, name): product=self.aq_acquire('_getProducts')()._product(name) dispatcher=FactoryDispatcher(product, self.aq_parent) return dispatcher.__of__(self)
def __getitem__(self, name): product=self.aq_acquire('_getProducts')()._product(name) dispatcher=FactoryDispatcher(product, self.aq_parent) return dispatcher.__of__(self)
1,598
def __bobo_traverse__(self, REQUEST, name): product=self.aq_acquire('_getProducts')()._product(name) dispatcher=FactoryDispatcher(product, self.aq_parent, REQUEST) return dispatcher.__of__(self)
def __bobo_traverse__(self, REQUEST, name): product=self.aq_acquire('_getProducts')()._product(name) dispatcher_class=getattr( getattr(Products, name, None), '__FactoryDispatcher__', FactoryDispatcher) dispatcher=dispatcher_class(product, self.aq_parent, REQUEST) return dispatcher.__of__(self)
1,599