Show
Ignore:
Timestamp:
05/20/09 16:50:09 (10 months ago)
Author:
ptvirtan
Message:

Docstring fixes: make some examples to work properly

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/numpy/lib/function_base.py

    r6858 r7007  
    20712071    Plot the window and the frequency response: 
    20722072 
    2073     >>> from numpy import clip, log10, array, bartlett 
     2073    >>> from numpy import clip, log10, array, bartlett, linspace 
    20742074    >>> from scipy.fftpack import fft, fftshift 
    20752075    >>> import matplotlib.pyplot as plt 
     
    20812081    >>> plt.xlabel("Sample") 
    20822082    >>> plt.show() 
    2083  
     2083     
     2084    >>> plt.figure() 
    20842085    >>> A = fft(window, 2048) / 25.5 
    20852086    >>> mag = abs(fftshift(A)) 
     
    20882089    >>> response = clip(response,-100,100) 
    20892090    >>> plt.plot(freq, response) 
    2090     >>> plt.title("Frequency response of Bartlett window") 
     2091    >>> plt.title("Frequency response of Blackman window") 
    20912092    >>> plt.ylabel("Magnitude [dB]") 
    20922093    >>> plt.xlabel("Normalized frequency [cycles per sample]") 
    2093     >>> plt.axis('tight'); plt.show() 
     2094    >>> plt.axis('tight') 
     2095    >>> plt.show() 
    20942096 
    20952097    """ 
     
    21682170    Plot the window and its frequency response (requires SciPy and matplotlib): 
    21692171 
    2170     >>> from numpy import clip, log10, array, bartlett 
    2171     >>> from numpy.fft import fft 
     2172    >>> from numpy import clip, log10, array, bartlett, linspace 
     2173    >>> from numpy.fft import fft, fftshift 
    21722174    >>> import matplotlib.pyplot as plt 
    21732175 
     
    21782180    >>> plt.xlabel("Sample") 
    21792181    >>> plt.show() 
    2180  
     2182     
     2183    >>> plt.figure() 
    21812184    >>> A = fft(window, 2048) / 25.5 
    21822185    >>> mag = abs(fftshift(A)) 
     
    21882191    >>> plt.ylabel("Magnitude [dB]") 
    21892192    >>> plt.xlabel("Normalized frequency [cycles per sample]") 
    2190     >>> plt.axis('tight'); plt.show() 
     2193    >>> plt.axis('tight') 
     2194    >>> plt.show() 
    21912195 
    21922196    """ 
     
    22622266 
    22632267    >>> window = np.hanning(51) 
    2264     >>> plt.subplot(121) 
    22652268    >>> plt.plot(window) 
    22662269    >>> plt.title("Hann window") 
    22672270    >>> plt.ylabel("Amplitude") 
    22682271    >>> plt.xlabel("Sample") 
    2269  
     2272    >>> plt.show() 
     2273 
     2274    >>> plt.figure() 
    22702275    >>> A = fft(window, 2048) / 25.5 
    22712276    >>> mag = abs(fftshift(A)) 
     
    22732278    >>> response = 20*np.log10(mag) 
    22742279    >>> response = np.clip(response,-100,100) 
    2275     >>> plt.subplot(122) 
    22762280    >>> plt.plot(freq, response) 
    22772281    >>> plt.title("Frequency response of the Hann window") 
    22782282    >>> plt.ylabel("Magnitude [dB]") 
    22792283    >>> plt.xlabel("Normalized frequency [cycles per sample]") 
    2280     >>> plt.axis('tight'); plt.show() 
     2284    >>> plt.axis('tight') 
     2285    >>> plt.show() 
    22812286 
    22822287    """ 
     
    23472352    Plot the window and the frequency response: 
    23482353 
    2349     >>> from numpy import clip, log10, array, hamming 
     2354    >>> from numpy import clip, log10, array, hamming, linspace 
    23502355    >>> from scipy.fftpack import fft, fftshift 
    23512356    >>> import matplotlib.pyplot as plt 
     
    23582363    >>> plt.show() 
    23592364 
     2365    >>> plt.figure() 
    23602366    >>> A = fft(window, 2048) / 25.5 
    23612367    >>> mag = abs(fftshift(A)) 
     
    23672373    >>> plt.ylabel("Magnitude [dB]") 
    23682374    >>> plt.xlabel("Normalized frequency [cycles per sample]") 
    2369     >>> plt.axis('tight'); plt.show() 
     2375    >>> plt.axis('tight') 
     2376    >>> plt.show() 
    23702377 
    23712378    """ 
     
    25922599    Plot the window and the frequency response: 
    25932600 
    2594     >>> from numpy import clip, log10, array, kaiser 
     2601    >>> from numpy import clip, log10, array, kaiser, linspace 
    25952602    >>> from scipy.fftpack import fft, fftshift 
    25962603    >>> import matplotlib.pyplot as plt 
     
    26032610    >>> plt.show() 
    26042611 
     2612    >>> plt.figure() 
    26052613    >>> A = fft(window, 2048) / 25.5 
    26062614    >>> mag = abs(fftshift(A)) 
     
    26122620    >>> plt.ylabel("Magnitude [dB]") 
    26132621    >>> plt.xlabel("Normalized frequency [cycles per sample]") 
    2614     >>> plt.axis('tight'); plt.show() 
     2622    >>> plt.axis('tight') 
     2623    >>> plt.show() 
    26152624 
    26162625    """ 
     
    26772686 
    26782687    >>> import matplotlib.pyplot as plt 
    2679     >>> plt.plot(x, sinc(x)) 
     2688    >>> plt.plot(x, np.sinc(x)) 
    26802689    >>> plt.title("Sinc Function") 
    26812690    >>> plt.ylabel("Amplitude") 
     
    26872696    >>> x = np.arange(-200., 201.)/50. 
    26882697    >>> xx = np.outer(x, x) 
    2689     >>> plt.imshow(sinc(xx)) 
     2698    >>> plt.imshow(np.sinc(xx)) 
    26902699 
    26912700    """