{ "metadata": { "name": "", "signature": "sha256:699a86e1dda957bd8dbe32281ae196afaa5030eef0476ad3e997f4e531f7f96b" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "CT-3: Plotting in Python." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Step 1: Complete this tutorial on plotting in Python.\n", "\n", "Step 2: Manipulate an astronomical dataset with Python.\n", "\n", "Part A. Download this data table [GlobularClusters_clean.tab] to your class folder. This table is a cleaned up version of the data table at http://spider.seds.org/spider/MWGC/mwgc.html.\n", "\n", "If you right-click on the *.tab link and choose \u2018Download Linked File As\u2019, you can save it directly to the work folder you created. Or, you can download it to your Desktop or Downloads folder and use your knowledge of Unix to move it into your work folder.\n", "\n", "Open GlobularClusters_clean.tab in your text editor. For a reminder on how to do this, reread CT-1a.\n", "\n", "The table contains the RA and DEC locations, distance from our sun and from the galactic center in kilolightyears (kly), apparent magnitude in the V-band, and angular size of the Globular Clusters in our Milky Way galaxy." ] }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Import python libraries" ] }, { "cell_type": "code", "collapsed": false, "input": [ "#Set up astropy \n", "from astropy.table import Table,Column\n", "from astropy.coordinates import SkyCoord, Distance\n", "from astropy import units as u\n", "from astropy.io import ascii\n", "#Set up plotting libraries\n", "%config InlineBackend.rc = {}\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline\n", "import seaborn" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 12 }, { "cell_type": "heading", "level": 3, "metadata": {}, "source": [ "Read datafile" ] }, { "cell_type": "code", "collapsed": false, "input": [ "Globulars = ascii.read('data/GlobularClusters_clean.tab')\n", "Globulars" ], "language": "python", "metadata": {}, "outputs": [ { "html": [ "
| name | RA | DEC | distSun(kly) | distGalCenter(kly) | m_v | angular_diameter |
|---|---|---|---|---|---|---|
| Tuc | 6.02362 | -72.0813 | 14.7 | 24.1 | 3.95 | 50.0 |
| Scl | 13.1885 | -26.5826 | 29.0 | 39.1 | 8.09 | 13.0 |
| Tuc | 15.8094 | -70.8488 | 28.0 | 30.6 | 6.4 | 14.0 |
| Cet | 30.7375 | -3.25278 | 98.1 | 112.5 | 15.03 | 1.2 |
| Hor | 48.0675 | -55.2162 | 53.1 | 59.0 | 8.29 | 6.8 |
| Cep | 53.3335 | 79.5811 | 36.2 | 56.1 | 13.18 | 2.8 |
| Hor | 58.7596 | -49.6153 | 2.0 | 406.2 | 15.72 | 0.5 |
| Eri | 66.1854 | -21.1869 | 93.7 | 309.7 | 14.7 | 1.0 |
| Aur | 71.5246 | 31.3815 | 88.7 | 114.1 | 13.04 | 2.2 |
| Col | 78.5282 | -40.0466 | 39.4 | 54.1 | 7.14 | 12.0 |
| Lep | 81.0462 | -24.5247 | 42.1 | 61.3 | 7.73 | 9.6 |
| ... | ... | ... | ... | ... | ... | ... |
| Sge | 298.444 | 18.7792 | 13.0 | 21.8 | 8.19 | 7.2 |
| Sgr | 301.52 | -21.9212 | 68.1 | 47.9 | 8.52 | 6.8 |
| Del | 308.547 | 7.40447 | 50.9 | 41.7 | 8.83 | 7.1 |
| Aqr | 313.365 | -12.5373 | 55.4 | 42.1 | 9.27 | 6.6 |
| Del | 315.372 | 16.1873 | 34.3 | 125.5 | 10.56 | 3.6 |
| Peg | 322.493 | 12.167 | 33.9 | 33.9 | 6.2 | 18.0 |
| Aqr | 323.363 | -0.82325 | 37.5 | 33.9 | 6.47 | 16.0 |
| Cap | 325.092 | -23.1799 | 26.4 | 23.1 | 7.19 | 12.0 |
| Cap | 326.662 | -21.2526 | 61.9 | 51.5 | 11.99 | 2.9 |
| Peg | 346.685 | 12.772 | 84.8 | 87.7 | 13.47 | 0.7 |
| Aqr | 347.111 | -15.6115 | 85.7 | 82.5 | 11.29 | 4.2 |