Beispiel #1
0
def run_galry(N, dt=1, duration=10, seed=20130318):
    """Return the median time interval between two successive paint refresh."""
    prng = RandomState(seed)
    data = prng.randn(N, 10)

    fig = glplt.figure(figsize=(600, 600), autodestruct=duration * 1000)
    fig.t0 = time.clock()
    fig.times = []
    fig.N = N
    fig.plot(data.T)
    fig.animate(callback, dt=dt * 0.001)
    fig.show()

    return 1.0 / np.median(fig.times)
def load(data):
    fig = plt.figure(figsize=(600, 600), autodestruct=100)
    fig.plot(data.T)
    plt.show()
Beispiel #3
0
    
    def set_a(self, a):
        self.a = a
        
    def callback(self):
        x = int(512 * self.f0 / self.rate)
        t = np.arange(0, x * float(self.rate) / self.f0) / float(self.rate)
        return self.a * .75 * np.sin(2 * np.pi * self.f0 * t)

# Create the synthesizer.
rate = 44100
s = Synthesizer(rate)
p = Player(rate=rate, callback=s.callback)

# Create a Figure.
plt.figure(toolbar=False)

# VISUALS
# -------
# Number of discs.
n = 20

# Display n static discs with an opacity gradient.
color = np.ones((n, 4))
color[:,2] = 0
color[:,3] = np.linspace(0.01, 0.1, n)
plt.plot(np.zeros(n), np.zeros(n), 'o', color=color, ms=50, is_static=True)

# Global variable with the current disc positions.
position = np.zeros((n, 2))
Beispiel #4
0
    data = f.root.RawData
except:
    data = f.root.raw_data
    
nsamples, nchannels = data.shape
total_size = nsamples
freq = 20000.
dt = 1. / freq
duration = (data.shape[0] - 1) * dt

duration_initial = 5.

x = np.tile(np.linspace(0., duration, nsamples // MAXSIZE), (nchannels, 1))
y = np.zeros_like(x)+ np.linspace(-.9, .9, nchannels).reshape((-1, 1))

plt.figure(toolbar=False, show_grid=True)
plt.visual(MultiChannelVisual, x=x, y=y)

updater = DataUpdater(impatient=True)

SLICE = None

def change_channel_height(figure, parameter):
    global CHANNEL_HEIGHT
    CHANNEL_HEIGHT *= (1 + parameter)
    figure.set_data(channel_height=CHANNEL_HEIGHT)

def pan(figure, parameter):
    figure.process_interaction('Pan', parameter)
    
def anim(figure, parameter):
Beispiel #5
0
def run_galry(data):
    fig = glplt.figure(figsize=(600, 600), autodestruct=1)
    fig.plot(data.T)
    glplt.show()
Beispiel #6
0
with tb.openFile('testm.h5', 'r') as f:
    data = f.root.data
            
    nsamples, nchannels = data.shape
    total_size = nsamples
    freq = 10000.
    dt = 1. / freq
    duration = (data.shape[0] - 1) * dt

    duration_initial = 5.

    x = np.tile(np.linspace(0., duration, nsamples // MAXSIZE), (nchannels, 1))
    y = np.zeros_like(x)+ np.linspace(-.9, .9, nchannels).reshape((-1, 1))

    plt.figure(toolbar=False, show_grid=True)
    plt.visual(MultiChannelVisual, x=x, y=y)

    updater = DataUpdater(impatient=True)

    SLICE = None

    def change_channel_height(figure, parameter):
        global CHANNEL_HEIGHT
        CHANNEL_HEIGHT *= (1 + parameter)
        figure.set_data(channel_height=CHANNEL_HEIGHT)

    def pan(figure, parameter):
        figure.process_interaction('Pan', parameter)
        
    def anim(figure, parameter):