コード例 #1
0
ファイル: ephyview.py プロジェクト: rossant/spiky
    
    zoom = nav.sx
    box = nav.get_viewbox()
    xlim = ((box[0] + 1) / 2. * (duration_initial), (box[2] + 1) / 2. * (duration_initial))
    xlimex, slice = get_view(data.shape[0], xlim, freq)
    
    # Paging system.
    dur = xlim[1] - xlim[0]
    index = int(np.floor(xlim[0] / dur))
    zoom_index = int(np.round(duration_initial / dur))
    i = (index, zoom_index)
    global SLICE
    if i != SLICE:
        SLICE = i
        updater.update(data, xlimex, slice)
    if updater.info:
        figure.set_data(**updater.info)
        updater.info.clear()
    
plt.animate(anim, dt=.01)
plt.action('Wheel', change_channel_height, key_modifier='Control',
           param_getter=lambda p: p['wheel'] * .001)
plt.action('Wheel', pan, key_modifier='Shift',
           param_getter=lambda p: (p['wheel'] * .002, 0))
plt.action('DoubleClick', 'ResetZoom')

plt.xlim(0., duration_initial)

plt.show()
f.close()
コード例 #2
0
ファイル: synthesizer.py プロジェクト: rossant/synthesizer
def mousemove(fig, param):
    update(fig, param, False)

def mouseclick(fig, param):
    update(fig, param, True)
    
# Animate the discs.
def anim(fig, param):
    # The disc position is obtained through a simple linear filter of the
    # mouse position.
    global position
    position += w * (-position + mouse)
    fig.set_data(position=position)
    
# We bind the "Move" action to the "mousemove" callback.
plt.action('LeftClick', mouseclick)
plt.action('LeftClickMove', mousemove)

# We bind the "Animate" event to the "anim" callback.
plt.animate(anim, dt=.01)

# Start the synthesizer.
p.play()

# Show the figure.
plt.show()

# Close the synthesizer at the end.
p.pause()
コード例 #3
0
        
        zoom = nav.sx
        box = nav.get_viewbox()
        xlim = ((box[0] + 1) / 2. * (duration_initial), (box[2] + 1) / 2. * (duration_initial))
        xlimex, slice = get_view(data.shape[0], xlim, freq)
        
        # Paging system.
        dur = xlim[1] - xlim[0]
        index = int(np.floor(xlim[0] / dur))
        zoom_index = int(np.round(duration_initial / dur))
        i = (index, zoom_index)
        global SLICE
        if i != SLICE:
            SLICE = i
            updater.update(data, xlimex, slice)
        if updater.info:
            figure.set_data(**updater.info)
            updater.info.clear()
        
    plt.animate(anim, dt=.01)
    plt.action('Wheel', change_channel_height, key_modifier='Control',
               param_getter=lambda p: p['wheel'] * .001)
    plt.action('Wheel', pan, key_modifier='Shift',
               param_getter=lambda p: (p['wheel'] * .002, 0))
    plt.action('DoubleClick', 'ResetZoom')

    plt.xlim(0., duration_initial)

    plt.show()
    # f.close()