{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Lab 1 6,000xp\n", "\n", "\n", "## Part 1 - Fun with Crickets\n", "\n", "\n", "\n", "A long, long time ago, in the summer of 1898, Ernst Athearn Bessey and his brother Carl decided to observe tree crickets in Lincoln, Nebraska. (Ernst was 21 at the time and just finished his MA degree) They were interested in the relationship between the speed of cricket chirps and outdoor temperature. The thing that made this a bit easier was that they found \"that each cricket remained in the same tree for days at a time.\"\n", "\n", "\n", "\n", "\n", "\n", "\n", "We are going to examine the data they collected.\n", "\n", "First let's import the numpy library\n", "\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now we will read the data file from the web and place it in an np.array" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": true }, "outputs": [], "source": [ "## read in the cricket file\n", "cricket_data = np.genfromtxt('http://zacharski.org/files/crickets.csv', delimiter=',')" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[ 20. 88.59999847]\n", " [ 16. 71.59999847]\n", " [ 19.79999924 93.30000305]\n", " [ 18.39999962 84.30000305]\n", " [ 17.10000038 80.59999847]\n", " [ 15.5 75.19999695]\n", " [ 14.69999981 69.69999695]\n", " [ 17.10000038 82. ]\n", " [ 15.39999962 69.40000153]\n", " [ 16.20000076 83.30000305]\n", " [ 15. 79.59999847]\n", " [ 17.20000076 82.59999847]\n", " [ 16. 80.59999847]\n", " [ 17. 83.50000125]\n", " [ 14.39999962 76.30000305]\n", " [ 17.1 81.50055115]\n", " [ 13.1 68.36003334]\n", " [ 13.65 70. ]\n", " [ 14.2 72.00011123]\n", " [ 18.67 86.67711113]\n", " [ 19.1226667 88.21000242]\n", " [ 19.01 84.05999912]\n", " [ 17.61 83.18999999]\n", " [ 16.125 77.30100011]\n", " [ 13. 67.26666667]\n", " [ 12. 62.72740003]\n", " [ 12.49 66.33333333]\n", " [ 14.111 77.81221677]\n", " [ 17.6 85. ]]\n" ] } ], "source": [ "print(cricket_data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That first column is the number of chirps and the second column is the temperature.\n", "\n", "\n", "

\n", "What are the mean and median for both the cricket chirps and the temperature? I would like your report to look like\n", "\n", " Cricket chirps\n", " mean: 16.1237471341\n", " median: 16.125\n", "\n", " Temperature\n", " mean: 78.3116698272\n", " median: 80.59999847" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

\n", "\n", "Using corrcoef I want to know whether there is a correlation between the number of chirps and the temperature. Can you compute the correlation?" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# your code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

Cricket Hacker Challenge Part 1: 1000xp

\n", "\n", "A year before the Bessey brothers counted cricket chirps, Amos Dolbear (shown below)did the same. Dolbear was a physics professor at Tufts University and invented the telephone some 11 years before Bell.\n", "\n", "\n", "\n", "\n", "When Dolbear was 60 he came up with what is now known as Dolbear's Law can predict temeperature in Fahrenheight from cricket chirps per minute ($N_{60}$):\n", " \n", "\n", "### $$T_F = 50 + \\frac{N_{60} - 40}{4}$$\n", "\n", "Can you create a one-column numpy array with the predicted values of Fahrenheit based on the Cricket Chirp column of cricket_data? As a hint, if you have a numpy array:" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": true }, "outputs": [], "source": [ "old = np.array([10, 20, 30, 40, 50])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "and if my formula were \n", "\n", "$$new = old + 100$$\n", "\n", "I can create the new array using:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": true }, "outputs": [], "source": [ "new = old + 100" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([110, 120, 130, 140, 150])" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new\n" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# Your predicted code here:\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "