Exemplo n.º 1
0
def specgram_demo():
   '''
   the demo in matplotlib. But calls
   interactive.specgram
   '''
   from pylab import arange, sin, where, logical_and, randn, pi

   dt = 0.0005
   t = arange(0.0, 20.0, dt)
   s1 = sin(2*pi*100*t)
   s2 = 2*sin(2*pi*400*t)

   # create a transient "chirp"
   mask = where(logical_and(t>10, t<12), 1.0, 0.0)
   s2 = s2 * mask

   # add some noise into the mix
   nse = 0.01*randn(len(t))

   x = s1 + s2 + nse # the signal
   NFFT = 1024       # the length of the windowing segments
   Fs = int(1.0/dt)  # the sampling frequency

   from ifigure.interactive import figure, specgram, nsec, plot, isec, clog, hold

   figure()
   hold(True)
   nsec(2)
   isec(0)
   plot(t, x)
   isec(1)
   specgram(x, NFFT=NFFT, Fs=Fs, noverlap=900)
   clog()
Exemplo n.º 2
0
def spec_demo():
    '''
    the demo in matplotlib. But calls
    interactive.specgram
    '''
    from pylab import arange, sin, where, logical_and, randn, pi

    dt = 0.0005
    t = arange(0.0, 20.0, dt)
    s1 = sin(2 * pi * 100 * t)
    s2 = 2 * sin(2 * pi * 400 * t)

    # create a transient "chirp"
    mask = where(logical_and(t > 10, t < 12), 1.0, 0.0)
    s2 = s2 * mask

    # add some noise into the mix
    nse = 0.01 * randn(len(t))

    x = s1 + s2 + nse  # the signal
    NFFT = 1024  # the length of the windowing segments
    Fs = int(1.0 / dt)  # the sampling frequency

    from ifigure.interactive import figure, spec, nsec, plot, isec, clog, hold

    figure()
    hold(True)
    nsec(2)
    isec(0)
    plot(t, x)
    isec(1)
    spec(t, x, NFFT=NFFT, noverlap=900)
    clog()
Exemplo n.º 3
0
def plot_tiles3():
    x, y, z = read_tile_data(list=True)
    figure()
    threed('on')
    hold('on')
    for k in range(100):
        m = k + 100
        plot(x[m], y[m], z[m], facecolor=[1, 0, 0, 1])
Exemplo n.º 4
0
def plot_tiles3():
    x, y, z = read_tile_data(list = True)
    figure()
    threed('on')
    hold('on')
    for k in range(100):
       m = k+100
       plot(x[m], y[m], z[m], facecolor = [1, 0, 0, 1])
Exemplo n.º 5
0
def contour_demo2(**kwargs):
    import mpl_toolkits.mplot3d.axes3d as axes3d
    from ifigure.interactive import contourf, threed, figure, hold
    X, Y, Z = axes3d.get_test_data(0.05)
    v = figure(gl=True)
    threed('on')
    hold('on')
    contourf(X, Y, Z)
    contourf(X, Y, Z, zdir='x', offset=-40)
Exemplo n.º 6
0
def contour_demo2(**kwargs):
    import mpl_toolkits.mplot3d.axes3d as axes3d
    from ifigure.interactive import contourf, threed, figure, hold
    X, Y, Z = axes3d.get_test_data(0.05) 
    v = figure(gl = True)
    threed('on')
    hold('on')
    contourf(X, Y, Z)    
    contourf(X, Y, Z, zdir = 'x', offset = -40)
Exemplo n.º 7
0
def image_demo():
   from ifigure.interactive import image, threed, figure, hold

   figure(gl = True)
   threed('on')
   hold('on')    
   X = np.linspace(-5, 5, 40)
   Y = np.linspace(-5, 5, 40)
   X, Y = np.meshgrid(X, Y)
   R = np.sqrt(X**2 + Y**2)
   Z = np.sin(R)    
   image(Z, cmap='coolwarm', im_center = [0,0,1])
   image(Z, cmap='coolwarm', im_center = [0,0,1],
         im_axes = ([0,0,1], [0,1,0]))
   image(Z, cmap='coolwarm', im_center = [0,0,1],
         im_axes = ([1/np.sqrt(2), 0,1/np.sqrt(2)],
                    [0, 1, 0]))
Exemplo n.º 8
0
def image_demo():
    from ifigure.interactive import image, threed, figure, hold

    figure(gl=True)
    threed('on')
    hold('on')
    X = np.linspace(-5, 5, 40)
    Y = np.linspace(-5, 5, 40)
    X, Y = np.meshgrid(X, Y)
    R = np.sqrt(X**2 + Y**2)
    Z = np.sin(R)
    image(Z, cmap='coolwarm', im_center=[0, 0, 1])
    image(Z,
          cmap='coolwarm',
          im_center=[0, 0, 1],
          im_axes=([0, 0, 1], [0, 1, 0]))
    image(Z,
          cmap='coolwarm',
          im_center=[0, 0, 1],
          im_axes=([1 / np.sqrt(2), 0, 1 / np.sqrt(2)], [0, 1, 0]))