def lowpass_order(f_pass, f_stop, dpass_dB, dstop_dB, fsamp = <NUM_LIT:1>):
dpass = <NUM_LIT:1> - <NUM_LIT:10>**(-dpass_dB/<NUM_LIT:20>)<EOL>dstop = <NUM_LIT:10>**(-dstop_dB/<NUM_LIT:20>)<EOL>Df = (f_stop - f_pass)/fsamp<EOL>a1 = <NUM_LIT><EOL>a2 = <NUM_LIT><EOL>a3 = -<NUM_LIT><EOL>a4 = -<NUM_LIT><EOL>a5 = -<NUM_LIT><EOL>a6 = -<NUM_LIT><EOL>Dinf = np.log10(dstop)*(a1*np.log10(dpass)**<NUM_LIT:2> + a2*np.log10(dpass) + a3)+ (a4*np.log10(dpass)**<NUM_LIT:2> + a5*np.log10(dpass) + a6)<EOL>f = <NUM_LIT> + <NUM_LIT>*(np.log10(dpass) - np.log10(dstop))<EOL>N = Dinf/Df - f*Df + <NUM_LIT:1><EOL>ff = <NUM_LIT:2>*np.array([<NUM_LIT:0>, f_pass, f_stop, fsamp/<NUM_LIT:2>])/fsamp<EOL>aa = np.array([<NUM_LIT:1>, <NUM_LIT:1>, <NUM_LIT:0>, <NUM_LIT:0>])<EOL>wts = np.array([<NUM_LIT:1.0>, dpass/dstop])<EOL>return int(N), ff, aa, wts<EOL>
Optimal FIR (equal ripple) Lowpass Order Determination

Text reference: Ifeachor, Digital Signal Processing a Practical Approach, 
second edition, Prentice Hall, 2002.
Journal paper reference: Herriman et al., Practical Design Rules for Optimum
Finite Imulse Response Digitl Filters, Bell Syst. Tech. J., vol 52, pp. 
769-799, July-Aug., 1973.IEEE, 1973.