mirror of
https://github.com/AllenDowney/AstronomicalData.git
synced 2025-12-27 05:03:16 -08:00
1850 lines
64 KiB
HTML
1850 lines
64 KiB
HTML
|
||
<!DOCTYPE html>
|
||
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>Chapter 2 — 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="Chapter 1" 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">
|
||
Chapter 1
|
||
</a>
|
||
</li>
|
||
<li class="toctree-l1 current active">
|
||
<a class="current reference internal" href="#">
|
||
Chapter 2
|
||
</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/AstronomyDataPython"><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/AstronomyDataPython/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/AstronomyDataPython/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="#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="chapter-2">
|
||
<h1>Chapter 2<a class="headerlink" href="#chapter-2" 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, we’ll 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>We’ll 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, we’ll:</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, here’s 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">"""</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">"""</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>Here’s 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="table139949838258672" 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>
|
||
<p><strong>Exercise:</strong> 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 don’t 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 we’ll 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 let’s 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><module 'astropy.units' from '/home/downey/anaconda3/envs/AstronomicalData/lib/python3.8/site-packages/astropy/units/__init__.py'>
|
||
</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>['A',
|
||
'AA',
|
||
'AB',
|
||
'ABflux',
|
||
'ABmag',
|
||
'AU',
|
||
'Angstrom',
|
||
'B',
|
||
'Ba',
|
||
'Barye',
|
||
'Bi',
|
||
'Biot',
|
||
'Bol',
|
||
'Bq',
|
||
'C',
|
||
'Celsius',
|
||
'Ci',
|
||
'CompositeUnit',
|
||
'D',
|
||
'Da',
|
||
'Dalton',
|
||
'Debye',
|
||
'Decibel',
|
||
'DecibelUnit',
|
||
'Dex',
|
||
'DexUnit',
|
||
'EA',
|
||
'EAU',
|
||
'EB',
|
||
'EBa',
|
||
'EC',
|
||
'ED',
|
||
'EF',
|
||
'EG',
|
||
'EGal',
|
||
'EH',
|
||
'EHz',
|
||
'EJ',
|
||
'EJy',
|
||
'EK',
|
||
'EL',
|
||
'EN',
|
||
'EOhm',
|
||
'EP',
|
||
'EPa',
|
||
'ER',
|
||
'ERy',
|
||
'ES',
|
||
'ESt',
|
||
'ET',
|
||
'EV',
|
||
'EW',
|
||
'EWb',
|
||
'Ea',
|
||
'Eadu',
|
||
'Earcmin',
|
||
'Earcsec',
|
||
'Eau',
|
||
'Eb',
|
||
'Ebarn',
|
||
'Ebeam',
|
||
'Ebin',
|
||
'Ebit',
|
||
'Ebyte',
|
||
'Ecd',
|
||
'Echan',
|
||
'Ecount',
|
||
'Ect',
|
||
'Ed',
|
||
'Edeg',
|
||
'Edyn',
|
||
'EeV',
|
||
'Eerg',
|
||
'Eg',
|
||
'Eh',
|
||
'EiB',
|
||
'Eib',
|
||
'Eibit',
|
||
'Eibyte',
|
||
'Ek',
|
||
'El',
|
||
'Elm',
|
||
'Elx',
|
||
'Elyr',
|
||
'Em',
|
||
'Emag',
|
||
'Emin',
|
||
'Emol',
|
||
'Eohm',
|
||
'Epc',
|
||
'Eph',
|
||
'Ephoton',
|
||
'Epix',
|
||
'Epixel',
|
||
'Erad',
|
||
'Es',
|
||
'Esr',
|
||
'Eu',
|
||
'Evox',
|
||
'Evoxel',
|
||
'Eyr',
|
||
'F',
|
||
'Farad',
|
||
'Fr',
|
||
'Franklin',
|
||
'FunctionQuantity',
|
||
'FunctionUnitBase',
|
||
'G',
|
||
'GA',
|
||
'GAU',
|
||
'GB',
|
||
'GBa',
|
||
'GC',
|
||
'GD',
|
||
'GF',
|
||
'GG',
|
||
'GGal',
|
||
'GH',
|
||
'GHz',
|
||
'GJ',
|
||
'GJy',
|
||
'GK',
|
||
'GL',
|
||
'GN',
|
||
'GOhm',
|
||
'GP',
|
||
'GPa',
|
||
'GR',
|
||
'GRy',
|
||
'GS',
|
||
'GSt',
|
||
'GT',
|
||
'GV',
|
||
'GW',
|
||
'GWb',
|
||
'Ga',
|
||
'Gadu',
|
||
'Gal',
|
||
'Garcmin',
|
||
'Garcsec',
|
||
'Gau',
|
||
'Gauss',
|
||
'Gb',
|
||
'Gbarn',
|
||
'Gbeam',
|
||
'Gbin',
|
||
'Gbit',
|
||
'Gbyte',
|
||
'Gcd',
|
||
'Gchan',
|
||
'Gcount',
|
||
'Gct',
|
||
'Gd',
|
||
'Gdeg',
|
||
'Gdyn',
|
||
'GeV',
|
||
'Gerg',
|
||
'Gg',
|
||
'Gh',
|
||
'GiB',
|
||
'Gib',
|
||
'Gibit',
|
||
'Gibyte',
|
||
'Gk',
|
||
'Gl',
|
||
'Glm',
|
||
'Glx',
|
||
'Glyr',
|
||
'Gm',
|
||
'Gmag',
|
||
'Gmin',
|
||
'Gmol',
|
||
'Gohm',
|
||
'Gpc',
|
||
'Gph',
|
||
'Gphoton',
|
||
'Gpix',
|
||
'Gpixel',
|
||
'Grad',
|
||
'Gs',
|
||
'Gsr',
|
||
'Gu',
|
||
'Gvox',
|
||
'Gvoxel',
|
||
'Gyr',
|
||
'H',
|
||
'Henry',
|
||
'Hertz',
|
||
'Hz',
|
||
'IrreducibleUnit',
|
||
'J',
|
||
'Jansky',
|
||
'Joule',
|
||
'Jy',
|
||
'K',
|
||
'Kayser',
|
||
'Kelvin',
|
||
'KiB',
|
||
'Kib',
|
||
'Kibit',
|
||
'Kibyte',
|
||
'L',
|
||
'L_bol',
|
||
'L_sun',
|
||
'LogQuantity',
|
||
'LogUnit',
|
||
'Lsun',
|
||
'MA',
|
||
'MAU',
|
||
'MB',
|
||
'MBa',
|
||
'MC',
|
||
'MD',
|
||
'MF',
|
||
'MG',
|
||
'MGal',
|
||
'MH',
|
||
'MHz',
|
||
'MJ',
|
||
'MJy',
|
||
'MK',
|
||
'ML',
|
||
'MN',
|
||
'MOhm',
|
||
'MP',
|
||
'MPa',
|
||
'MR',
|
||
'MRy',
|
||
'MS',
|
||
'MSt',
|
||
'MT',
|
||
'MV',
|
||
'MW',
|
||
'MWb',
|
||
'M_bol',
|
||
'M_e',
|
||
'M_earth',
|
||
'M_jup',
|
||
'M_jupiter',
|
||
'M_p',
|
||
'M_sun',
|
||
'Ma',
|
||
'Madu',
|
||
'MagUnit',
|
||
'Magnitude',
|
||
'Marcmin',
|
||
'Marcsec',
|
||
'Mau',
|
||
'Mb',
|
||
'Mbarn',
|
||
'Mbeam',
|
||
'Mbin',
|
||
'Mbit',
|
||
'Mbyte',
|
||
'Mcd',
|
||
'Mchan',
|
||
'Mcount',
|
||
'Mct',
|
||
'Md',
|
||
'Mdeg',
|
||
'Mdyn',
|
||
'MeV',
|
||
'Mearth',
|
||
'Merg',
|
||
'Mg',
|
||
'Mh',
|
||
'MiB',
|
||
'Mib',
|
||
'Mibit',
|
||
'Mibyte',
|
||
'Mjup',
|
||
'Mjupiter',
|
||
'Mk',
|
||
'Ml',
|
||
'Mlm',
|
||
'Mlx',
|
||
'Mlyr',
|
||
'Mm',
|
||
'Mmag',
|
||
'Mmin',
|
||
'Mmol',
|
||
'Mohm',
|
||
'Mpc',
|
||
'Mph',
|
||
'Mphoton',
|
||
'Mpix',
|
||
'Mpixel',
|
||
'Mrad',
|
||
'Ms',
|
||
'Msr',
|
||
'Msun',
|
||
'Mu',
|
||
'Mvox',
|
||
'Mvoxel',
|
||
'Myr',
|
||
'N',
|
||
'NamedUnit',
|
||
'Newton',
|
||
'Ohm',
|
||
'P',
|
||
'PA',
|
||
'PAU',
|
||
'PB',
|
||
'PBa',
|
||
'PC',
|
||
'PD',
|
||
'PF',
|
||
'PG',
|
||
'PGal',
|
||
'PH',
|
||
'PHz',
|
||
'PJ',
|
||
'PJy',
|
||
'PK',
|
||
'PL',
|
||
'PN',
|
||
'POhm',
|
||
'PP',
|
||
'PPa',
|
||
'PR',
|
||
'PRy',
|
||
'PS',
|
||
'PSt',
|
||
'PT',
|
||
'PV',
|
||
'PW',
|
||
'PWb',
|
||
'Pa',
|
||
'Padu',
|
||
'Parcmin',
|
||
'Parcsec',
|
||
'Pascal',
|
||
'Pau',
|
||
'Pb',
|
||
'Pbarn',
|
||
'Pbeam',
|
||
'Pbin',
|
||
'Pbit',
|
||
'Pbyte',
|
||
'Pcd',
|
||
'Pchan',
|
||
'Pcount',
|
||
'Pct',
|
||
'Pd',
|
||
'Pdeg',
|
||
'Pdyn',
|
||
'PeV',
|
||
'Perg',
|
||
'Pg',
|
||
'Ph',
|
||
'PiB',
|
||
'Pib',
|
||
'Pibit',
|
||
'Pibyte',
|
||
'Pk',
|
||
'Pl',
|
||
'Plm',
|
||
'Plx',
|
||
'Plyr',
|
||
'Pm',
|
||
'Pmag',
|
||
'Pmin',
|
||
'Pmol',
|
||
'Pohm',
|
||
'Ppc',
|
||
'Pph',
|
||
'Pphoton',
|
||
'Ppix',
|
||
'Ppixel',
|
||
'Prad',
|
||
'PrefixUnit',
|
||
'Ps',
|
||
'Psr',
|
||
'Pu',
|
||
'Pvox',
|
||
'Pvoxel',
|
||
'Pyr',
|
||
'Quantity',
|
||
'QuantityInfo',
|
||
'QuantityInfoBase',
|
||
'R',
|
||
'R_earth',
|
||
'R_jup',
|
||
'R_jupiter',
|
||
'R_sun',
|
||
'Rayleigh',
|
||
'Rearth',
|
||
'Rjup',
|
||
'Rjupiter',
|
||
'Rsun',
|
||
'Ry',
|
||
'S',
|
||
'ST',
|
||
'STflux',
|
||
'STmag',
|
||
'Siemens',
|
||
'SpecificTypeQuantity',
|
||
'St',
|
||
'Sun',
|
||
'T',
|
||
'TA',
|
||
'TAU',
|
||
'TB',
|
||
'TBa',
|
||
'TC',
|
||
'TD',
|
||
'TF',
|
||
'TG',
|
||
'TGal',
|
||
'TH',
|
||
'THz',
|
||
'TJ',
|
||
'TJy',
|
||
'TK',
|
||
'TL',
|
||
'TN',
|
||
'TOhm',
|
||
'TP',
|
||
'TPa',
|
||
'TR',
|
||
'TRy',
|
||
'TS',
|
||
'TSt',
|
||
'TT',
|
||
'TV',
|
||
'TW',
|
||
'TWb',
|
||
'Ta',
|
||
'Tadu',
|
||
'Tarcmin',
|
||
'Tarcsec',
|
||
'Tau',
|
||
'Tb',
|
||
'Tbarn',
|
||
'Tbeam',
|
||
'Tbin',
|
||
'Tbit',
|
||
'Tbyte',
|
||
'Tcd',
|
||
'Tchan',
|
||
'Tcount',
|
||
'Tct',
|
||
'Td',
|
||
'Tdeg',
|
||
'Tdyn',
|
||
'TeV',
|
||
'Terg',
|
||
'Tesla',
|
||
'Tg',
|
||
'Th',
|
||
'TiB',
|
||
'Tib',
|
||
'Tibit',
|
||
'Tibyte',
|
||
'Tk',
|
||
'Tl',
|
||
'Tlm',
|
||
'Tlx',
|
||
'Tlyr',
|
||
'Tm',
|
||
'Tmag',
|
||
'Tmin',
|
||
'Tmol',
|
||
'Tohm',
|
||
'Tpc',
|
||
'Tph',
|
||
'Tphoton',
|
||
'Tpix',
|
||
'Tpixel',
|
||
'Trad',
|
||
'Ts',
|
||
'Tsr',
|
||
'Tu',
|
||
'Tvox',
|
||
'Tvoxel',
|
||
'Tyr',
|
||
'Unit',
|
||
'UnitBase',
|
||
'UnitConversionError',
|
||
'UnitTypeError',
|
||
'UnitsError',
|
||
'UnitsWarning',
|
||
'UnrecognizedUnit',
|
||
'V',
|
||
'Volt',
|
||
'W',
|
||
'Watt',
|
||
'Wb',
|
||
'Weber',
|
||
'YA',
|
||
'YAU',
|
||
'YB',
|
||
'YBa',
|
||
'YC',
|
||
'YD',
|
||
'YF',
|
||
'YG',
|
||
'YGal',
|
||
'YH',
|
||
'YHz',
|
||
'YJ',
|
||
'YJy',
|
||
'YK',
|
||
'YL',
|
||
'YN',
|
||
'YOhm',
|
||
'YP',
|
||
'YPa',
|
||
'YR',
|
||
'YRy',
|
||
'YS',
|
||
'YSt',
|
||
'YT',
|
||
'YV',
|
||
'YW',
|
||
'YWb',
|
||
'Ya',
|
||
'Yadu',
|
||
'Yarcmin',
|
||
'Yarcsec',
|
||
'Yau',
|
||
'Yb',
|
||
'Ybarn',
|
||
'Ybeam',
|
||
'Ybin',
|
||
'Ybit',
|
||
'Ybyte',
|
||
'Ycd',
|
||
'Ychan',
|
||
'Ycount',
|
||
'Yct',
|
||
'Yd',
|
||
'Ydeg',
|
||
'Ydyn',
|
||
'YeV',
|
||
'Yerg',
|
||
'Yg',
|
||
'Yh',
|
||
'Yk',
|
||
'Yl',
|
||
'Ylm',
|
||
'Ylx',
|
||
'Ylyr',
|
||
'Ym',
|
||
'Ymag',
|
||
'Ymin',
|
||
'Ymol',
|
||
'Yohm',
|
||
'Ypc',
|
||
'Yph',
|
||
'Yphoton',
|
||
'Ypix',
|
||
'Ypixel',
|
||
'Yrad',
|
||
'Ys',
|
||
'Ysr',
|
||
'Yu',
|
||
'Yvox',
|
||
'Yvoxel',
|
||
'Yyr',
|
||
'ZA',
|
||
'ZAU',
|
||
'ZB',
|
||
'ZBa',
|
||
'ZC',
|
||
'ZD',
|
||
'ZF',
|
||
'ZG',
|
||
'ZGal',
|
||
'ZH',
|
||
'ZHz',
|
||
'ZJ',
|
||
'ZJy',
|
||
'ZK',
|
||
'ZL',
|
||
'ZN',
|
||
'ZOhm',
|
||
'ZP',
|
||
'ZPa',
|
||
'ZR',
|
||
'ZRy',
|
||
'ZS',
|
||
'ZSt',
|
||
'ZT',
|
||
'ZV',
|
||
'ZW',
|
||
'ZWb',
|
||
'Za',
|
||
'Zadu',
|
||
'Zarcmin',
|
||
'Zarcsec',
|
||
'Zau',
|
||
'Zb',
|
||
'Zbarn',
|
||
'Zbeam',
|
||
'Zbin',
|
||
'Zbit',
|
||
'Zbyte',
|
||
'Zcd',
|
||
'Zchan',
|
||
'Zcount',
|
||
'Zct',
|
||
'Zd',
|
||
'Zdeg',
|
||
'Zdyn',
|
||
'ZeV',
|
||
'Zerg',
|
||
'Zg',
|
||
'Zh',
|
||
'Zk',
|
||
'Zl',
|
||
'Zlm',
|
||
'Zlx',
|
||
'Zlyr',
|
||
'Zm',
|
||
'Zmag',
|
||
'Zmin',
|
||
'Zmol',
|
||
'Zohm',
|
||
'Zpc',
|
||
'Zph',
|
||
'Zphoton',
|
||
'Zpix',
|
||
'Zpixel',
|
||
'Zrad',
|
||
'Zs',
|
||
'Zsr',
|
||
'Zu',
|
||
'Zvox',
|
||
'Zvoxel',
|
||
'Zyr',
|
||
'__builtins__',
|
||
'__cached__',
|
||
'__doc__',
|
||
'__file__',
|
||
'__loader__',
|
||
'__name__',
|
||
'__package__',
|
||
'__path__',
|
||
'__spec__',
|
||
'a',
|
||
'aA',
|
||
'aAU',
|
||
'aB',
|
||
'aBa',
|
||
'aC',
|
||
'aD',
|
||
'aF',
|
||
'aG',
|
||
'aGal',
|
||
'aH',
|
||
'aHz',
|
||
'aJ',
|
||
'aJy',
|
||
'aK',
|
||
'aL',
|
||
'aN',
|
||
'aOhm',
|
||
'aP',
|
||
'aPa',
|
||
'aR',
|
||
'aRy',
|
||
'aS',
|
||
'aSt',
|
||
'aT',
|
||
'aV',
|
||
'aW',
|
||
'aWb',
|
||
'aa',
|
||
'aadu',
|
||
'aarcmin',
|
||
'aarcsec',
|
||
'aau',
|
||
'ab',
|
||
'abA',
|
||
'abC',
|
||
'abampere',
|
||
'abarn',
|
||
'abcoulomb',
|
||
'abeam',
|
||
'abin',
|
||
'abit',
|
||
'abyte',
|
||
'acd',
|
||
'achan',
|
||
'acount',
|
||
'act',
|
||
'ad',
|
||
'add_enabled_equivalencies',
|
||
'add_enabled_units',
|
||
'adeg',
|
||
'adu',
|
||
'adyn',
|
||
'aeV',
|
||
'aerg',
|
||
'ag',
|
||
'ah',
|
||
'ak',
|
||
'al',
|
||
'allclose',
|
||
'alm',
|
||
'alx',
|
||
'alyr',
|
||
'am',
|
||
'amag',
|
||
'amin',
|
||
'amol',
|
||
'amp',
|
||
'ampere',
|
||
'angstrom',
|
||
'annum',
|
||
'aohm',
|
||
'apc',
|
||
'aph',
|
||
'aphoton',
|
||
'apix',
|
||
'apixel',
|
||
'arad',
|
||
'arcmin',
|
||
'arcminute',
|
||
'arcsec',
|
||
'arcsecond',
|
||
'asr',
|
||
'astronomical_unit',
|
||
'astrophys',
|
||
'attoBarye',
|
||
'attoDa',
|
||
'attoDalton',
|
||
'attoDebye',
|
||
'attoFarad',
|
||
'attoGauss',
|
||
'attoHenry',
|
||
'attoHertz',
|
||
'attoJansky',
|
||
'attoJoule',
|
||
'attoKayser',
|
||
'attoKelvin',
|
||
'attoNewton',
|
||
'attoOhm',
|
||
'attoPascal',
|
||
'attoRayleigh',
|
||
'attoSiemens',
|
||
'attoTesla',
|
||
'attoVolt',
|
||
'attoWatt',
|
||
'attoWeber',
|
||
'attoamp',
|
||
'attoampere',
|
||
'attoannum',
|
||
'attoarcminute',
|
||
'attoarcsecond',
|
||
'attoastronomical_unit',
|
||
'attobarn',
|
||
'attobarye',
|
||
'attobit',
|
||
'attobyte',
|
||
'attocandela',
|
||
'attocoulomb',
|
||
'attocount',
|
||
'attoday',
|
||
'attodebye',
|
||
'attodegree',
|
||
'attodyne',
|
||
'attoelectronvolt',
|
||
'attofarad',
|
||
'attogal',
|
||
'attogauss',
|
||
'attogram',
|
||
'attohenry',
|
||
'attohertz',
|
||
'attohour',
|
||
'attohr',
|
||
'attojansky',
|
||
'attojoule',
|
||
'attokayser',
|
||
'attolightyear',
|
||
'attoliter',
|
||
'attolumen',
|
||
'attolux',
|
||
'attometer',
|
||
'attominute',
|
||
'attomole',
|
||
'attonewton',
|
||
'attoparsec',
|
||
'attopascal',
|
||
'attophoton',
|
||
'attopixel',
|
||
'attopoise',
|
||
'attoradian',
|
||
'attorayleigh',
|
||
'attorydberg',
|
||
'attosecond',
|
||
'attosiemens',
|
||
'attosteradian',
|
||
'attostokes',
|
||
'attotesla',
|
||
'attovolt',
|
||
'attovoxel',
|
||
'attowatt',
|
||
'attoweber',
|
||
'attoyear',
|
||
'au',
|
||
'avox',
|
||
'avoxel',
|
||
'ayr',
|
||
'b',
|
||
'bar',
|
||
'barn',
|
||
'barye',
|
||
'beam',
|
||
'beam_angular_area',
|
||
'becquerel',
|
||
'bin',
|
||
'binary_prefixes',
|
||
'bit',
|
||
'bol',
|
||
'brightness_temperature',
|
||
'byte',
|
||
'cA',
|
||
'cAU',
|
||
'cB',
|
||
'cBa',
|
||
'cC',
|
||
'cD',
|
||
'cF',
|
||
'cG',
|
||
'cGal',
|
||
'cH',
|
||
'cHz',
|
||
'cJ',
|
||
'cJy',
|
||
'cK',
|
||
'cL',
|
||
'cN',
|
||
'cOhm',
|
||
'cP',
|
||
'cPa',
|
||
'cR',
|
||
'cRy',
|
||
'cS',
|
||
'cSt',
|
||
'cT',
|
||
'cV',
|
||
'cW',
|
||
'cWb',
|
||
'ca',
|
||
'cadu',
|
||
'candela',
|
||
'carcmin',
|
||
'carcsec',
|
||
'cau',
|
||
'cb',
|
||
'cbarn',
|
||
'cbeam',
|
||
'cbin',
|
||
'cbit',
|
||
'cbyte',
|
||
'ccd',
|
||
'cchan',
|
||
'ccount',
|
||
'cct',
|
||
'cd',
|
||
'cdeg',
|
||
'cdyn',
|
||
'ceV',
|
||
'centiBarye',
|
||
'centiDa',
|
||
'centiDalton',
|
||
'centiDebye',
|
||
'centiFarad',
|
||
'centiGauss',
|
||
'centiHenry',
|
||
'centiHertz',
|
||
'centiJansky',
|
||
'centiJoule',
|
||
'centiKayser',
|
||
'centiKelvin',
|
||
'centiNewton',
|
||
'centiOhm',
|
||
'centiPascal',
|
||
'centiRayleigh',
|
||
'centiSiemens',
|
||
'centiTesla',
|
||
'centiVolt',
|
||
'centiWatt',
|
||
'centiWeber',
|
||
'centiamp',
|
||
'centiampere',
|
||
'centiannum',
|
||
'centiarcminute',
|
||
'centiarcsecond',
|
||
'centiastronomical_unit',
|
||
'centibarn',
|
||
'centibarye',
|
||
'centibit',
|
||
'centibyte',
|
||
'centicandela',
|
||
'centicoulomb',
|
||
'centicount',
|
||
'centiday',
|
||
'centidebye',
|
||
'centidegree',
|
||
'centidyne',
|
||
'centielectronvolt',
|
||
'centifarad',
|
||
'centigal',
|
||
'centigauss',
|
||
'centigram',
|
||
'centihenry',
|
||
'centihertz',
|
||
'centihour',
|
||
'centihr',
|
||
'centijansky',
|
||
'centijoule',
|
||
'centikayser',
|
||
'centilightyear',
|
||
'centiliter',
|
||
'centilumen',
|
||
'centilux',
|
||
'centimeter',
|
||
'centiminute',
|
||
'centimole',
|
||
'centinewton',
|
||
'centiparsec',
|
||
'centipascal',
|
||
'centiphoton',
|
||
'centipixel',
|
||
'centipoise',
|
||
'centiradian',
|
||
'centirayleigh',
|
||
'centirydberg',
|
||
'centisecond',
|
||
'centisiemens',
|
||
'centisteradian',
|
||
'centistokes',
|
||
'centitesla',
|
||
'centivolt',
|
||
'centivoxel',
|
||
'centiwatt',
|
||
'centiweber',
|
||
'centiyear',
|
||
'cerg',
|
||
'cg',
|
||
'cgs',
|
||
'ch',
|
||
'chan',
|
||
'ck',
|
||
'cl',
|
||
'clm',
|
||
'clx',
|
||
'clyr',
|
||
'cm',
|
||
'cmag',
|
||
'cmin',
|
||
'cmol',
|
||
'cohm',
|
||
'core',
|
||
'coulomb',
|
||
'count',
|
||
'cpc',
|
||
'cph',
|
||
'cphoton',
|
||
'cpix',
|
||
'cpixel',
|
||
'crad',
|
||
'cs',
|
||
'csr',
|
||
'ct',
|
||
'cu',
|
||
'curie',
|
||
'cvox',
|
||
'cvoxel',
|
||
'cy',
|
||
'cycle',
|
||
'cyr',
|
||
'd',
|
||
'dA',
|
||
'dAU',
|
||
'dB',
|
||
'dBa',
|
||
'dC',
|
||
'dD',
|
||
'dF',
|
||
'dG',
|
||
'dGal',
|
||
'dH',
|
||
'dHz',
|
||
'dJ',
|
||
'dJy',
|
||
'dK',
|
||
'dL',
|
||
'dN',
|
||
'dOhm',
|
||
'dP',
|
||
'dPa',
|
||
'dR',
|
||
'dRy',
|
||
'dS',
|
||
'dSt',
|
||
'dT',
|
||
...]
|
||
</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">coord</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">coord</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">coord</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 we’ll select a rectangle from -55 to -45 degrees right ascension and -8 to 4 degrees of declination.</p>
|
||
<p>We’ll 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, we’ll 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><GD1Koposov10 Coordinate: (phi1, phi2) in deg
|
||
[(-55., -8.), (-55., 4.), (-45., 4.), (-45., -8.)]>
|
||
</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><ICRS Coordinate: (ra, dec) in deg
|
||
[(146.27533314, 19.26190982), (135.42163944, 25.87738723),
|
||
(141.60264825, 34.3048303 ), (152.81671045, 27.13611254)]>
|
||
</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">"""</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">"""</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><ICRS Coordinate: (ra, dec) in deg
|
||
(146.27533314, 19.26190982)>
|
||
<ICRS Coordinate: (ra, dec) in deg
|
||
(135.42163944, 25.87738723)>
|
||
<ICRS Coordinate: (ra, dec) in deg
|
||
(141.60264825, 34.3048303)>
|
||
<ICRS Coordinate: (ra, dec) in deg
|
||
(152.81671045, 27.13611254)>
|
||
</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">"</span><span class="si">{point.ra.value}</span><span class="s2">, </span><span class="si">{point.dec.value}</span><span class="s2">"</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>['146.27533313607782, 19.261909820533692',
|
||
'135.42163944306296, 25.87738722767213',
|
||
'141.60264825107333, 34.304830296257144',
|
||
'152.81671044675923, 27.136112541397996']
|
||
</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">', '</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>'146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996'
|
||
</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">'source_id, ra, dec, pmra, pmdec, parallax, parallax_error, radial_velocity'</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>Here’s 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">"""SELECT </span><span class="si">{columns}</span><span class="s2"></span>
|
||
<span class="s2">FROM gaiadr2.gaia_source</span>
|
||
<span class="s2">WHERE parallax < 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">"""</span>
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>And here’s 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 < 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]
|
||
<Table length=140340>
|
||
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: 1603114980658O
|
||
Phase: COMPLETED
|
||
Owner: None
|
||
Output file: async_20201019094300.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 that’s 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 we’ll 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">'gd1_results.fits'</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 Oct 19 09:43 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, we’ll 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 don’t 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">Chapter 1</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/>
|
||
|
||
© Copyright 2020.<br/>
|
||
</p>
|
||
</div>
|
||
</footer>
|
||
</main>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<script src="_static/js/index.30270b6e4c972e43c488.js"></script>
|
||
|
||
|
||
|
||
</body>
|
||
</html> |