Testing Color

Testing the Color

In [1]:
import numpy as np
np.set_printoptions(precision=3, suppress=True)
import pylab
import matplotlib.pyplot as plt
%matplotlib inline
In [2]:
import MotionClouds as mc
fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)
print(mc.envelope_color.__doc__)
    Returns the color envelope.

    In some circonstances, it is desirable to create a texture with a different "color"
    than that of natural images (that is where the envelope is in 1/f).

    Run 'test_color' notebook to see the effect of alpha
    alpha = 0 white
    alpha = 1 pink
    alpha = 2 red/brownian
    (see http://en.wikipedia.org/wiki/1/f_noise )
    
In [3]:
import os
name = 'color'
fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)
z = mc.envelope_color(fx, fy, ft, alpha=1.0, ft_0=1.)
mc.figures(z, name)
mc.in_show_video(name)
In [4]:
# explore parameters
for alpha in [0.001, 0.5, 1.0, 1.5, 2.0]:
    # resp. white(0), pink(1), red(2) or brownian noise (see http://en.wikipedia.org/wiki/1/f_noise
    name_ = name + '-alpha-' + str(alpha).replace('.', '_')
    z = mc.envelope_color(fx, fy, ft, alpha)
    mc.figures(z, name_)
    mc.in_show_video(name_)
In [5]:
for ft_0 in [0.125, 0.25, 0.5, 1., 2., 4., np.inf]:# time space scaling
    name_ = name + '-ft_0-' + str(ft_0).replace('.', '_')
    z = mc.envelope_color(fx, fy, ft, alpha=1., ft_0=ft_0)
    mc.figures(z, name_)
    mc.in_show_video(name_)
In [6]:
for size in range(5, 7):
    N_X, N_Y, N_frame = 2**size, 2**size, 2**size
    fx, fy, ft = mc.get_grids(N_X, N_Y, N_frame)
    ft_0 = N_X/float(N_frame)
    name_ = name + '-size-' + str(size).replace('.', '_')
    z = mc.envelope_color(fx, fy, ft, alpha=1., ft_0=ft_0)
    mc.figures(z, name_)
    mc.in_show_video(name_)