{ "metadata": {}, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "# from http://pythonprogramming.net/3d-bar-charts-python-matplotlib/\n", "from mpl_toolkits.mplot3d import Axes3D\n", "import matplotlib.pyplot as plt\n", "import matplotlib.patches as mpatches\n", "from matplotlib import animation\n", "import numpy as np\n", "import pylab as pylab\n", "import math as math\n", "from decimal import *\n", "from savedWeights import *\n", " \n", "fig = plt.figure()\n", "ax1 = fig.add_subplot(111, projection='3d')\n", "colorNumber = -1\n", "ypos = []\n", "yposNeuronOrder = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]\n", "weights = retreiveTestW()\n", "colors = []\n", "neurons = [None]*len(weights)\n", "numberOfWeights = len(weights)\n", "numberOfPixels = 15\n", "xpos = np.ones(numberOfPixels*numberOfWeights)\n", "num_elements = len(xpos)\n", "zpos = np.zeros(numberOfPixels*numberOfWeights)\n", "dx = np.ones(numberOfPixels*numberOfWeights)*.9\n", "dy = np.ones(numberOfPixels*numberOfWeights)*.5\n", "timeDelay = 24#3\n", "\n", "for weightIndex in range(numberOfWeights):\n", "\tcolorNumber += 1\n", "\tif colorNumber == 4: colorNumber = 0\n", "\tif colorNumber == 0: colors = np.append(colors, ['r']*15); neurons[weightIndex] = plt.Rectangle((0, 0), 0.1, 0.1,fc='r');\n", "\tif colorNumber == 1: colors = np.append(colors, ['g']*15); neurons[weightIndex] = plt.Rectangle((0, 0), 0.1, 0.1,fc='g');\n", "\tif colorNumber == 2: colors = np.append(colors, ['b']*15); neurons[weightIndex] = plt.Rectangle((0, 0), 0.1, 0.1,fc='b');\n", "\tif colorNumber == 3: colors = np.append(colors, ['y']*15); neurons[weightIndex] = plt.Rectangle((0, 0), 0.1, 0.1,fc='y');\n", "\typos = np.append(ypos, yposNeuronOrder)\n", "\txpos[(15*weightIndex):(15*(weightIndex+1))] *= (weightIndex+1)\n", "\n", "colors = colors.tolist();ypos = ypos.tolist();xpos = xpos.tolist();" ], "language": "python", "metadata": {}, "outputs": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "