Files
AstronomicalData/02_coords.html
2020-12-07 15:03:03 -05:00

1858 lines
64 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Coordinates and units &#8212; Astronomical Data in Python</title>
<link rel="stylesheet" href="_static/css/index.d431a4ee1c1efae0e38bdfebc22debff.css">
<link rel="stylesheet"
href="_static/vendor/fontawesome/5.13.0/css/all.min.css">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
<link rel="preload" as="font" type="font/woff2" crossorigin
href="_static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">
<link rel="stylesheet"
href="_static/vendor/open-sans_all/1.44.1/index.css">
<link rel="stylesheet"
href="_static/vendor/lato_latin-ext/1.44.1/index.css">
<link rel="stylesheet" href="_static/sphinx-book-theme.bfb7730f9caf2ec0b46a44615585038c.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="_static/togglebutton.css" />
<link rel="stylesheet" type="text/css" href="_static/copybutton.css" />
<link rel="stylesheet" type="text/css" href="_static/mystnb.css" />
<link rel="stylesheet" type="text/css" href="_static/sphinx-thebe.css" />
<link rel="stylesheet" type="text/css" href="_static/panels-main.c949a650a448cc0ae9fd3441c0e17fb0.css" />
<link rel="stylesheet" type="text/css" href="_static/panels-variables.06eb56fa6e07937060861dad626602ad.css" />
<link rel="preload" as="script" href="_static/js/index.30270b6e4c972e43c488.js">
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<script src="_static/togglebutton.js"></script>
<script src="_static/clipboard.min.js"></script>
<script src="_static/copybutton.js"></script>
<script >var togglebuttonSelector = '.toggle, .admonition.dropdown, .tag_hide_input div.cell_input, .tag_hide-input div.cell_input, .tag_hide_output div.cell_output, .tag_hide-output div.cell_output, .tag_hide_cell.cell, .tag_hide-cell.cell';</script>
<script src="_static/sphinx-book-theme.be0a4a0c39cd630af62a2fcf693f3f06.js"></script>
<script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["\\(", "\\)"]], "displayMath": [["\\[", "\\]"]], "processRefs": false, "processEnvironments": false}})</script>
<script async="async" src="https://unpkg.com/thebelab@latest/lib/index.js"></script>
<script >
const thebe_selector = ".thebe"
const thebe_selector_input = "pre"
const thebe_selector_output = ".output"
</script>
<script async="async" src="_static/sphinx-thebe.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Chapter 3" href="03_motion.html" />
<link rel="prev" title="Queries" href="01_query.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="en" />
</head>
<body data-spy="scroll" data-target="#bd-toc-nav" data-offset="80">
<div class="container-xl">
<div class="row">
<div class="col-12 col-md-3 bd-sidebar site-navigation show" id="site-navigation">
<div class="navbar-brand-box">
<a class="navbar-brand text-wrap" href="index.html">
<h1 class="site-logo" id="site-title">Astronomical Data in Python</h1>
</a>
</div>
<form class="bd-search d-flex align-items-center" action="search.html" method="get">
<i class="icon fas fa-search"></i>
<input type="search" class="form-control" name="q" id="search-input" placeholder="Search this book..." aria-label="Search this book..." autocomplete="off" >
</form>
<nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation">
<ul class="nav sidenav_l1">
<li class="toctree-l1">
<a class="reference internal" href="README.html">
Astronomical Data in Python
</a>
</li>
</ul>
<ul class="current nav sidenav_l1">
<li class="toctree-l1">
<a class="reference internal" href="01_query.html">
Queries
</a>
</li>
<li class="toctree-l1 current active">
<a class="current reference internal" href="#">
Coordinates and units
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="03_motion.html">
Chapter 3
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="04_select.html">
Chapter 4
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="05_join.html">
Chapter 5
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="06_photo.html">
Chapter 6
</a>
</li>
<li class="toctree-l1">
<a class="reference internal" href="07_plot.html">
Chapter 7
</a>
</li>
</ul>
</nav>
<!-- To handle the deprecated key -->
<div class="navbar_extra_footer">
Powered by <a href="https://jupyterbook.org">Jupyter Book</a>
</div>
</div>
<main class="col py-md-3 pl-md-4 bd-content overflow-auto" role="main">
<div class="row topbar fixed-top container-xl">
<div class="col-12 col-md-3 bd-topbar-whitespace site-navigation show">
</div>
<div class="col pl-2 topbar-main">
<button id="navbar-toggler" class="navbar-toggler ml-0" type="button" data-toggle="collapse"
data-toggle="tooltip" data-placement="bottom" data-target=".site-navigation" aria-controls="navbar-menu"
aria-expanded="true" aria-label="Toggle navigation" aria-controls="site-navigation"
title="Toggle navigation" data-toggle="tooltip" data-placement="left">
<i class="fas fa-bars"></i>
<i class="fas fa-arrow-left"></i>
<i class="fas fa-arrow-up"></i>
</button>
<div class="dropdown-buttons-trigger">
<button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn" aria-label="Download this page"><i
class="fas fa-download"></i></button>
<div class="dropdown-buttons">
<!-- ipynb file if we had a myst markdown file -->
<!-- Download raw file -->
<a class="dropdown-buttons" href="_sources/02_coords.ipynb"><button type="button"
class="btn btn-secondary topbarbtn" title="Download source file" data-toggle="tooltip"
data-placement="left">.ipynb</button></a>
<!-- Download PDF via print -->
<button type="button" id="download-print" class="btn btn-secondary topbarbtn" title="Print to PDF"
onClick="window.print()" data-toggle="tooltip" data-placement="left">.pdf</button>
</div>
</div>
<!-- Source interaction buttons -->
<div class="dropdown-buttons-trigger">
<button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
aria-label="Connect with source repository"><i class="fab fa-github"></i></button>
<div class="dropdown-buttons sourcebuttons">
<a class="repository-button"
href="https://github.com/AllenDowney/AstronomicalData"><button type="button" class="btn btn-secondary topbarbtn"
data-toggle="tooltip" data-placement="left" title="Source repository"><i
class="fab fa-github"></i>repository</button></a>
</div>
</div>
<!-- Full screen (wrap in <a> to have style consistency -->
<a class="full-screen-button"><button type="button" class="btn btn-secondary topbarbtn" data-toggle="tooltip"
data-placement="bottom" onclick="toggleFullScreen()" title="Fullscreen mode"><i
class="fas fa-expand"></i></button></a>
<!-- Launch buttons -->
<div class="dropdown-buttons-trigger">
<button id="dropdown-buttons-trigger" class="btn btn-secondary topbarbtn"
aria-label="Launch interactive content"><i class="fas fa-rocket"></i></button>
<div class="dropdown-buttons">
<a class="binder-button" href="https://mybinder.org/v2/gh/AllenDowney/AstronomicalData/master?urlpath=tree/02_coords.ipynb"><button type="button"
class="btn btn-secondary topbarbtn" title="Launch Binder" data-toggle="tooltip"
data-placement="left"><img class="binder-button-logo"
src="_static/images/logo_binder.svg"
alt="Interact on binder">Binder</button></a>
<a class="colab-button" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/master/02_coords.ipynb"><button type="button" class="btn btn-secondary topbarbtn"
title="Launch Colab" data-toggle="tooltip" data-placement="left"><img class="colab-button-logo"
src="_static/images/logo_colab.png"
alt="Interact on Colab">Colab</button></a>
</div>
</div>
</div>
<!-- Table of contents -->
<div class="d-none d-md-block col-md-2 bd-toc show">
<div class="tocsection onthispage pt-5 pb-3">
<i class="fas fa-list"></i> Contents
</div>
<nav id="bd-toc-nav">
<ul class="nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#outline">
Outline
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#selecting-a-region">
Selecting a region
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#exercise">
Exercise
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#getting-gd-1-data">
Getting GD-1 Data
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#working-with-coordinates">
Working with coordinates
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#selecting-a-rectangle">
Selecting a rectangle
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#selecting-a-polygon">
Selecting a polygon
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#saving-results">
Saving results
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#summary">
Summary
</a>
</li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#best-practices">
Best practices
</a>
</li>
</ul>
</nav>
</div>
</div>
<div id="main-content" class="row">
<div class="col-12 col-md-9 pl-md-3 pr-md-0">
<div>
<div class="section" id="coordinates-and-units">
<h1>Coordinates and units<a class="headerlink" href="#coordinates-and-units" title="Permalink to this headline"></a></h1>
<p>This is the second in a series of notebooks related to astronomy data.</p>
<p>As a running example, we are replicating parts of the analysis in a recent paper, “<a class="reference external" href="https://arxiv.org/abs/1805.00425">Off the beaten path: Gaia reveals GD-1 stars outside of the main stream</a>” by Adrian M. Price-Whelan and Ana Bonaca.</p>
<p>In the first notebook, we wrote ADQL queries and used them to select and download data from the Gaia server.</p>
<p>In this notebook, well pick up where we left off and write a query to select stars from the region of the sky where we expect GD-1 to be.</p>
<div class="section" id="outline">
<h2>Outline<a class="headerlink" href="#outline" title="Permalink to this headline"></a></h2>
<p>Well start with an example that does a “cone search”; that is, it selects stars that appear in a circular region of the sky.</p>
<p>Then, to select stars in the vicinity of GD-1, well:</p>
<ul class="simple">
<li><p>Use <code class="docutils literal notranslate"><span class="pre">Quantity</span></code> objects to represent measurements with units.</p></li>
<li><p>Use the <code class="docutils literal notranslate"><span class="pre">Gala</span></code> library to convert coordinates from one frame to another.</p></li>
<li><p>Use the ADQL keywords <code class="docutils literal notranslate"><span class="pre">POLYGON</span></code>, <code class="docutils literal notranslate"><span class="pre">CONTAINS</span></code>, and <code class="docutils literal notranslate"><span class="pre">POINT</span></code> to select stars that fall within a polygonal region.</p></li>
<li><p>Submit a query and download the results.</p></li>
<li><p>Store the results in a FITS file.</p></li>
</ul>
<p>After completing this lesson, you should be able to</p>
<ul class="simple">
<li><p>Use Python string formatting to compose more complex ADQL queries.</p></li>
<li><p>Work with coordinates and other quantities that have units.</p></li>
<li><p>Download the results of a query and store them in a file.</p></li>
</ul>
</div>
<div class="section" id="selecting-a-region">
<h2>Selecting a region<a class="headerlink" href="#selecting-a-region" title="Permalink to this headline"></a></h2>
<p>One of the most common ways to restrict a query is to select stars in a particular region of the sky.</p>
<p>For example, heres a query from the <a class="reference external" href="https://gea.esac.esa.int/archive-help/adql/examples/index.html">Gaia archive documentation</a> that selects “all the objects … in a circular region centered at (266.41683, -29.00781) with a search radius of 5 arcmin (0.08333 deg).”</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">query</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="s2">SELECT </span>
<span class="s2">TOP 10 source_id</span>
<span class="s2">FROM gaiadr2.gaia_source</span>
<span class="s2">WHERE 1=CONTAINS(</span>
<span class="s2"> POINT(ra, dec),</span>
<span class="s2"> CIRCLE(266.41683, -29.00781, 0.08333333))</span>
<span class="s2">&quot;&quot;&quot;</span>
</pre></div>
</div>
</div>
</div>
<p>This query uses three keywords that are specific to ADQL (not SQL):</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">POINT</span></code>: a location in <a class="reference external" href="https://en.wikipedia.org/wiki/International_Celestial_Reference_System">ICRS coordinates</a>, specified in degrees of right ascension and declination.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CIRCLE</span></code>: a circle where the first two values are the coordinates of the center and the third is the radius in degrees.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONTAINS</span></code>: a function that returns <code class="docutils literal notranslate"><span class="pre">1</span></code> if a <code class="docutils literal notranslate"><span class="pre">POINT</span></code> is contained in a shape and <code class="docutils literal notranslate"><span class="pre">0</span></code> otherwise.</p></li>
</ul>
<p>Here is the <a class="reference external" href="http://www.ivoa.net/documents/ADQL/20180112/PR-ADQL-2.1-20180112.html#tth_sEc4.2.12">documentation of <code class="docutils literal notranslate"><span class="pre">CONTAINS</span></code></a>.</p>
<p>A query like this is called a cone search because it selects stars in a cone.</p>
<p>Heres how we run it.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">astroquery.gaia</span> <span class="kn">import</span> <span class="n">Gaia</span>
<span class="n">job</span> <span class="o">=</span> <span class="n">Gaia</span><span class="o">.</span><span class="n">launch_job</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">job</span><span class="o">.</span><span class="n">get_results</span><span class="p">()</span>
<span class="n">result</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Created TAP+ (v1.2.1) - Connection:
Host: gea.esac.esa.int
Use HTTPS: True
Port: 443
SSL Port: 443
Created TAP+ (v1.2.1) - Connection:
Host: geadata.esac.esa.int
Use HTTPS: True
Port: 443
SSL Port: 443
</pre></div>
</div>
<div class="output text_html"><i>Table length=10</i>
<table id="table140686245658336" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th></tr></thead>
<thead><tr><th>int64</th></tr></thead>
<tr><td>4057468321929794432</td></tr>
<tr><td>4057468287575835392</td></tr>
<tr><td>4057482027171038976</td></tr>
<tr><td>4057470349160630656</td></tr>
<tr><td>4057470039924301696</td></tr>
<tr><td>4057469868125641984</td></tr>
<tr><td>4057468351995073024</td></tr>
<tr><td>4057469661959554560</td></tr>
<tr><td>4057470520960672640</td></tr>
<tr><td>4057470555320409600</td></tr>
</table></div></div>
</div>
</div>
<div class="section" id="exercise">
<h2>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline"></a></h2>
<p>When you are debugging queries like this, you can use <code class="docutils literal notranslate"><span class="pre">TOP</span></code> to limit the size of the results, but then you still dont know how big the results will be.</p>
<p>An alternative is to use <code class="docutils literal notranslate"><span class="pre">COUNT</span></code>, which asks for the number of rows that would be selected, but it does not return them.</p>
<p>In the previous query, replace <code class="docutils literal notranslate"><span class="pre">TOP</span> <span class="pre">10</span> <span class="pre">source_id</span></code> with <code class="docutils literal notranslate"><span class="pre">COUNT(source_id)</span></code> and run the query again. How many stars has Gaia identified in the cone we searched?</p>
</div>
<div class="section" id="getting-gd-1-data">
<h2>Getting GD-1 Data<a class="headerlink" href="#getting-gd-1-data" title="Permalink to this headline"></a></h2>
<p>From the Price-Whelan and Bonaca paper, we will try to reproduce Figure 1, which includes this representation of stars likely to belong to GD-1:</p>
<img alt="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-4.png" src="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-4.png" />
<p>Along the axis of right ascension (<span class="math notranslate nohighlight">\(\phi_1\)</span>) the figure extends from -100 to 20 degrees.</p>
<p>Along the axis of declination (<span class="math notranslate nohighlight">\(\phi_2\)</span>) the figure extends from about -8 to 4 degrees.</p>
<p>Ideally, we would select all stars from this rectangle, but there are more than 10 million of them, so</p>
<ul class="simple">
<li><p>That would be difficult to work with,</p></li>
<li><p>As anonymous users, we are limited to 3 million rows in a single query, and</p></li>
<li><p>While we are developing and testing code, it will be faster to work with a smaller dataset.</p></li>
</ul>
<p>So well start by selecting stars in a smaller rectangle, from -55 to -45 degrees right ascension and -8 to 4 degrees of declination.</p>
<p>But first we lets see how to represent quantities with units like degrees.</p>
</div>
<div class="section" id="working-with-coordinates">
<h2>Working with coordinates<a class="headerlink" href="#working-with-coordinates" title="Permalink to this headline"></a></h2>
<p>Coordinates are physical quantities, which means that they have two parts, a value and a unit.</p>
<p>For example, the coordinate <span class="math notranslate nohighlight">\(30^{\circ}\)</span> has value 30 and its units are degrees.</p>
<p>Until recently, most scientific computation was done with values only; units were left out of the program altogether, <a class="reference external" href="https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_failure">often with disastrous results</a>.</p>
<p>Astropy provides tools for including units explicitly in computations, which makes it possible to detect errors before they cause disasters.</p>
<p>To use Astropy units, we import them like this:</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">astropy.units</span> <span class="k">as</span> <span class="nn">u</span>
<span class="n">u</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;module &#39;astropy.units&#39; from &#39;/home/downey/anaconda3/envs/AstronomicalData/lib/python3.8/site-packages/astropy/units/__init__.py&#39;&gt;
</pre></div>
</div>
</div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">u</span></code> is an object that contains most common units and all SI units.</p>
<p>You can use <code class="docutils literal notranslate"><span class="pre">dir</span></code> to list them, but you should also <a class="reference external" href="https://docs.astropy.org/en/stable/units/">read the documentation</a>.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">dir</span><span class="p">(</span><span class="n">u</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;A&#39;,
&#39;AA&#39;,
&#39;AB&#39;,
&#39;ABflux&#39;,
&#39;ABmag&#39;,
&#39;AU&#39;,
&#39;Angstrom&#39;,
&#39;B&#39;,
&#39;Ba&#39;,
&#39;Barye&#39;,
&#39;Bi&#39;,
&#39;Biot&#39;,
&#39;Bol&#39;,
&#39;Bq&#39;,
&#39;C&#39;,
&#39;Celsius&#39;,
&#39;Ci&#39;,
&#39;CompositeUnit&#39;,
&#39;D&#39;,
&#39;Da&#39;,
&#39;Dalton&#39;,
&#39;Debye&#39;,
&#39;Decibel&#39;,
&#39;DecibelUnit&#39;,
&#39;Dex&#39;,
&#39;DexUnit&#39;,
&#39;EA&#39;,
&#39;EAU&#39;,
&#39;EB&#39;,
&#39;EBa&#39;,
&#39;EC&#39;,
&#39;ED&#39;,
&#39;EF&#39;,
&#39;EG&#39;,
&#39;EGal&#39;,
&#39;EH&#39;,
&#39;EHz&#39;,
&#39;EJ&#39;,
&#39;EJy&#39;,
&#39;EK&#39;,
&#39;EL&#39;,
&#39;EN&#39;,
&#39;EOhm&#39;,
&#39;EP&#39;,
&#39;EPa&#39;,
&#39;ER&#39;,
&#39;ERy&#39;,
&#39;ES&#39;,
&#39;ESt&#39;,
&#39;ET&#39;,
&#39;EV&#39;,
&#39;EW&#39;,
&#39;EWb&#39;,
&#39;Ea&#39;,
&#39;Eadu&#39;,
&#39;Earcmin&#39;,
&#39;Earcsec&#39;,
&#39;Eau&#39;,
&#39;Eb&#39;,
&#39;Ebarn&#39;,
&#39;Ebeam&#39;,
&#39;Ebin&#39;,
&#39;Ebit&#39;,
&#39;Ebyte&#39;,
&#39;Ecd&#39;,
&#39;Echan&#39;,
&#39;Ecount&#39;,
&#39;Ect&#39;,
&#39;Ed&#39;,
&#39;Edeg&#39;,
&#39;Edyn&#39;,
&#39;EeV&#39;,
&#39;Eerg&#39;,
&#39;Eg&#39;,
&#39;Eh&#39;,
&#39;EiB&#39;,
&#39;Eib&#39;,
&#39;Eibit&#39;,
&#39;Eibyte&#39;,
&#39;Ek&#39;,
&#39;El&#39;,
&#39;Elm&#39;,
&#39;Elx&#39;,
&#39;Elyr&#39;,
&#39;Em&#39;,
&#39;Emag&#39;,
&#39;Emin&#39;,
&#39;Emol&#39;,
&#39;Eohm&#39;,
&#39;Epc&#39;,
&#39;Eph&#39;,
&#39;Ephoton&#39;,
&#39;Epix&#39;,
&#39;Epixel&#39;,
&#39;Erad&#39;,
&#39;Es&#39;,
&#39;Esr&#39;,
&#39;Eu&#39;,
&#39;Evox&#39;,
&#39;Evoxel&#39;,
&#39;Eyr&#39;,
&#39;F&#39;,
&#39;Farad&#39;,
&#39;Fr&#39;,
&#39;Franklin&#39;,
&#39;FunctionQuantity&#39;,
&#39;FunctionUnitBase&#39;,
&#39;G&#39;,
&#39;GA&#39;,
&#39;GAU&#39;,
&#39;GB&#39;,
&#39;GBa&#39;,
&#39;GC&#39;,
&#39;GD&#39;,
&#39;GF&#39;,
&#39;GG&#39;,
&#39;GGal&#39;,
&#39;GH&#39;,
&#39;GHz&#39;,
&#39;GJ&#39;,
&#39;GJy&#39;,
&#39;GK&#39;,
&#39;GL&#39;,
&#39;GN&#39;,
&#39;GOhm&#39;,
&#39;GP&#39;,
&#39;GPa&#39;,
&#39;GR&#39;,
&#39;GRy&#39;,
&#39;GS&#39;,
&#39;GSt&#39;,
&#39;GT&#39;,
&#39;GV&#39;,
&#39;GW&#39;,
&#39;GWb&#39;,
&#39;Ga&#39;,
&#39;Gadu&#39;,
&#39;Gal&#39;,
&#39;Garcmin&#39;,
&#39;Garcsec&#39;,
&#39;Gau&#39;,
&#39;Gauss&#39;,
&#39;Gb&#39;,
&#39;Gbarn&#39;,
&#39;Gbeam&#39;,
&#39;Gbin&#39;,
&#39;Gbit&#39;,
&#39;Gbyte&#39;,
&#39;Gcd&#39;,
&#39;Gchan&#39;,
&#39;Gcount&#39;,
&#39;Gct&#39;,
&#39;Gd&#39;,
&#39;Gdeg&#39;,
&#39;Gdyn&#39;,
&#39;GeV&#39;,
&#39;Gerg&#39;,
&#39;Gg&#39;,
&#39;Gh&#39;,
&#39;GiB&#39;,
&#39;Gib&#39;,
&#39;Gibit&#39;,
&#39;Gibyte&#39;,
&#39;Gk&#39;,
&#39;Gl&#39;,
&#39;Glm&#39;,
&#39;Glx&#39;,
&#39;Glyr&#39;,
&#39;Gm&#39;,
&#39;Gmag&#39;,
&#39;Gmin&#39;,
&#39;Gmol&#39;,
&#39;Gohm&#39;,
&#39;Gpc&#39;,
&#39;Gph&#39;,
&#39;Gphoton&#39;,
&#39;Gpix&#39;,
&#39;Gpixel&#39;,
&#39;Grad&#39;,
&#39;Gs&#39;,
&#39;Gsr&#39;,
&#39;Gu&#39;,
&#39;Gvox&#39;,
&#39;Gvoxel&#39;,
&#39;Gyr&#39;,
&#39;H&#39;,
&#39;Henry&#39;,
&#39;Hertz&#39;,
&#39;Hz&#39;,
&#39;IrreducibleUnit&#39;,
&#39;J&#39;,
&#39;Jansky&#39;,
&#39;Joule&#39;,
&#39;Jy&#39;,
&#39;K&#39;,
&#39;Kayser&#39;,
&#39;Kelvin&#39;,
&#39;KiB&#39;,
&#39;Kib&#39;,
&#39;Kibit&#39;,
&#39;Kibyte&#39;,
&#39;L&#39;,
&#39;L_bol&#39;,
&#39;L_sun&#39;,
&#39;LogQuantity&#39;,
&#39;LogUnit&#39;,
&#39;Lsun&#39;,
&#39;MA&#39;,
&#39;MAU&#39;,
&#39;MB&#39;,
&#39;MBa&#39;,
&#39;MC&#39;,
&#39;MD&#39;,
&#39;MF&#39;,
&#39;MG&#39;,
&#39;MGal&#39;,
&#39;MH&#39;,
&#39;MHz&#39;,
&#39;MJ&#39;,
&#39;MJy&#39;,
&#39;MK&#39;,
&#39;ML&#39;,
&#39;MN&#39;,
&#39;MOhm&#39;,
&#39;MP&#39;,
&#39;MPa&#39;,
&#39;MR&#39;,
&#39;MRy&#39;,
&#39;MS&#39;,
&#39;MSt&#39;,
&#39;MT&#39;,
&#39;MV&#39;,
&#39;MW&#39;,
&#39;MWb&#39;,
&#39;M_bol&#39;,
&#39;M_e&#39;,
&#39;M_earth&#39;,
&#39;M_jup&#39;,
&#39;M_jupiter&#39;,
&#39;M_p&#39;,
&#39;M_sun&#39;,
&#39;Ma&#39;,
&#39;Madu&#39;,
&#39;MagUnit&#39;,
&#39;Magnitude&#39;,
&#39;Marcmin&#39;,
&#39;Marcsec&#39;,
&#39;Mau&#39;,
&#39;Mb&#39;,
&#39;Mbarn&#39;,
&#39;Mbeam&#39;,
&#39;Mbin&#39;,
&#39;Mbit&#39;,
&#39;Mbyte&#39;,
&#39;Mcd&#39;,
&#39;Mchan&#39;,
&#39;Mcount&#39;,
&#39;Mct&#39;,
&#39;Md&#39;,
&#39;Mdeg&#39;,
&#39;Mdyn&#39;,
&#39;MeV&#39;,
&#39;Mearth&#39;,
&#39;Merg&#39;,
&#39;Mg&#39;,
&#39;Mh&#39;,
&#39;MiB&#39;,
&#39;Mib&#39;,
&#39;Mibit&#39;,
&#39;Mibyte&#39;,
&#39;Mjup&#39;,
&#39;Mjupiter&#39;,
&#39;Mk&#39;,
&#39;Ml&#39;,
&#39;Mlm&#39;,
&#39;Mlx&#39;,
&#39;Mlyr&#39;,
&#39;Mm&#39;,
&#39;Mmag&#39;,
&#39;Mmin&#39;,
&#39;Mmol&#39;,
&#39;Mohm&#39;,
&#39;Mpc&#39;,
&#39;Mph&#39;,
&#39;Mphoton&#39;,
&#39;Mpix&#39;,
&#39;Mpixel&#39;,
&#39;Mrad&#39;,
&#39;Ms&#39;,
&#39;Msr&#39;,
&#39;Msun&#39;,
&#39;Mu&#39;,
&#39;Mvox&#39;,
&#39;Mvoxel&#39;,
&#39;Myr&#39;,
&#39;N&#39;,
&#39;NamedUnit&#39;,
&#39;Newton&#39;,
&#39;Ohm&#39;,
&#39;P&#39;,
&#39;PA&#39;,
&#39;PAU&#39;,
&#39;PB&#39;,
&#39;PBa&#39;,
&#39;PC&#39;,
&#39;PD&#39;,
&#39;PF&#39;,
&#39;PG&#39;,
&#39;PGal&#39;,
&#39;PH&#39;,
&#39;PHz&#39;,
&#39;PJ&#39;,
&#39;PJy&#39;,
&#39;PK&#39;,
&#39;PL&#39;,
&#39;PN&#39;,
&#39;POhm&#39;,
&#39;PP&#39;,
&#39;PPa&#39;,
&#39;PR&#39;,
&#39;PRy&#39;,
&#39;PS&#39;,
&#39;PSt&#39;,
&#39;PT&#39;,
&#39;PV&#39;,
&#39;PW&#39;,
&#39;PWb&#39;,
&#39;Pa&#39;,
&#39;Padu&#39;,
&#39;Parcmin&#39;,
&#39;Parcsec&#39;,
&#39;Pascal&#39;,
&#39;Pau&#39;,
&#39;Pb&#39;,
&#39;Pbarn&#39;,
&#39;Pbeam&#39;,
&#39;Pbin&#39;,
&#39;Pbit&#39;,
&#39;Pbyte&#39;,
&#39;Pcd&#39;,
&#39;Pchan&#39;,
&#39;Pcount&#39;,
&#39;Pct&#39;,
&#39;Pd&#39;,
&#39;Pdeg&#39;,
&#39;Pdyn&#39;,
&#39;PeV&#39;,
&#39;Perg&#39;,
&#39;Pg&#39;,
&#39;Ph&#39;,
&#39;PiB&#39;,
&#39;Pib&#39;,
&#39;Pibit&#39;,
&#39;Pibyte&#39;,
&#39;Pk&#39;,
&#39;Pl&#39;,
&#39;Plm&#39;,
&#39;Plx&#39;,
&#39;Plyr&#39;,
&#39;Pm&#39;,
&#39;Pmag&#39;,
&#39;Pmin&#39;,
&#39;Pmol&#39;,
&#39;Pohm&#39;,
&#39;Ppc&#39;,
&#39;Pph&#39;,
&#39;Pphoton&#39;,
&#39;Ppix&#39;,
&#39;Ppixel&#39;,
&#39;Prad&#39;,
&#39;PrefixUnit&#39;,
&#39;Ps&#39;,
&#39;Psr&#39;,
&#39;Pu&#39;,
&#39;Pvox&#39;,
&#39;Pvoxel&#39;,
&#39;Pyr&#39;,
&#39;Quantity&#39;,
&#39;QuantityInfo&#39;,
&#39;QuantityInfoBase&#39;,
&#39;R&#39;,
&#39;R_earth&#39;,
&#39;R_jup&#39;,
&#39;R_jupiter&#39;,
&#39;R_sun&#39;,
&#39;Rayleigh&#39;,
&#39;Rearth&#39;,
&#39;Rjup&#39;,
&#39;Rjupiter&#39;,
&#39;Rsun&#39;,
&#39;Ry&#39;,
&#39;S&#39;,
&#39;ST&#39;,
&#39;STflux&#39;,
&#39;STmag&#39;,
&#39;Siemens&#39;,
&#39;SpecificTypeQuantity&#39;,
&#39;St&#39;,
&#39;Sun&#39;,
&#39;T&#39;,
&#39;TA&#39;,
&#39;TAU&#39;,
&#39;TB&#39;,
&#39;TBa&#39;,
&#39;TC&#39;,
&#39;TD&#39;,
&#39;TF&#39;,
&#39;TG&#39;,
&#39;TGal&#39;,
&#39;TH&#39;,
&#39;THz&#39;,
&#39;TJ&#39;,
&#39;TJy&#39;,
&#39;TK&#39;,
&#39;TL&#39;,
&#39;TN&#39;,
&#39;TOhm&#39;,
&#39;TP&#39;,
&#39;TPa&#39;,
&#39;TR&#39;,
&#39;TRy&#39;,
&#39;TS&#39;,
&#39;TSt&#39;,
&#39;TT&#39;,
&#39;TV&#39;,
&#39;TW&#39;,
&#39;TWb&#39;,
&#39;Ta&#39;,
&#39;Tadu&#39;,
&#39;Tarcmin&#39;,
&#39;Tarcsec&#39;,
&#39;Tau&#39;,
&#39;Tb&#39;,
&#39;Tbarn&#39;,
&#39;Tbeam&#39;,
&#39;Tbin&#39;,
&#39;Tbit&#39;,
&#39;Tbyte&#39;,
&#39;Tcd&#39;,
&#39;Tchan&#39;,
&#39;Tcount&#39;,
&#39;Tct&#39;,
&#39;Td&#39;,
&#39;Tdeg&#39;,
&#39;Tdyn&#39;,
&#39;TeV&#39;,
&#39;Terg&#39;,
&#39;Tesla&#39;,
&#39;Tg&#39;,
&#39;Th&#39;,
&#39;TiB&#39;,
&#39;Tib&#39;,
&#39;Tibit&#39;,
&#39;Tibyte&#39;,
&#39;Tk&#39;,
&#39;Tl&#39;,
&#39;Tlm&#39;,
&#39;Tlx&#39;,
&#39;Tlyr&#39;,
&#39;Tm&#39;,
&#39;Tmag&#39;,
&#39;Tmin&#39;,
&#39;Tmol&#39;,
&#39;Tohm&#39;,
&#39;Tpc&#39;,
&#39;Tph&#39;,
&#39;Tphoton&#39;,
&#39;Tpix&#39;,
&#39;Tpixel&#39;,
&#39;Trad&#39;,
&#39;Ts&#39;,
&#39;Tsr&#39;,
&#39;Tu&#39;,
&#39;Tvox&#39;,
&#39;Tvoxel&#39;,
&#39;Tyr&#39;,
&#39;Unit&#39;,
&#39;UnitBase&#39;,
&#39;UnitConversionError&#39;,
&#39;UnitTypeError&#39;,
&#39;UnitsError&#39;,
&#39;UnitsWarning&#39;,
&#39;UnrecognizedUnit&#39;,
&#39;V&#39;,
&#39;Volt&#39;,
&#39;W&#39;,
&#39;Watt&#39;,
&#39;Wb&#39;,
&#39;Weber&#39;,
&#39;YA&#39;,
&#39;YAU&#39;,
&#39;YB&#39;,
&#39;YBa&#39;,
&#39;YC&#39;,
&#39;YD&#39;,
&#39;YF&#39;,
&#39;YG&#39;,
&#39;YGal&#39;,
&#39;YH&#39;,
&#39;YHz&#39;,
&#39;YJ&#39;,
&#39;YJy&#39;,
&#39;YK&#39;,
&#39;YL&#39;,
&#39;YN&#39;,
&#39;YOhm&#39;,
&#39;YP&#39;,
&#39;YPa&#39;,
&#39;YR&#39;,
&#39;YRy&#39;,
&#39;YS&#39;,
&#39;YSt&#39;,
&#39;YT&#39;,
&#39;YV&#39;,
&#39;YW&#39;,
&#39;YWb&#39;,
&#39;Ya&#39;,
&#39;Yadu&#39;,
&#39;Yarcmin&#39;,
&#39;Yarcsec&#39;,
&#39;Yau&#39;,
&#39;Yb&#39;,
&#39;Ybarn&#39;,
&#39;Ybeam&#39;,
&#39;Ybin&#39;,
&#39;Ybit&#39;,
&#39;Ybyte&#39;,
&#39;Ycd&#39;,
&#39;Ychan&#39;,
&#39;Ycount&#39;,
&#39;Yct&#39;,
&#39;Yd&#39;,
&#39;Ydeg&#39;,
&#39;Ydyn&#39;,
&#39;YeV&#39;,
&#39;Yerg&#39;,
&#39;Yg&#39;,
&#39;Yh&#39;,
&#39;Yk&#39;,
&#39;Yl&#39;,
&#39;Ylm&#39;,
&#39;Ylx&#39;,
&#39;Ylyr&#39;,
&#39;Ym&#39;,
&#39;Ymag&#39;,
&#39;Ymin&#39;,
&#39;Ymol&#39;,
&#39;Yohm&#39;,
&#39;Ypc&#39;,
&#39;Yph&#39;,
&#39;Yphoton&#39;,
&#39;Ypix&#39;,
&#39;Ypixel&#39;,
&#39;Yrad&#39;,
&#39;Ys&#39;,
&#39;Ysr&#39;,
&#39;Yu&#39;,
&#39;Yvox&#39;,
&#39;Yvoxel&#39;,
&#39;Yyr&#39;,
&#39;ZA&#39;,
&#39;ZAU&#39;,
&#39;ZB&#39;,
&#39;ZBa&#39;,
&#39;ZC&#39;,
&#39;ZD&#39;,
&#39;ZF&#39;,
&#39;ZG&#39;,
&#39;ZGal&#39;,
&#39;ZH&#39;,
&#39;ZHz&#39;,
&#39;ZJ&#39;,
&#39;ZJy&#39;,
&#39;ZK&#39;,
&#39;ZL&#39;,
&#39;ZN&#39;,
&#39;ZOhm&#39;,
&#39;ZP&#39;,
&#39;ZPa&#39;,
&#39;ZR&#39;,
&#39;ZRy&#39;,
&#39;ZS&#39;,
&#39;ZSt&#39;,
&#39;ZT&#39;,
&#39;ZV&#39;,
&#39;ZW&#39;,
&#39;ZWb&#39;,
&#39;Za&#39;,
&#39;Zadu&#39;,
&#39;Zarcmin&#39;,
&#39;Zarcsec&#39;,
&#39;Zau&#39;,
&#39;Zb&#39;,
&#39;Zbarn&#39;,
&#39;Zbeam&#39;,
&#39;Zbin&#39;,
&#39;Zbit&#39;,
&#39;Zbyte&#39;,
&#39;Zcd&#39;,
&#39;Zchan&#39;,
&#39;Zcount&#39;,
&#39;Zct&#39;,
&#39;Zd&#39;,
&#39;Zdeg&#39;,
&#39;Zdyn&#39;,
&#39;ZeV&#39;,
&#39;Zerg&#39;,
&#39;Zg&#39;,
&#39;Zh&#39;,
&#39;Zk&#39;,
&#39;Zl&#39;,
&#39;Zlm&#39;,
&#39;Zlx&#39;,
&#39;Zlyr&#39;,
&#39;Zm&#39;,
&#39;Zmag&#39;,
&#39;Zmin&#39;,
&#39;Zmol&#39;,
&#39;Zohm&#39;,
&#39;Zpc&#39;,
&#39;Zph&#39;,
&#39;Zphoton&#39;,
&#39;Zpix&#39;,
&#39;Zpixel&#39;,
&#39;Zrad&#39;,
&#39;Zs&#39;,
&#39;Zsr&#39;,
&#39;Zu&#39;,
&#39;Zvox&#39;,
&#39;Zvoxel&#39;,
&#39;Zyr&#39;,
&#39;__builtins__&#39;,
&#39;__cached__&#39;,
&#39;__doc__&#39;,
&#39;__file__&#39;,
&#39;__loader__&#39;,
&#39;__name__&#39;,
&#39;__package__&#39;,
&#39;__path__&#39;,
&#39;__spec__&#39;,
&#39;a&#39;,
&#39;aA&#39;,
&#39;aAU&#39;,
&#39;aB&#39;,
&#39;aBa&#39;,
&#39;aC&#39;,
&#39;aD&#39;,
&#39;aF&#39;,
&#39;aG&#39;,
&#39;aGal&#39;,
&#39;aH&#39;,
&#39;aHz&#39;,
&#39;aJ&#39;,
&#39;aJy&#39;,
&#39;aK&#39;,
&#39;aL&#39;,
&#39;aN&#39;,
&#39;aOhm&#39;,
&#39;aP&#39;,
&#39;aPa&#39;,
&#39;aR&#39;,
&#39;aRy&#39;,
&#39;aS&#39;,
&#39;aSt&#39;,
&#39;aT&#39;,
&#39;aV&#39;,
&#39;aW&#39;,
&#39;aWb&#39;,
&#39;aa&#39;,
&#39;aadu&#39;,
&#39;aarcmin&#39;,
&#39;aarcsec&#39;,
&#39;aau&#39;,
&#39;ab&#39;,
&#39;abA&#39;,
&#39;abC&#39;,
&#39;abampere&#39;,
&#39;abarn&#39;,
&#39;abcoulomb&#39;,
&#39;abeam&#39;,
&#39;abin&#39;,
&#39;abit&#39;,
&#39;abyte&#39;,
&#39;acd&#39;,
&#39;achan&#39;,
&#39;acount&#39;,
&#39;act&#39;,
&#39;ad&#39;,
&#39;add_enabled_equivalencies&#39;,
&#39;add_enabled_units&#39;,
&#39;adeg&#39;,
&#39;adu&#39;,
&#39;adyn&#39;,
&#39;aeV&#39;,
&#39;aerg&#39;,
&#39;ag&#39;,
&#39;ah&#39;,
&#39;ak&#39;,
&#39;al&#39;,
&#39;allclose&#39;,
&#39;alm&#39;,
&#39;alx&#39;,
&#39;alyr&#39;,
&#39;am&#39;,
&#39;amag&#39;,
&#39;amin&#39;,
&#39;amol&#39;,
&#39;amp&#39;,
&#39;ampere&#39;,
&#39;angstrom&#39;,
&#39;annum&#39;,
&#39;aohm&#39;,
&#39;apc&#39;,
&#39;aph&#39;,
&#39;aphoton&#39;,
&#39;apix&#39;,
&#39;apixel&#39;,
&#39;arad&#39;,
&#39;arcmin&#39;,
&#39;arcminute&#39;,
&#39;arcsec&#39;,
&#39;arcsecond&#39;,
&#39;asr&#39;,
&#39;astronomical_unit&#39;,
&#39;astrophys&#39;,
&#39;attoBarye&#39;,
&#39;attoDa&#39;,
&#39;attoDalton&#39;,
&#39;attoDebye&#39;,
&#39;attoFarad&#39;,
&#39;attoGauss&#39;,
&#39;attoHenry&#39;,
&#39;attoHertz&#39;,
&#39;attoJansky&#39;,
&#39;attoJoule&#39;,
&#39;attoKayser&#39;,
&#39;attoKelvin&#39;,
&#39;attoNewton&#39;,
&#39;attoOhm&#39;,
&#39;attoPascal&#39;,
&#39;attoRayleigh&#39;,
&#39;attoSiemens&#39;,
&#39;attoTesla&#39;,
&#39;attoVolt&#39;,
&#39;attoWatt&#39;,
&#39;attoWeber&#39;,
&#39;attoamp&#39;,
&#39;attoampere&#39;,
&#39;attoannum&#39;,
&#39;attoarcminute&#39;,
&#39;attoarcsecond&#39;,
&#39;attoastronomical_unit&#39;,
&#39;attobarn&#39;,
&#39;attobarye&#39;,
&#39;attobit&#39;,
&#39;attobyte&#39;,
&#39;attocandela&#39;,
&#39;attocoulomb&#39;,
&#39;attocount&#39;,
&#39;attoday&#39;,
&#39;attodebye&#39;,
&#39;attodegree&#39;,
&#39;attodyne&#39;,
&#39;attoelectronvolt&#39;,
&#39;attofarad&#39;,
&#39;attogal&#39;,
&#39;attogauss&#39;,
&#39;attogram&#39;,
&#39;attohenry&#39;,
&#39;attohertz&#39;,
&#39;attohour&#39;,
&#39;attohr&#39;,
&#39;attojansky&#39;,
&#39;attojoule&#39;,
&#39;attokayser&#39;,
&#39;attolightyear&#39;,
&#39;attoliter&#39;,
&#39;attolumen&#39;,
&#39;attolux&#39;,
&#39;attometer&#39;,
&#39;attominute&#39;,
&#39;attomole&#39;,
&#39;attonewton&#39;,
&#39;attoparsec&#39;,
&#39;attopascal&#39;,
&#39;attophoton&#39;,
&#39;attopixel&#39;,
&#39;attopoise&#39;,
&#39;attoradian&#39;,
&#39;attorayleigh&#39;,
&#39;attorydberg&#39;,
&#39;attosecond&#39;,
&#39;attosiemens&#39;,
&#39;attosteradian&#39;,
&#39;attostokes&#39;,
&#39;attotesla&#39;,
&#39;attovolt&#39;,
&#39;attovoxel&#39;,
&#39;attowatt&#39;,
&#39;attoweber&#39;,
&#39;attoyear&#39;,
&#39;au&#39;,
&#39;avox&#39;,
&#39;avoxel&#39;,
&#39;ayr&#39;,
&#39;b&#39;,
&#39;bar&#39;,
&#39;barn&#39;,
&#39;barye&#39;,
&#39;beam&#39;,
&#39;beam_angular_area&#39;,
&#39;becquerel&#39;,
&#39;bin&#39;,
&#39;binary_prefixes&#39;,
&#39;bit&#39;,
&#39;bol&#39;,
&#39;brightness_temperature&#39;,
&#39;byte&#39;,
&#39;cA&#39;,
&#39;cAU&#39;,
&#39;cB&#39;,
&#39;cBa&#39;,
&#39;cC&#39;,
&#39;cD&#39;,
&#39;cF&#39;,
&#39;cG&#39;,
&#39;cGal&#39;,
&#39;cH&#39;,
&#39;cHz&#39;,
&#39;cJ&#39;,
&#39;cJy&#39;,
&#39;cK&#39;,
&#39;cL&#39;,
&#39;cN&#39;,
&#39;cOhm&#39;,
&#39;cP&#39;,
&#39;cPa&#39;,
&#39;cR&#39;,
&#39;cRy&#39;,
&#39;cS&#39;,
&#39;cSt&#39;,
&#39;cT&#39;,
&#39;cV&#39;,
&#39;cW&#39;,
&#39;cWb&#39;,
&#39;ca&#39;,
&#39;cadu&#39;,
&#39;candela&#39;,
&#39;carcmin&#39;,
&#39;carcsec&#39;,
&#39;cau&#39;,
&#39;cb&#39;,
&#39;cbarn&#39;,
&#39;cbeam&#39;,
&#39;cbin&#39;,
&#39;cbit&#39;,
&#39;cbyte&#39;,
&#39;ccd&#39;,
&#39;cchan&#39;,
&#39;ccount&#39;,
&#39;cct&#39;,
&#39;cd&#39;,
&#39;cdeg&#39;,
&#39;cdyn&#39;,
&#39;ceV&#39;,
&#39;centiBarye&#39;,
&#39;centiDa&#39;,
&#39;centiDalton&#39;,
&#39;centiDebye&#39;,
&#39;centiFarad&#39;,
&#39;centiGauss&#39;,
&#39;centiHenry&#39;,
&#39;centiHertz&#39;,
&#39;centiJansky&#39;,
&#39;centiJoule&#39;,
&#39;centiKayser&#39;,
&#39;centiKelvin&#39;,
&#39;centiNewton&#39;,
&#39;centiOhm&#39;,
&#39;centiPascal&#39;,
&#39;centiRayleigh&#39;,
&#39;centiSiemens&#39;,
&#39;centiTesla&#39;,
&#39;centiVolt&#39;,
&#39;centiWatt&#39;,
&#39;centiWeber&#39;,
&#39;centiamp&#39;,
&#39;centiampere&#39;,
&#39;centiannum&#39;,
&#39;centiarcminute&#39;,
&#39;centiarcsecond&#39;,
&#39;centiastronomical_unit&#39;,
&#39;centibarn&#39;,
&#39;centibarye&#39;,
&#39;centibit&#39;,
&#39;centibyte&#39;,
&#39;centicandela&#39;,
&#39;centicoulomb&#39;,
&#39;centicount&#39;,
&#39;centiday&#39;,
&#39;centidebye&#39;,
&#39;centidegree&#39;,
&#39;centidyne&#39;,
&#39;centielectronvolt&#39;,
&#39;centifarad&#39;,
&#39;centigal&#39;,
&#39;centigauss&#39;,
&#39;centigram&#39;,
&#39;centihenry&#39;,
&#39;centihertz&#39;,
&#39;centihour&#39;,
&#39;centihr&#39;,
&#39;centijansky&#39;,
&#39;centijoule&#39;,
&#39;centikayser&#39;,
&#39;centilightyear&#39;,
&#39;centiliter&#39;,
&#39;centilumen&#39;,
&#39;centilux&#39;,
&#39;centimeter&#39;,
&#39;centiminute&#39;,
&#39;centimole&#39;,
&#39;centinewton&#39;,
&#39;centiparsec&#39;,
&#39;centipascal&#39;,
&#39;centiphoton&#39;,
&#39;centipixel&#39;,
&#39;centipoise&#39;,
&#39;centiradian&#39;,
&#39;centirayleigh&#39;,
&#39;centirydberg&#39;,
&#39;centisecond&#39;,
&#39;centisiemens&#39;,
&#39;centisteradian&#39;,
&#39;centistokes&#39;,
&#39;centitesla&#39;,
&#39;centivolt&#39;,
&#39;centivoxel&#39;,
&#39;centiwatt&#39;,
&#39;centiweber&#39;,
&#39;centiyear&#39;,
&#39;cerg&#39;,
&#39;cg&#39;,
&#39;cgs&#39;,
&#39;ch&#39;,
&#39;chan&#39;,
&#39;ck&#39;,
&#39;cl&#39;,
&#39;clm&#39;,
&#39;clx&#39;,
&#39;clyr&#39;,
&#39;cm&#39;,
&#39;cmag&#39;,
&#39;cmin&#39;,
&#39;cmol&#39;,
&#39;cohm&#39;,
&#39;core&#39;,
&#39;coulomb&#39;,
&#39;count&#39;,
&#39;cpc&#39;,
&#39;cph&#39;,
&#39;cphoton&#39;,
&#39;cpix&#39;,
&#39;cpixel&#39;,
&#39;crad&#39;,
&#39;cs&#39;,
&#39;csr&#39;,
&#39;ct&#39;,
&#39;cu&#39;,
&#39;curie&#39;,
&#39;cvox&#39;,
&#39;cvoxel&#39;,
&#39;cy&#39;,
&#39;cycle&#39;,
&#39;cyr&#39;,
&#39;d&#39;,
&#39;dA&#39;,
&#39;dAU&#39;,
&#39;dB&#39;,
&#39;dBa&#39;,
&#39;dC&#39;,
&#39;dD&#39;,
&#39;dF&#39;,
&#39;dG&#39;,
&#39;dGal&#39;,
&#39;dH&#39;,
&#39;dHz&#39;,
&#39;dJ&#39;,
&#39;dJy&#39;,
&#39;dK&#39;,
&#39;dL&#39;,
&#39;dN&#39;,
&#39;dOhm&#39;,
&#39;dP&#39;,
&#39;dPa&#39;,
&#39;dR&#39;,
&#39;dRy&#39;,
&#39;dS&#39;,
&#39;dSt&#39;,
&#39;dT&#39;,
...]
</pre></div>
</div>
</div>
</div>
<p>To create a quantity, we multiply a value by a unit.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">coordinate</span> <span class="o">=</span> <span class="mi">30</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span>
<span class="nb">type</span><span class="p">(</span><span class="n">coordinate</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>astropy.units.quantity.Quantity
</pre></div>
</div>
</div>
</div>
<p>The result is a <code class="docutils literal notranslate"><span class="pre">Quantity</span></code> object.</p>
<p>Jupyter knows how to display <code class="docutils literal notranslate"><span class="pre">Quantities</span></code> like this:</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">coordinate</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_latex math notranslate nohighlight">
\[30 \; \mathrm{{}^{\circ}}\]</div>
</div>
</div>
</div>
<div class="section" id="selecting-a-rectangle">
<h2>Selecting a rectangle<a class="headerlink" href="#selecting-a-rectangle" title="Permalink to this headline"></a></h2>
<p>Now well select a rectangle from -55 to -45 degrees right ascension and -8 to 4 degrees of declination.</p>
<p>Well define variables to contain these limits.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">55</span>
<span class="n">phi1_max</span> <span class="o">=</span> <span class="o">-</span><span class="mi">45</span>
<span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">8</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mi">4</span>
</pre></div>
</div>
</div>
</div>
<p>To represent a rectangle, well use two lists of coordinates and multiply by their units.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">phi1_min</span><span class="p">,</span> <span class="n">phi1_min</span><span class="p">,</span> <span class="n">phi1_max</span><span class="p">,</span> <span class="n">phi1_max</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span>
<span class="n">phi2_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">phi2_min</span><span class="p">,</span> <span class="n">phi2_max</span><span class="p">,</span> <span class="n">phi2_max</span><span class="p">,</span> <span class="n">phi2_min</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span>
</pre></div>
</div>
</div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">phi1_rect</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2_rect</span></code> represent the coordinates of the corners of a rectangle.</p>
<p>But they are in “<a class="reference external" href="https://gala-astro.readthedocs.io/en/latest/_modules/gala/coordinates/gd1.html">a Heliocentric spherical coordinate system defined by the orbit of the GD1 stream</a></p>
<p>In order to use them in a Gaia query, we have to convert them to <a class="reference external" href="https://en.wikipedia.org/wiki/International_Celestial_Reference_System">International Celestial Reference System</a> (ICRS) coordinates. We can do that by storing the coordinates in a <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> object provided by <a class="reference external" href="https://gala-astro.readthedocs.io/en/latest/coordinates/">Gala</a>.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">gala.coordinates</span> <span class="k">as</span> <span class="nn">gc</span>
<span class="n">corners</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">GD1Koposov10</span><span class="p">(</span><span class="n">phi1</span><span class="o">=</span><span class="n">phi1_rect</span><span class="p">,</span> <span class="n">phi2</span><span class="o">=</span><span class="n">phi2_rect</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">corners</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gala.coordinates.gd1.GD1Koposov10
</pre></div>
</div>
</div>
</div>
<p>We can display the result like this:</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">corners</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;GD1Koposov10 Coordinate: (phi1, phi2) in deg
[(-55., -8.), (-55., 4.), (-45., 4.), (-45., -8.)]&gt;
</pre></div>
</div>
</div>
</div>
<p>Now we can use <code class="docutils literal notranslate"><span class="pre">transform_to</span></code> to convert to ICRS coordinates.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">astropy.coordinates</span> <span class="k">as</span> <span class="nn">coord</span>
<span class="n">corners_icrs</span> <span class="o">=</span> <span class="n">corners</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">coord</span><span class="o">.</span><span class="n">ICRS</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">corners_icrs</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>astropy.coordinates.builtin_frames.icrs.ICRS
</pre></div>
</div>
</div>
</div>
<p>The result is an <code class="docutils literal notranslate"><span class="pre">ICRS</span></code> object.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">corners_icrs</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;ICRS Coordinate: (ra, dec) in deg
[(146.27533314, 19.26190982), (135.42163944, 25.87738723),
(141.60264825, 34.3048303 ), (152.81671045, 27.13611254)]&gt;
</pre></div>
</div>
</div>
</div>
<p>Notice that a rectangle in one coordinate system is not necessarily a rectangle in another. In this example, the result is a polygon.</p>
</div>
<div class="section" id="selecting-a-polygon">
<h2>Selecting a polygon<a class="headerlink" href="#selecting-a-polygon" title="Permalink to this headline"></a></h2>
<p>In order to use this polygon as part of an ADQL query, we have to convert it to a string with a comma-separated list of coordinates, as in this example:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">POLYGON(143.65, 20.98, </span>
<span class="sd"> 134.46, 26.39, </span>
<span class="sd"> 140.58, 34.85, </span>
<span class="sd"> 150.16, 29.01)</span>
<span class="sd">&quot;&quot;&quot;</span>
</pre></div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">corners_icrs</span></code> behaves like a list, so we can use a <code class="docutils literal notranslate"><span class="pre">for</span></code> loop to iterate through the points.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">point</span> <span class="ow">in</span> <span class="n">corners_icrs</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;ICRS Coordinate: (ra, dec) in deg
(146.27533314, 19.26190982)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg
(135.42163944, 25.87738723)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg
(141.60264825, 34.3048303)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg
(152.81671045, 27.13611254)&gt;
</pre></div>
</div>
</div>
</div>
<p>From that, we can select the coordinates <code class="docutils literal notranslate"><span class="pre">ra</span></code> and <code class="docutils literal notranslate"><span class="pre">dec</span></code>:</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">point</span> <span class="ow">in</span> <span class="n">corners_icrs</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">point</span><span class="o">.</span><span class="n">ra</span><span class="p">,</span> <span class="n">point</span><span class="o">.</span><span class="n">dec</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>146d16m31.1993s 19d15m42.8754s
135d25m17.902s 25d52m38.594s
141d36m09.5337s 34d18m17.3891s
152d49m00.1576s 27d08m10.0051s
</pre></div>
</div>
</div>
</div>
<p>The results are quantities with units, but if we select the <code class="docutils literal notranslate"><span class="pre">value</span></code> part, we get a dimensionless floating-point number.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">point</span> <span class="ow">in</span> <span class="n">corners_icrs</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">point</span><span class="o">.</span><span class="n">ra</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> <span class="n">point</span><span class="o">.</span><span class="n">dec</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>146.27533313607782 19.261909820533692
135.42163944306296 25.87738722767213
141.60264825107333 34.304830296257144
152.81671044675923 27.136112541397996
</pre></div>
</div>
</div>
</div>
<p>We can use string <code class="docutils literal notranslate"><span class="pre">format</span></code> to convert these numbers to strings.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">point_base</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{point.ra.value}</span><span class="s2">, </span><span class="si">{point.dec.value}</span><span class="s2">&quot;</span>
<span class="n">t</span> <span class="o">=</span> <span class="p">[</span><span class="n">point_base</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">point</span><span class="o">=</span><span class="n">point</span><span class="p">)</span>
<span class="k">for</span> <span class="n">point</span> <span class="ow">in</span> <span class="n">corners_icrs</span><span class="p">]</span>
<span class="n">t</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;146.27533313607782, 19.261909820533692&#39;,
&#39;135.42163944306296, 25.87738722767213&#39;,
&#39;141.60264825107333, 34.304830296257144&#39;,
&#39;152.81671044675923, 27.136112541397996&#39;]
</pre></div>
</div>
</div>
</div>
<p>The result is a list of strings, which we can join into a single string using <code class="docutils literal notranslate"><span class="pre">join</span></code>.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">point_list</span> <span class="o">=</span> <span class="s1">&#39;, &#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
<span class="n">point_list</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&#39;146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996&#39;
</pre></div>
</div>
</div>
</div>
<p>Notice that we invoke <code class="docutils literal notranslate"><span class="pre">join</span></code> on a string and pass the list as an argument.</p>
<p>Before we can assemble the query, we need <code class="docutils literal notranslate"><span class="pre">columns</span></code> again (as we saw in the previous notebook).</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">columns</span> <span class="o">=</span> <span class="s1">&#39;source_id, ra, dec, pmra, pmdec, parallax, parallax_error, radial_velocity&#39;</span>
</pre></div>
</div>
</div>
</div>
<p>Heres the base for the query, with format specifiers for <code class="docutils literal notranslate"><span class="pre">columns</span></code> and <code class="docutils literal notranslate"><span class="pre">point_list</span></code>.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">query_base</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;SELECT </span><span class="si">{columns}</span><span class="s2"></span>
<span class="s2">FROM gaiadr2.gaia_source</span>
<span class="s2">WHERE parallax &lt; 1</span>
<span class="s2"> AND bp_rp BETWEEN -0.75 AND 2 </span>
<span class="s2"> AND 1 = CONTAINS(POINT(ra, dec), </span>
<span class="s2"> POLYGON(</span><span class="si">{point_list}</span><span class="s2">))</span>
<span class="s2">&quot;&quot;&quot;</span>
</pre></div>
</div>
</div>
</div>
<p>And heres the result:</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">query</span> <span class="o">=</span> <span class="n">query_base</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">columns</span><span class="o">=</span><span class="n">columns</span><span class="p">,</span>
<span class="n">point_list</span><span class="o">=</span><span class="n">point_list</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>SELECT source_id, ra, dec, pmra, pmdec, parallax, parallax_error, radial_velocity
FROM gaiadr2.gaia_source
WHERE parallax &lt; 1
AND bp_rp BETWEEN -0.75 AND 2
AND 1 = CONTAINS(POINT(ra, dec),
POLYGON(146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996))
</pre></div>
</div>
</div>
</div>
<p>As always, we should take a minute to proof-read the query before we launch it.</p>
<p>The result will be bigger than our previous queries, so it will take a little longer.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">job</span> <span class="o">=</span> <span class="n">Gaia</span><span class="o">.</span><span class="n">launch_job_async</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="n">job</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>INFO: Query finished. [astroquery.utils.tap.core]
&lt;Table length=140340&gt;
name dtype unit description n_bad
--------------- ------- -------- ------------------------------------------------------------------ ------
source_id int64 Unique source identifier (unique within a particular Data Release) 0
ra float64 deg Right ascension 0
dec float64 deg Declination 0
pmra float64 mas / yr Proper motion in right ascension direction 0
pmdec float64 mas / yr Proper motion in declination direction 0
parallax float64 mas Parallax 0
parallax_error float64 mas Standard error of parallax 0
radial_velocity float64 km / s Radial velocity 139374
Jobid: 1605624329053O
Phase: COMPLETED
Owner: None
Output file: async_20201117094529.vot
Results: None
</pre></div>
</div>
</div>
</div>
<p>Here are the results.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">results</span> <span class="o">=</span> <span class="n">job</span><span class="o">.</span><span class="n">get_results</span><span class="p">()</span>
<span class="nb">len</span><span class="p">(</span><span class="n">results</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>140340
</pre></div>
</div>
</div>
</div>
<p>There are more than 100,000 stars in this polygon, but thats a manageable size to work with.</p>
</div>
<div class="section" id="saving-results">
<h2>Saving results<a class="headerlink" href="#saving-results" title="Permalink to this headline"></a></h2>
<p>This is the set of stars well work with in the next step. But since we have a substantial dataset now, this is a good time to save it.</p>
<p>Storing the data in a file means we can shut down this notebook and pick up where we left off without running the previous query again.</p>
<p>Astropy <code class="docutils literal notranslate"><span class="pre">Table</span></code> objects provide <code class="docutils literal notranslate"><span class="pre">write</span></code>, which writes the table to disk.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">filename</span> <span class="o">=</span> <span class="s1">&#39;gd1_results.fits&#39;</span>
<span class="n">results</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="n">overwrite</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<p>Because the filename ends with <code class="docutils literal notranslate"><span class="pre">fits</span></code>, the table is written in the <a class="reference external" href="https://en.wikipedia.org/wiki/FITS">FITS format</a>, which preserves the metadata associated with the table.</p>
<p>If the file already exists, the <code class="docutils literal notranslate"><span class="pre">overwrite</span></code> argument causes it to be overwritten.</p>
<p>To see how big the file is, we can use <code class="docutils literal notranslate"><span class="pre">ls</span></code> with the <code class="docutils literal notranslate"><span class="pre">-lh</span></code> option, which prints information about the file including its size in human-readable form.</p>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="o">!</span>ls -lh gd1_results.fits
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 8.6M Nov 17 09:45 gd1_results.fits
</pre></div>
</div>
</div>
</div>
<p>The file is about 8.6 MB. If you are using Windows, <code class="docutils literal notranslate"><span class="pre">ls</span></code> might not work; in that case, try:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>!dir gd1_results.fits
</pre></div>
</div>
</div>
<div class="section" id="summary">
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline"></a></h2>
<p>In this notebook, we composed more complex queries to select stars within a polygonal region of the sky. Then we downloaded the results and saved them in a FITS file.</p>
<p>In the next notebook, well reload the data from this file and replicate the next step in the analysis, using proper motion to identify stars likely to be in GD-1.</p>
</div>
<div class="section" id="best-practices">
<h2>Best practices<a class="headerlink" href="#best-practices" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>For measurements with units, use <code class="docutils literal notranslate"><span class="pre">Quantity</span></code> objects that represent units explicitly and check for errors.</p></li>
<li><p>Use the <code class="docutils literal notranslate"><span class="pre">format</span></code> function to compose queries; it is often faster and less error-prone.</p></li>
<li><p>Develop queries incrementally: start with something simple, test it, and add a little bit at a time.</p></li>
<li><p>Once you have a query working, save the data in a local file. If you shut down the notebook and come back to it later, you can reload the file; you dont have to run the query again.</p></li>
</ul>
</div>
</div>
<script type="text/x-thebe-config">
{
requestKernel: true,
binderOptions: {
repo: "binder-examples/jupyter-stacks-datascience",
ref: "master",
},
codeMirrorConfig: {
theme: "abcdef",
mode: "python"
},
kernelOptions: {
kernelName: "python3",
path: "./."
},
predefinedOutput: true
}
</script>
<script>kernelName = 'python3'</script>
</div>
</div>
</div>
<div class='prev-next-bottom'>
<a class='left-prev' id="prev-link" href="01_query.html" title="previous page">Queries</a>
<a class='right-next' id="next-link" href="03_motion.html" title="next page">Chapter 3</a>
</div>
<footer class="footer mt-5 mt-md-0">
<div class="container">
<p>
By Allen B. Downey<br/>
&copy; Copyright 2020.<br/>
</p>
</div>
</footer>
</main>
</div>
</div>
<script src="_static/js/index.30270b6e4c972e43c488.js"></script>
</body>
</html>