{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Testing the Color" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import numpy as np\n", "np.set_printoptions(precision=3, suppress=True)\n", "import pylab\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " Returns the color envelope.\n", "\n", " In some circonstances, it is desirable to create a texture with a different \"color\"\n", " than that of natural images (that is where the envelope is in 1/f).\n", "\n", " Run 'test_color' notebook to see the effect of alpha\n", " alpha = 0 white\n", " alpha = 1 pink\n", " alpha = 2 red/brownian\n", " (see http://en.wikipedia.org/wiki/1/f_noise )\n", " \n" ] } ], "source": [ "import MotionClouds as mc\n", "fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)\n", "print(mc.envelope_color.__doc__)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import os\n", "name = 'color'\n", "fx, fy, ft = mc.get_grids(mc.N_X, mc.N_Y, mc.N_frame)\n", "z = mc.envelope_color(fx, fy, ft, alpha=1.0, ft_0=1.)\n", "mc.figures(z, name)\n", "mc.in_show_video(name)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# explore parameters\n", "for alpha in [0.001, 0.5, 1.0, 1.5, 2.0]:\n", " # resp. white(0), pink(1), red(2) or brownian noise (see http://en.wikipedia.org/wiki/1/f_noise\n", " name_ = name + '-alpha-' + str(alpha).replace('.', '_')\n", " z = mc.envelope_color(fx, fy, ft, alpha)\n", " mc.figures(z, name_)\n", " mc.in_show_video(name_)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for ft_0 in [0.125, 0.25, 0.5, 1., 2., 4., np.inf]:# time space scaling\n", " name_ = name + '-ft_0-' + str(ft_0).replace('.', '_')\n", " z = mc.envelope_color(fx, fy, ft, alpha=1., ft_0=ft_0)\n", " mc.figures(z, name_)\n", " mc.in_show_video(name_)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", "
\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for size in range(5, 7):\n", " N_X, N_Y, N_frame = 2**size, 2**size, 2**size\n", " fx, fy, ft = mc.get_grids(N_X, N_Y, N_frame)\n", " ft_0 = N_X/float(N_frame)\n", " name_ = name + '-size-' + str(size).replace('.', '_')\n", " z = mc.envelope_color(fx, fy, ft, alpha=1., ft_0=ft_0)\n", " mc.figures(z, name_)\n", " mc.in_show_video(name_)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.0" } }, "nbformat": 4, "nbformat_minor": 0 }