From 9233b506b6c195b6c72c810e23e7fe3c4c9f2414 Mon Sep 17 00:00:00 2001 From: j9ac9k Date: Fri, 15 May 2015 14:48:21 -0700 Subject: [PATCH 1/2] Fixed Vispy Error on 64bit systems (6.6) Added .astype(np.float32) at the end of the array generation. --- notebooks/chapter06_viz/06_vispy.ipynb | 32 ++++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/notebooks/chapter06_viz/06_vispy.ipynb b/notebooks/chapter06_viz/06_vispy.ipynb index 6a986c9..1322fa7 100644 --- a/notebooks/chapter06_viz/06_vispy.ipynb +++ b/notebooks/chapter06_viz/06_vispy.ipynb @@ -44,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "collapsed": false }, @@ -64,7 +64,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": { "collapsed": false }, @@ -82,7 +82,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -129,7 +129,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { "collapsed": false }, @@ -147,15 +147,27 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "metadata": { "collapsed": false }, - "outputs": [], + "outputs": [ + { + "ename": "NameError", + "evalue": "name 'float32' is not defined", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m program['a_position'] = np.c_[\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlinspace\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m+\u001b[0m\u001b[1;36m1.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m np.random.uniform(-0.5, +0.5, 1000, dtype=float32)]\n", + "\u001b[1;31mNameError\u001b[0m: name 'float32' is not defined" + ] + } + ], "source": [ "program['a_position'] = np.c_[\n", - " np.linspace(-1.0, +1.0, 1000),\n", - " np.random.uniform(-0.5, +0.5, 1000)]" + " np.linspace(-1.0, +1.0, 1000, dtype=float32),\n", + " np.random.uniform(-0.5, +0.5, 1000, dtype=float32)]" ] }, { @@ -244,7 +256,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.4.2" + "version": "3.4.1" } }, "nbformat": 4, From 87dab4ef22babc213dff75828200f7073a5d0b08 Mon Sep 17 00:00:00 2001 From: j9ac9k Date: Fri, 15 May 2015 14:50:54 -0700 Subject: [PATCH 2/2] Whops, committed too early Commit 9233b506b6c195b6c72c810e23e7fe3c4c9f2414 was made incorrectly, now corrected --- notebooks/chapter06_viz/06_vispy.ipynb | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/notebooks/chapter06_viz/06_vispy.ipynb b/notebooks/chapter06_viz/06_vispy.ipynb index 1322fa7..ad4529d 100644 --- a/notebooks/chapter06_viz/06_vispy.ipynb +++ b/notebooks/chapter06_viz/06_vispy.ipynb @@ -147,27 +147,15 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": { "collapsed": false }, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'float32' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m program['a_position'] = np.c_[\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlinspace\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m+\u001b[0m\u001b[1;36m1.0\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;36m1000\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mdtype\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mfloat32\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m np.random.uniform(-0.5, +0.5, 1000, dtype=float32)]\n", - "\u001b[1;31mNameError\u001b[0m: name 'float32' is not defined" - ] - } - ], + "outputs": [], "source": [ "program['a_position'] = np.c_[\n", - " np.linspace(-1.0, +1.0, 1000, dtype=float32),\n", - " np.random.uniform(-0.5, +0.5, 1000, dtype=float32)]" + " np.linspace(-1.0, +1.0, 1000).astype(np.float32),\n", + " np.random.uniform(-0.5, +0.5, 1000).astype(np.float32)]" ] }, { @@ -179,7 +167,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "metadata": { "collapsed": false }, @@ -199,7 +187,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -220,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "metadata": { "collapsed": false },