From: Jon Speicher Date: Thu, 25 Jul 2013 17:34:50 +0000 (-0400) Subject: Remove some notebooks that appear to be individual classroom work output X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b8f190e099319cf01c632faa618d433b082304e0;p=swc-testing-nose.git Remove some notebooks that appear to be individual classroom work output --- diff --git a/python/sw_engineering/mean_animals.ipynb b/python/sw_engineering/mean_animals.ipynb deleted file mode 100644 index 762c9d3..0000000 --- a/python/sw_engineering/mean_animals.ipynb +++ /dev/null @@ -1,162 +0,0 @@ -{ - "metadata": { - "name": "mean_animals" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "code", - "collapsed": false, - "input": [ - "%%file meananimals.py\n", - "def read_file(ifile):\n", - " open_file = open(ifile, 'r')\n", - " \n", - " time = []\n", - " date = []\n", - " animal = []\n", - " count = []\n", - " \n", - " for iline in open_file:\n", - " s = iline.split()\n", - " date.append(s[0])\n", - " time.append(s[1])\n", - " animal.append(s[2])\n", - " count.append(int(s[3]))\n", - " \n", - " open_file.close()\n", - " \n", - " return date, time, animal, count\n", - "\n", - "def calc_mean(ilist):\n", - " '''\n", - " returns the mean of input list\n", - " '''\n", - " if len(ilist) == 0:\n", - " raise ValueError('Input is empty.')\n", - " \n", - " total = 0.0\n", - " for num in ilist:\n", - " total = total + num\n", - " return total/float(len(ilist))\n", - "\n", - "def filter_animals(species, date, time, animal, count):\n", - " \"\"\"\n", - " Given a particular species, filter out the data for just that species.\n", - "\n", - " Returns four lists: date, time, animal, count.\n", - " \"\"\"\n", - " fdate = []\n", - " ftime = []\n", - " fanimal = []\n", - " fcount = []\n", - " \n", - " for d, t, a, c in zip(date, time, animal, count):\n", - " if a == species:\n", - " fdate.append(d)\n", - " ftime.append(t)\n", - " fanimal.append(a)\n", - " fcount.append(c)\n", - " \n", - " return fdate, ftime, fanimal, fcount\n", - "\n", - "def mean_animals(filename, species):\n", - " d, t, a, c = read_file(filename)\n", - " d, t, a, c = filter_animals(species, d, t, a, c)\n", - " return calc_mean(c)" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Writing meananimals.py\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "%%file test_meananimals.py\n", - "import nose.tools as nt\n", - "from meananimals import read_file, calc_mean, filter_animals, mean_animals\n", - "\n", - "def test_read_animals():\n", - " date, time, animal, count = read_file('animals.txt')\n", - " ref_date = ['2011-04-22', '2011-04-23', '2011-04-23', '2011-04-23', '2011-04-23']\n", - " ref_time = ['21:06', '14:12', '10:24', '20:08', '18:46']\n", - " ref_animal = ['Grizzly', 'Elk', 'Elk', 'Wolverine', 'Muskox']\n", - " ref_count = [36, 25, 26, 31, 20]\n", - " \n", - " assert date == ref_date, 'Dates do not match!'\n", - " assert time == ref_time, 'Times do not match!'\n", - " assert animal == ref_animal, 'Animals do not match!'\n", - " assert count == ref_count, 'Counts do not match!'\n", - "\n", - "def test_mean1():\n", - " m = calc_mean([1, 2, 3])\n", - " assert m == 2\n", - " \n", - "def test_mean2():\n", - " m = calc_mean([1])\n", - " assert m == 1\n", - "\n", - "def test_mean3():\n", - " m = calc_mean([3.4, 3.5, 3.6])\n", - " assert m == 3.5\n", - "\n", - "@nt.raises(ValueError)\n", - "def test_mean4():\n", - " m = calc_mean([])\n", - "\n", - "def test_filter_animals1():\n", - " date, time, animal, count = read_file('animals.txt')\n", - " fdate, ftime, fanimal, fcount = filter_animals('Elk', date, time, animal, count)\n", - " \n", - " assert fdate == ['2011-04-23', '2011-04-23']\n", - " assert ftime == ['14:12', '10:24']\n", - " assert fanimal == ['Elk', 'Elk']\n", - " assert fcount == [25, 26]\n", - "\n", - "def test_mean_animals1():\n", - " m = mean_animals('animals.txt', 'Elk')\n", - " assert m == 25.5\n", - "\n", - "def test_mean_animals2():\n", - " m = mean_animals('animals.txt', 'Grizzly')\n", - " assert m == 36" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - "Overwriting test_meananimals.py\n" - ] - } - ], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/python/sw_engineering/research.ipynb b/python/sw_engineering/research.ipynb deleted file mode 100644 index fd98307..0000000 --- a/python/sw_engineering/research.ipynb +++ /dev/null @@ -1,90 +0,0 @@ -{ - "metadata": { - "name": "research" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "code", - "collapsed": false, - "input": [ - "import meananimals" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 1 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "meananimals.mean_animals('animals.txt', 'Elk')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "pyout", - "prompt_number": 2, - "text": [ - "25.5" - ] - } - ], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "meananimals.mean_animals('big_animals.txt', 'Elk')" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "pyout", - "prompt_number": 3, - "text": [ - "24.22222222222222" - ] - } - ], - "prompt_number": 3 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "!wc -l big_animals.txt" - ], - "language": "python", - "metadata": {}, - "outputs": [ - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " 100 big_animals.txt\r\n" - ] - } - ], - "prompt_number": 4 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file diff --git a/python/sw_engineering/student_notebook.ipynb b/python/sw_engineering/student_notebook.ipynb deleted file mode 100644 index e99de67..0000000 --- a/python/sw_engineering/student_notebook.ipynb +++ /dev/null @@ -1,22 +0,0 @@ -{ - "metadata": { - "name": "student_notebook" - }, - "nbformat": 3, - "nbformat_minor": 0, - "worksheets": [ - { - "cells": [ - { - "cell_type": "code", - "collapsed": false, - "input": [], - "language": "python", - "metadata": {}, - "outputs": [] - } - ], - "metadata": {} - } - ] -} \ No newline at end of file