2015-11-29 élasticité - scénario onde

L'installation Elasticité dynamique agit comme un filtre et génère de nouveaux espaces démultipliés, comme un empilement quasi infini d'horizons. Par principe de réflexion, la pièce absorbe l'image de l'environnement et accumule les points de vue ; le mouvement permanent requalifie continuellement ce qui est regardé et entendu.

Ce post crée des ondes se propageant sur la série de lames.

In [1]:
%load_ext autoreload
%autoreload 2
In [2]:
import matplotlib
#matplotlib.use('nbagg')
matplotlib.rcParams['figure.max_open_warning'] = 400
%matplotlib inline
%config InlineBackend.figure_format='retina'
import matplotlib.pyplot as plt
#%config InlineBackend.figure_format = 'svg'
#import mpld3
#mpld3.enable_notebook()

vague simple

In [3]:
!rm  ../files/onde*
In [4]:
name = 'onde'
vext = '.webm'
import os
import numpy as np
import MotionClouds as mc
mc.figpath = '../files/elasticite/'
mc.N_X, mc.N_Y, mc.N_frame = 50, 2, 2048
fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)
theta, B_theta = 0., np.pi/8.
alpha, sf_0, B_sf, B_V = 1., .02, .1, .05
seed = 1234565
V_X, V_Y = .05, 0.
mc_wave = mc.envelope_gabor(fx, fy, ft, V_X=V_X, V_Y=V_Y, B_V=B_V, 
                            theta=theta, B_theta=B_theta, sf_0=sf_0, B_sf=B_sf, alpha=alpha)
mc.figures(mc_wave, name, vext=vext, seed=seed, do_figs=False)
mc.in_show_video(name)
Saving sequence ../files/onde as a .webm format

Saving the corrresponding cloud as a nd.array:

In [5]:
vague_dense = mc.rectif(mc.random_cloud(mc_wave), contrast=1)
print(vague_dense.shape)
(50, 2, 2048)
In [6]:
plt.matshow(vague_dense[:, 0, :])
Out[6]:
<matplotlib.image.AxesImage at 0x1063ca5f8>
In [7]:
mc.figures(mc_wave, name + '_impulse', seed=seed, impulse=True, do_figs=False)
mc.in_show_video(name + '_impulse')
Saving sequence ../files/onde_impulse as a .webm format
In [8]:
vague_solo = mc.rectif(mc.random_cloud(mc_wave, seed=seed, impulse=True), contrast=1)
print(vague_solo.shape, vague_solo.min(), vague_solo.mean(), vague_solo.max())
(50, 2, 2048) 0.368487487441 0.5 1.0
In [9]:
plt.matshow(vague_solo[:, 0, :])
Out[9]:
<matplotlib.image.AxesImage at 0x106be09b0>

transforme la vague 2D sur les lames

In [10]:
def vague_animate(z, x_offset=0, y_offset=0, N_lame = 25, t_offset=0, N_steps = 2048):
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    from IPython.display import HTML

    fig, ax = plt.subplots(figsize=(15, 3))

    x = np.arange(0, N_lame)        # x-array

    def vague(i):
        return z[x_offset:(x_offset+N_lame), y_offset, t_offset+i]

    def animate(i):
        line.set_ydata(vague(i))  # update the data
        return line,

    #Init only required for blitting to give a clean slate.
    def init():
        line.set_ydata(np.ma.array(x, mask=True))
        return line,

    line,  = ax.plot(x, vague(0))
    ax.set_xlim([0, N_lame-1])
    ax.set_ylim([0, 1])

    anim = animation.FuncAnimation(fig, animate, np.arange(1, N_steps), init_func=init,
        interval=25, blit=True)

    return HTML(anim.to_html5_video())
    
In [11]:
vague_animate(vague_dense[::2, :, :])
Out[11]: