Update documentation

This commit is contained in:
Allen Downey
2020-12-29 11:59:26 -05:00
parent 90189fd014
commit fa6a57e9cb
38 changed files with 2769 additions and 3558 deletions

View File

@@ -595,7 +595,7 @@ Parsing table 'gaiadr2.gaia_source'...
Done. Done.
</pre></div> </pre></div>
</div> </div>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;astroquery.utils.tap.model.taptable.TapTableMeta at 0x7eff7a9d80a0&gt; <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;astroquery.utils.tap.model.taptable.TapTableMeta at 0x7f2e23f089d0&gt;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -751,7 +751,77 @@ To find out what the columns mean, <a class="reference external" href="https://g
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>obj_name <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Retrieving table &#39;gaiadr2.panstarrs1_original_valid&#39;
Parsing table &#39;gaiadr2.panstarrs1_original_valid&#39;...
Done.
TAP Table name: gaiadr2.gaiadr2.panstarrs1_original_valid
Description: The Panoramic Survey Telescope and Rapid Response System (Pan-STARRS) is
a system for wide-field astronomical imaging developed and operated by
the Institute for Astronomy at the University of Hawaii. Pan-STARRS1
(PS1) is the first part of Pan-STARRS to be completed and is the basis
for Data Release 1 (DR1). The PS1 survey used a 1.8 meter telescope and
its 1.4 Gigapixel camera to image the sky in five broadband filters (g,
r, i, z, y).
The current table contains a filtered subsample of the 10723304629
entries listed in the original ObjectThin table.
We used only ObjectThin and MeanObject tables to extract
panstarrs1OriginalValid table, this means that objects detected only in
stack images are not included here. The main reason for us to avoid the
use of objects detected in stack images is that their astrometry is not
as good as the mean objects astrometry: “The stack positions (raStack,
decStack) have considerably larger systematic astrometric errors than
the mean epoch positions (raMean, decMean).” The astrometry for the
MeanObject positions uses Gaia DR1 as a reference catalog, while the
stack positions use 2MASS as a reference catalog.
In details, we filtered out all objects where:
- nDetections = 1
- no good quality data in Pan-STARRS, objInfoFlag 33554432 not set
- mean astrometry could not be measured, objInfoFlag 524288 set
- stack position used for mean astrometry, objInfoFlag 1048576 set
- error on all magnitudes equal to 0 or to -999;
- all magnitudes set to -999;
- error on RA or DEC greater than 1 arcsec.
The number of objects in panstarrs1OriginalValid is 2264263282.
The panstarrs1OriginalValid table contains only a subset of the columns
available in the combined ObjectThin and MeanObject tables. A
description of the original ObjectThin and MeanObjects tables can be
found at:
https://outerspace.stsci.edu/display/PANSTARRS/PS1+Database+object+and+detection+tables
Download:
http://mastweb.stsci.edu/ps1casjobs/home.aspx
Documentation:
https://outerspace.stsci.edu/display/PANSTARRS
http://pswww.ifa.hawaii.edu/pswww/
References:
The Pan-STARRS1 Surveys, Chambers, K.C., et al. 2016, arXiv:1612.05560
Pan-STARRS Data Processing System, Magnier, E. A., et al. 2016,
arXiv:1612.05240
Pan-STARRS Pixel Processing: Detrending, Warping, Stacking, Waters, C.
Z., et al. 2016, arXiv:1612.05245
Pan-STARRS Pixel Analysis: Source Detection and Characterization,
Magnier, E. A., et al. 2016, arXiv:1612.05244
Pan-STARRS Photometric and Astrometric Calibration, Magnier, E. A., et
al. 2016, arXiv:1612.05242
The Pan-STARRS1 Database and Data Products, Flewelling, H. A., et al.
2016, arXiv:1612.05243
Catalogue curator:
SSDC - ASI Space Science Data Center
https://www.ssdc.asi.it/
Num. columns: 26
obj_name
obj_id obj_id
ra ra
dec dec
@@ -816,7 +886,7 @@ quality_flag
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;astroquery.utils.tap.model.job.Job at 0x7eff7aa87d00&gt; <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;astroquery.utils.tap.model.job.Job at 0x7f2e23f2afa0&gt;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -837,11 +907,11 @@ source_id int64 Unique source identifier (unique within a particular Data
ref_epoch float64 yr Reference epoch 0 ref_epoch float64 yr Reference epoch 0
ra float64 deg Right ascension 0 ra float64 deg Right ascension 0
dec float64 deg Declination 0 dec float64 deg Declination 0
parallax float64 mas Parallax 5 parallax float64 mas Parallax 2
Jobid: None Jobid: None
Phase: COMPLETED Phase: COMPLETED
Owner: None Owner: None
Output file: sync_20201203154608.xml.gz Output file: sync_20201229114647.xml.gz
Results: None Results: None
</pre></div> </pre></div>
</div> </div>
@@ -877,20 +947,20 @@ Results: None
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=10</i> <div class="output text_html"><i>Table length=10</i>
<table id="table139635743203392" class="table-striped table-bordered table-condensed"> <table id="table139836148327136" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead> <thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>
<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead> <thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead> <thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>
<tr><td>5958819901197208576</td><td>2015.5</td><td>261.7857283398199</td><td>-42.03004488213482</td><td>-0.5002044267802102</td></tr> <tr><td>6758509757594141440</td><td>2015.5</td><td>290.4899010727352</td><td>-30.34317218420783</td><td>0.48023816159705535</td></tr>
<tr><td>5958821378666779136</td><td>2015.5</td><td>261.62657416766683</td><td>-42.0248496385989</td><td>--</td></tr> <tr><td>6758508692437976960</td><td>2015.5</td><td>290.64176055082714</td><td>-30.28972013142225</td><td>2.2625971293368154</td></tr>
<tr><td>5958828525443694976</td><td>2015.5</td><td>264.1345018277737</td><td>-43.16302120806172</td><td>--</td></tr> <tr><td>6758527036250849280</td><td>2015.5</td><td>290.35703708993327</td><td>-30.193657826181596</td><td>-0.2763960334229464</td></tr>
<tr><td>5958821103796633472</td><td>2015.5</td><td>261.6583640022332</td><td>-42.036988110447425</td><td>--</td></tr> <tr><td>6758564458298242944</td><td>2015.5</td><td>290.77376294142846</td><td>-29.765368439225238</td><td>0.5907906528352993</td></tr>
<tr><td>5958823886946980352</td><td>2015.5</td><td>261.65568041401264</td><td>-41.922401166547274</td><td>--</td></tr> <tr><td>6758558612842155776</td><td>2015.5</td><td>290.67550630386245</td><td>-29.92113396078169</td><td>0.2858563565989917</td></tr>
<tr><td>5958822890506247552</td><td>2015.5</td><td>261.55820707086946</td><td>-41.95720763183602</td><td>--</td></tr> <tr><td>6758556379459921920</td><td>2015.5</td><td>290.5454006212404</td><td>-29.900709054816964</td><td>-1.0012355835832834</td></tr>
<tr><td>5958825944161775616</td><td>2015.5</td><td>264.1886024158743</td><td>-43.322283668549964</td><td>0.3111803012975799</td></tr> <tr><td>6758537520260385152</td><td>2015.5</td><td>290.7341683169994</td><td>-30.158181298418626</td><td>--</td></tr>
<tr><td>5958839726713099904</td><td>2015.5</td><td>263.94936860247236</td><td>-42.99642220007396</td><td>0.34188414063767153</td></tr> <tr><td>6758506355980010624</td><td>2015.5</td><td>290.586950869878</td><td>-30.37137642167569</td><td>0.3769870991981157</td></tr>
<tr><td>5958828559794975744</td><td>2015.5</td><td>264.1060944261551</td><td>-43.24271464140307</td><td>0.19982119290900674</td></tr> <tr><td>6758561606433968128</td><td>2015.5</td><td>290.82697136098506</td><td>-29.75247697212053</td><td>--</td></tr>
<tr><td>5958831720947299072</td><td>2015.5</td><td>263.9019720829655</td><td>-43.154506897707854</td><td>0.7055097280886358</td></tr> <tr><td>6758564183414408448</td><td>2015.5</td><td>290.7133096669958</td><td>-29.781743673679607</td><td>0.9376387942856869</td></tr>
</table></div></div> </table></div></div>
</div> </div>
<p>Each column has a name, units, and a data type.</p> <p>Each column has a name, units, and a data type.</p>
@@ -950,10 +1020,10 @@ ref_epoch float64 yr Refere
ra float64 deg Right ascension ra float64 deg Right ascension
dec float64 deg Declination dec float64 deg Declination
parallax float64 mas Parallax parallax float64 mas Parallax
Jobid: 1607028117072O Jobid: 1609260407863O
Phase: COMPLETED Phase: COMPLETED
Owner: None Owner: None
Output file: async_20201203154157.vot Output file: async_20201229114648.vot
Results: None Results: None
</pre></div> </pre></div>
</div> </div>
@@ -969,30 +1039,30 @@ Results: None
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=3000</i> <div class="output text_html"><i>Table length=3000</i>
<table id="table139635740092688" class="table-striped table-bordered table-condensed"> <table id="table139836145366016" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead> <thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>
<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead> <thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead> <thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>
<tr><td>6101968476761520256</td><td>2015.5</td><td>222.97412023194306</td><td>-40.712359294192744</td><td>0.9580315447630948</td></tr> <tr><td>6758509757594141440</td><td>2015.5</td><td>290.4899010727352</td><td>-30.34317218420783</td><td>0.48023816159705535</td></tr>
<tr><td>6102006203756731136</td><td>2015.5</td><td>223.3837572031525</td><td>-40.18295977800455</td><td>0.4654078698855609</td></tr> <tr><td>6758527036250849280</td><td>2015.5</td><td>290.35703708993327</td><td>-30.193657826181596</td><td>-0.2763960334229464</td></tr>
<tr><td>6101999537971250816</td><td>2015.5</td><td>223.39452656831827</td><td>-40.38078271831785</td><td>0.6324535932708285</td></tr> <tr><td>6758564458298242944</td><td>2015.5</td><td>290.77376294142846</td><td>-29.765368439225238</td><td>0.5907906528352993</td></tr>
<tr><td>6101989230045046912</td><td>2015.5</td><td>222.9349537562596</td><td>-40.30216757702745</td><td>-0.1120282976060022</td></tr> <tr><td>6758558612842155776</td><td>2015.5</td><td>290.67550630386245</td><td>-29.92113396078169</td><td>0.2858563565989917</td></tr>
<tr><td>6102019432256470144</td><td>2015.5</td><td>223.2987634951956</td><td>-40.07122353409279</td><td>0.4252570435065329</td></tr> <tr><td>6758556379459921920</td><td>2015.5</td><td>290.5454006212404</td><td>-29.900709054816964</td><td>-1.0012355835832834</td></tr>
<tr><td>6101990020319424768</td><td>2015.5</td><td>222.89497451675032</td><td>-40.29644668414232</td><td>-0.5473391189616934</td></tr> <tr><td>6758506355980010624</td><td>2015.5</td><td>290.586950869878</td><td>-30.37137642167569</td><td>0.3769870991981157</td></tr>
<tr><td>6102009914608095744</td><td>2015.5</td><td>223.08065715961308</td><td>-40.2690582632144</td><td>-0.37215204032841775</td></tr> <tr><td>6758564183414408448</td><td>2015.5</td><td>290.7133096669958</td><td>-29.781743673679607</td><td>0.9376387942856869</td></tr>
<tr><td>6101991463427276160</td><td>2015.5</td><td>223.29761379788724</td><td>-40.50754907738312</td><td>0.845560802664492</td></tr> <tr><td>6758529789322653184</td><td>2015.5</td><td>290.35449465190385</td><td>-30.10231481465004</td><td>-1.3305133038319952</td></tr>
<tr><td>6102028571944992000</td><td>2015.5</td><td>222.70417749659205</td><td>-40.42670615599747</td><td>-0.6195307007338599</td></tr> <tr><td>6758507485555336064</td><td>2015.5</td><td>290.6745961953205</td><td>-30.35965148061028</td><td>0.057302711920868686</td></tr>
<tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr> <tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr>
<tr><td>2266125732937920640</td><td>2015.5</td><td>282.3511779667985</td><td>72.58152826290214</td><td>0.611248163129301</td></tr> <tr><td>4660464894038295424</td><td>2015.5</td><td>79.74509945051724</td><td>-66.49656012737759</td><td>0.1631257821260955</td></tr>
<tr><td>2266098932341998336</td><td>2015.5</td><td>282.4753368202474</td><td>72.42703933645112</td><td>-0.07096965217830103</td></tr> <tr><td>4660463519650480128</td><td>2015.5</td><td>80.06150680482719</td><td>-66.42891601595986</td><td>-0.5822669736733328</td></tr>
<tr><td>5844916131519471872</td><td>2015.5</td><td>192.9660362377181</td><td>-69.57840395657252</td><td>0.3439372751682742</td></tr> <tr><td>4660487674554071040</td><td>2015.5</td><td>80.03536662790846</td><td>-66.33136792885134</td><td>-1.4978065466579966</td></tr>
<tr><td>5844905857953792768</td><td>2015.5</td><td>193.68288866724032</td><td>-69.49181695753501</td><td>0.07481443392415044</td></tr> <tr><td>4660494718300886784</td><td>2015.5</td><td>79.6181997343967</td><td>-66.17472335318212</td><td>0.1488652133861382</td></tr>
<tr><td>5844885242102786688</td><td>2015.5</td><td>194.6557957952714</td><td>-69.47882731331919</td><td>0.34993373247988196</td></tr> <tr><td>4660476473274159360</td><td>2015.5</td><td>79.12508291180023</td><td>-66.35644844757275</td><td>0.10671540523101529</td></tr>
<tr><td>5844898882924614272</td><td>2015.5</td><td>193.25908185345685</td><td>-69.73387320199522</td><td>0.8081386490572667</td></tr> <tr><td>4660471010093940224</td><td>2015.5</td><td>79.1908378165463</td><td>-66.48916840294096</td><td>0.8152150079365807</td></tr>
<tr><td>5844868680708131712</td><td>2015.5</td><td>194.68567535488484</td><td>-69.6114926600852</td><td>0.8402524443841332</td></tr> <tr><td>4660498394807167744</td><td>2015.5</td><td>80.23431532382547</td><td>-66.08688681815092</td><td>-0.14060596426163252</td></tr>
<tr><td>5844898814205127552</td><td>2015.5</td><td>193.29020065769623</td><td>-69.74069115214805</td><td>0.10499541379687834</td></tr> <tr><td>4660498738391722880</td><td>2015.5</td><td>80.20205898946918</td><td>-66.04392313295126</td><td>0.1894642263668475</td></tr>
<tr><td>5844874728027086336</td><td>2015.5</td><td>195.95342635179594</td><td>-69.43994738640447</td><td>-0.8998207133359908</td></tr> <tr><td>4660474068091096960</td><td>2015.5</td><td>78.93686107060341</td><td>-66.45795576745896</td><td>0.4665513634059366</td></tr>
<tr><td>5844875174699986048</td><td>2015.5</td><td>195.7213758541214</td><td>-69.45438843217347</td><td>0.04510342308702224</td></tr> <tr><td>4660437303162697728</td><td>2015.5</td><td>80.63872120225027</td><td>-66.46144560233674</td><td>-1.1319163320535979</td></tr>
</table></div></div> </table></div></div>
</div> </div>
<p>You might notice that some values of <code class="docutils literal notranslate"><span class="pre">parallax</span></code> are negative. As <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/archive-tips#negative%20parallax">this FAQ explains</a>, “Negative parallaxes are caused by errors in the observations.” Negative parallaxes have “no physical meaning,” but they can be a “useful diagnostic on the quality of the astrometric solution.”</p> <p>You might notice that some values of <code class="docutils literal notranslate"><span class="pre">parallax</span></code> are negative. As <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/archive-tips#negative%20parallax">this FAQ explains</a>, “Negative parallaxes are caused by errors in the observations.” Negative parallaxes have “no physical meaning,” but they can be a “useful diagnostic on the quality of the astrometric solution.”</p>
@@ -1098,7 +1168,7 @@ Be careful to keep your Python out of your ADQL!</p>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(None, &#39;1607028117072O&#39;) <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(None, &#39;1609260407863O&#39;)
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1111,7 +1181,7 @@ Be careful to keep your Python out of your ADQL!</p>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Removed jobs: &#39;[&#39;1607028117072O&#39;]&#39;. <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>Removed jobs: &#39;[&#39;1609260407863O&#39;]&#39;.
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1203,11 +1273,11 @@ WHERE parallax &lt; 1
pmra float64 mas / yr Proper motion in right ascension direction 0 pmra float64 mas / yr Proper motion in right ascension direction 0
pmdec float64 mas / yr Proper motion in declination direction 0 pmdec float64 mas / yr Proper motion in declination direction 0
parallax float64 mas Parallax 0 parallax float64 mas Parallax 0
radial_velocity float64 km / s Radial velocity 9 radial_velocity float64 km / s Radial velocity 10
Jobid: None Jobid: None
Phase: COMPLETED Phase: COMPLETED
Owner: None Owner: None
Output file: sync_20201203155727.xml.gz Output file: sync_20201229114653.xml.gz
Results: None Results: None
</pre></div> </pre></div>
</div> </div>
@@ -1222,20 +1292,20 @@ Results: None
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=10</i> <div class="output text_html"><i>Table length=10</i>
<table id="table139635739621120" class="table-striped table-bordered table-condensed"> <table id="table139836148327184" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>radial_velocity</th></tr></thead> <thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>radial_velocity</th></tr></thead>
<thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>km / s</th></tr></thead> <thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>km / s</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead> <thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>
<tr><td>5933096203842096896</td><td>243.78205426182762</td><td>-53.059795438840304</td><td>-2.424817873751699</td><td>-4.466522248547865</td><td>0.5068567863750518</td><td>-42.33885843170957</td></tr> <tr><td>4660466371507774848</td><td>79.49100199261952</td><td>-66.41411777672668</td><td>2.6073927760139983</td><td>-1.1968907801968522</td><td>-0.13534455558687877</td><td>--</td></tr>
<tr><td>5933101877528899712</td><td>243.97057838444422</td><td>-52.986714478669484</td><td>-2.1222196983029993</td><td>-3.0754927489169264</td><td>0.23373208336686707</td><td>--</td></tr> <tr><td>4660498704031984000</td><td>80.19346436358076</td><td>-66.04907675232856</td><td>1.644062563874402</td><td>-1.954975321006136</td><td>-0.1774586376397</td><td>--</td></tr>
<tr><td>5933092909682644736</td><td>243.79077939157932</td><td>-53.210873915640164</td><td>-3.247331739283727</td><td>-3.0721472876242912</td><td>0.22141430054832106</td><td>--</td></tr> <tr><td>4660458949824817024</td><td>79.68666778641992</td><td>-66.52220959662557</td><td>1.4777697275880581</td><td>0.3328961930362448</td><td>-0.030149510331454386</td><td>--</td></tr>
<tr><td>5933099403674089344</td><td>244.10992316666963</td><td>-52.99682662964451</td><td>-7.42237468704238</td><td>0.9808177052973058</td><td>-0.5694816136281146</td><td>--</td></tr> <tr><td>4660451974773926528</td><td>79.89972073493868</td><td>-66.75037858071191</td><td>2.4635048563021065</td><td>-0.7474574729840501</td><td>-0.005219591141134416</td><td>--</td></tr>
<tr><td>5933099712864927488</td><td>244.14352482183628</td><td>-53.00718804864607</td><td>-1.8469803654970902</td><td>-2.061311622119096</td><td>-0.15119359534047053</td><td>--</td></tr> <tr><td>4660474033731357056</td><td>78.93214036467484</td><td>-66.46483644591667</td><td>1.2369118132455594</td><td>-1.7187143034638677</td><td>0.6018032937392243</td><td>--</td></tr>
<tr><td>5933100430094343296</td><td>244.05583528078185</td><td>-52.97056623530601</td><td>-2.4175778689836607</td><td>-1.7741006184538501</td><td>0.6126293653016116</td><td>--</td></tr> <tr><td>4660454105077874688</td><td>79.91045649235578</td><td>-66.68106846135971</td><td>1.4747855407533677</td><td>0.022464361420165786</td><td>-0.19949109843083218</td><td>--</td></tr>
<tr><td>5933090195214793088</td><td>244.0040474187424</td><td>-53.2398318316935</td><td>-1.9355723547012178</td><td>-3.2456307745304516</td><td>-0.5994721050902905</td><td>--</td></tr> <tr><td>4660494855753740544</td><td>79.63101881952036</td><td>-66.15063315813536</td><td>1.6227863263222113</td><td>0.20490893261905152</td><td>0.0013030724292998944</td><td>--</td></tr>
<tr><td>5933092359874146816</td><td>243.77339485386585</td><td>-53.25788614096572</td><td>1.205055772227777</td><td>-3.1082961813495587</td><td>-1.5130414932866274</td><td>--</td></tr> <tr><td>4660439536571308160</td><td>80.24817961417894</td><td>-66.46303270664092</td><td>1.8652105429518493</td><td>-0.5618584442373111</td><td>-0.10578442360531497</td><td>--</td></tr>
<tr><td>5933093974783111808</td><td>243.7622231489827</td><td>-53.164944966614065</td><td>-4.665032988958056</td><td>-1.8667474849003503</td><td>-0.0273302633914116</td><td>--</td></tr> <tr><td>4660470185440466560</td><td>79.25942306061864</td><td>-66.51120777549605</td><td>3.373561172003989</td><td>0.25326243152876704</td><td>-0.6932631338638376</td><td>--</td></tr>
<tr><td>4118427651760743808</td><td>264.39377925009563</td><td>-20.39238597203732</td><td>2.5862935758007417</td><td>-1.7887209864551123</td><td>0.4865048585491827</td><td>--</td></tr> <tr><td>4660441460690365568</td><td>80.38862155241748</td><td>-66.34404494135046</td><td>1.6588478675146066</td><td>-0.09646951910977163</td><td>-0.2100859303087445</td><td>--</td></tr>
</table></div></div> </table></div></div>
</div> </div>
<p>Good so far.</p> <p>Good so far.</p>
@@ -1260,6 +1330,15 @@ Results: None
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>SELECT TOP 10
source_id, ref_epoch, ra, dec, parallax
FROM gaiadr2.gaia_source
WHERE parallax &lt; 1
AND bp_rp BETWEEN -0.75 AND 2
</pre></div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -265,6 +265,18 @@
Working with coordinates Working with coordinates
</a> </a>
</li> </li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#transforming-coordinates">
Transforming coordinates
</a>
<ul class="nav section-nav flex-column">
<li class="toc-h3 nav-item toc-entry">
<a class="reference internal nav-link" href="#id1">
Exercise
</a>
</li>
</ul>
</li>
<li class="toc-h2 nav-item toc-entry"> <li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#selecting-a-rectangle"> <a class="reference internal nav-link" href="#selecting-a-rectangle">
Selecting a rectangle Selecting a rectangle
@@ -313,7 +325,7 @@
<p>Then, to select stars in the vicinity of GD-1, well:</p> <p>Then, to select stars in the vicinity of GD-1, well:</p>
<ul class="simple"> <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 <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 Astropy 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>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>Submit a query and download the results.</p></li>
<li><p>Store the results in a FITS file.</p></li> <li><p>Store the results in a FITS file.</p></li>
@@ -357,8 +369,7 @@
<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> <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">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">job</span>
<span class="n">result</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -375,8 +386,21 @@ Created TAP+ (v1.2.1) - Connection:
SSL Port: 443 SSL Port: 443
</pre></div> </pre></div>
</div> </div>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;astroquery.utils.tap.model.job.Job at 0x7f59bd93e490&gt;
</pre></div>
</div>
</div>
</div>
<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">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 text_html"><i>Table length=10</i> <div class="output text_html"><i>Table length=10</i>
<table id="table140686245658336" class="table-striped table-bordered table-condensed"> <table id="table140023409350736" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th></tr></thead> <thead><tr><th>source_id</th></tr></thead>
<thead><tr><th>int64</th></tr></thead> <thead><tr><th>int64</th></tr></thead>
<tr><td>4057468321929794432</td></tr> <tr><td>4057468321929794432</td></tr>
@@ -418,34 +442,30 @@ Created TAP+ (v1.2.1) - Connection:
<h2>Getting GD-1 Data<a class="headerlink" href="#getting-gd-1-data" title="Permalink to this headline"></a></h2> <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> <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" /> <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>The axes of this figure are defined so the x-axis is aligned with the stars in GD-1, and the y-axis is perpendicular.</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> <ul class="simple">
<li><p>Along the x-axis (<span class="math notranslate nohighlight">\(\phi_1\)</span>) the figure extends from -100 to 20 degrees.</p></li>
<li><p>Along the y-axis (<span class="math notranslate nohighlight">\(\phi_2\)</span>) the figure extends from about -8 to 4 degrees.</p></li>
</ul>
<p>Ideally, we would select all stars from this rectangle, but there are more than 10 million of them, so</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"> <ul class="simple">
<li><p>That would be difficult to work with,</p></li> <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>As anonymous Gaia 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> <li><p>While we are developing and testing code, it will be faster to work with a smaller dataset.</p></li>
</ul> </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>So well start by selecting stars in a smaller rectangle near the center of GD-1, from -55 to -45 degrees <span class="math notranslate nohighlight">\(\phi_1\)</span> and -8 to 4 degrees <span class="math notranslate nohighlight">\(\phi_2\)</span>.</p>
<p>But first we lets see how to represent quantities with units like degrees.</p> <p>But first we lets see how to represent quantities with units like degrees.</p>
</div> </div>
<div class="section" id="working-with-coordinates"> <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> <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>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>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>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 catastrophic 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>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> <p>To use Astropy units, we import them like this:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <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> </pre></div>
</div> </div>
</div> </div>
@@ -923,6 +943,7 @@ Created TAP+ (v1.2.1) - Connection:
&#39;Tmin&#39;, &#39;Tmin&#39;,
&#39;Tmol&#39;, &#39;Tmol&#39;,
&#39;Tohm&#39;, &#39;Tohm&#39;,
&#39;Torr&#39;,
&#39;Tpc&#39;, &#39;Tpc&#39;,
&#39;Tph&#39;, &#39;Tph&#39;,
&#39;Tphoton&#39;, &#39;Tphoton&#39;,
@@ -1458,7 +1479,6 @@ Created TAP+ (v1.2.1) - Connection:
&#39;dRy&#39;, &#39;dRy&#39;,
&#39;dS&#39;, &#39;dS&#39;,
&#39;dSt&#39;, &#39;dSt&#39;,
&#39;dT&#39;,
...] ...]
</pre></div> </pre></div>
</div> </div>
@@ -1467,8 +1487,8 @@ Created TAP+ (v1.2.1) - Connection:
<p>To create a quantity, we multiply a value by a unit.</p> <p>To create a quantity, we multiply a value by a unit.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">quantity</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">degree</span>
<span class="nb">type</span><span class="p">(</span><span class="n">coordinate</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">quantity</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1482,7 +1502,7 @@ Created TAP+ (v1.2.1) - Connection:
<p>Jupyter knows how to display <code class="docutils literal notranslate"><span class="pre">Quantities</span></code> like this:</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 docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">coordinate</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">quantity</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1492,16 +1512,121 @@ Created TAP+ (v1.2.1) - Connection:
</div> </div>
</div> </div>
</div> </div>
<div class="section" id="selecting-a-rectangle"> <div class="section" id="transforming-coordinates">
<h2>Selecting a rectangle<a class="headerlink" href="#selecting-a-rectangle" title="Permalink to this headline"></a></h2> <h2>Transforming coordinates<a class="headerlink" href="#transforming-coordinates" 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>Astropy provides a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object that represents sky coordinates relative to a specified frame.</p>
<p>Well define variables to contain these limits.</p> <p>The following example creates a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object that represents the approximate coordinates of <a class="reference external" href="http://simbad.u-strasbg.fr/simbad/sim-basic?Ident=Betelgeuse">Betelgeuse</a> (alf Ori) in the ICRS frame.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">astropy.coordinates</span> <span class="kn">import</span> <span class="n">SkyCoord</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">ra</span> <span class="o">=</span> <span class="mf">88.8</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mi">4</span> <span class="n">dec</span> <span class="o">=</span> <span class="mf">7.4</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">coord_icrs</span> <span class="o">=</span> <span class="n">SkyCoord</span><span class="p">(</span><span class="n">ra</span><span class="o">=</span><span class="n">ra</span><span class="p">,</span> <span class="n">dec</span><span class="o">=</span><span class="n">dec</span><span class="p">,</span> <span class="n">frame</span><span class="o">=</span><span class="s1">&#39;icrs&#39;</span><span class="p">)</span>
<span class="n">coord_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;SkyCoord (ICRS): (ra, dec) in deg
(88.8, 7.4)&gt;
</pre></div>
</div>
</div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> provides a function that transforms to other frames.
For example, we can transform <code class="docutils literal notranslate"><span class="pre">coords_icrs</span></code> to Galactic coordinates 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_galactic</span> <span class="o">=</span> <span class="n">coord_icrs</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="s1">&#39;galactic&#39;</span><span class="p">)</span>
<span class="n">coord_galactic</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;SkyCoord (Galactic): (l, b) in deg
(199.79693102, -8.95591653)&gt;
</pre></div>
</div>
</div>
</div>
<p>To transform to and from GD-1 coordinates, well use a frame defined by <a class="reference external" href="https://gala-astro.readthedocs.io/en/latest/">Gala</a>, which is an Astropy-affiliated library that provides tools for galactic dynamics.</p>
<p>Gala provides <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code>, which is “<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 GD-1 stream</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">from</span> <span class="nn">gala.coordinates</span> <span class="kn">import</span> <span class="n">GD1Koposov10</span>
<span class="n">gd1_frame</span> <span class="o">=</span> <span class="n">GD1Koposov10</span><span class="p">()</span>
<span class="n">gd1_frame</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 Frame&gt;
</pre></div>
</div>
</div>
</div>
<p>We can use it to find the coordinates of Betelgeuse in the GD-1 frame, 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_gd1</span> <span class="o">=</span> <span class="n">coord_icrs</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">gd1_frame</span><span class="p">)</span>
<span class="n">coord_gd1</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;SkyCoord (GD1Koposov10): (phi1, phi2) in deg
(-94.97222038, 34.5813813)&gt;
</pre></div>
</div>
</div>
</div>
<div class="section" id="id1">
<h3>Exercise<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<p>Lets find the location of GD-1 in ICRS coordinates.</p>
<ol class="simple">
<li><p>Create a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object at 0°, 0° in the GD-1 frame.</p></li>
<li><p>Transform it to the ICRS frame.</p></li>
</ol>
<p>Hint: Because ICRS is built into Astropy, you can specify it by name, <code class="docutils literal notranslate"><span class="pre">icrs</span></code> (as we did with <code class="docutils literal notranslate"><span class="pre">galactic</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="c1"># Solution</span>
<span class="n">coord_gd1</span> <span class="o">=</span> <span class="n">SkyCoord</span><span class="p">(</span><span class="mi">0</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">degree</span><span class="p">,</span> <span class="mi">0</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">degree</span><span class="p">,</span> <span class="n">frame</span><span class="o">=</span><span class="n">gd1_frame</span><span class="p">)</span>
<span class="c1"># Note: because ICRS is built into Astropy, </span>
<span class="c1"># we can identify it by name</span>
<span class="n">coord_gd1</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="s1">&#39;icrs&#39;</span><span class="p">)</span>
<span class="c1"># More formally, we could instantiate it</span>
<span class="kn">from</span> <span class="nn">astropy.coordinates</span> <span class="kn">import</span> <span class="n">ICRS</span>
<span class="n">icrs_frame</span> <span class="o">=</span> <span class="n">ICRS</span><span class="p">()</span>
<span class="n">coord_gd1</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">icrs_frame</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>&lt;SkyCoord (ICRS): (ra, dec) in deg
(200., 59.4504341)&gt;
</pre></div>
</div>
</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 use these coordinate transformations to define a rectangle in the GD-1 frame and transform it to ICRS.</p>
<p>The following variables define the boundaries of the rectangle in <span class="math notranslate nohighlight">\(\phi_1\)</span> and <span class="math notranslate nohighlight">\(\phi_2\)</span>.</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="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi1_max</span> <span class="o">=</span> <span class="o">-</span><span class="mi">45</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">8</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mi">4</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1509,40 +1634,37 @@ Created TAP+ (v1.2.1) - Connection:
<p>To represent a rectangle, well use two lists of coordinates and multiply by their units.</p> <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 docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">make_rectangle</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">):</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> <span class="sd">&quot;&quot;&quot;Return the corners of a rectangle.&quot;&quot;&quot;</span>
<span class="n">xs</span> <span class="o">=</span> <span class="p">[</span><span class="n">x1</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x1</span><span class="p">]</span>
<span class="n">ys</span> <span class="o">=</span> <span class="p">[</span><span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y1</span><span class="p">]</span>
<span class="k">return</span> <span class="n">xs</span><span class="p">,</span> <span class="n">ys</span>
</pre></div> </pre></div>
</div> </div>
</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> <div class="cell docutils container">
<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> <div class="cell_input docutils container">
<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="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1_rect</span><span class="p">,</span> <span class="n">phi2_rect</span> <span class="o">=</span> <span class="n">make_rectangle</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">phi2_min</span><span class="p">,</span> <span class="n">phi2_max</span><span class="p">)</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 in the GD-1 frame.</p>
<p>In order to use them in a Gaia query, we have to convert them to ICRS.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <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="n">corners</span> <span class="o">=</span> <span class="n">SkyCoord</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="n">frame</span><span class="o">=</span><span class="n">gd1_frame</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">corners</span><span class="p">)</span> <span class="n">corners</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;SkyCoord (GD1Koposov10): (phi1, phi2) in deg
</pre></div> [(-55., -8.), (-55., 4.), (-45., 4.), (-45., -8.), (-55., -8.)]&gt;
</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> </pre></div>
</div> </div>
</div> </div>
@@ -1552,28 +1674,16 @@ Created TAP+ (v1.2.1) - Connection:
<div class="cell_input 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> <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="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="s1">&#39;icrs&#39;</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">corners_icrs</span><span class="p">)</span> <span class="n">corners_icrs</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;SkyCoord (ICRS): (ra, dec) in deg
</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), [(146.27533314, 19.26190982), (135.42163944, 25.87738723),
(141.60264825, 34.3048303 ), (152.81671045, 27.13611254)]&gt; (141.60264825, 34.3048303 ), (152.81671045, 27.13611254),
(146.27533314, 19.26190982)]&gt;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1600,14 +1710,16 @@ Created TAP+ (v1.2.1) - Connection:
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;SkyCoord (ICRS): (ra, dec) in deg
(146.27533314, 19.26190982)&gt; (146.27533314, 19.26190982)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg &lt;SkyCoord (ICRS): (ra, dec) in deg
(135.42163944, 25.87738723)&gt; (135.42163944, 25.87738723)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg &lt;SkyCoord (ICRS): (ra, dec) in deg
(141.60264825, 34.3048303)&gt; (141.60264825, 34.3048303)&gt;
&lt;ICRS Coordinate: (ra, dec) in deg &lt;SkyCoord (ICRS): (ra, dec) in deg
(152.81671045, 27.13611254)&gt; (152.81671045, 27.13611254)&gt;
&lt;SkyCoord (ICRS): (ra, dec) in deg
(146.27533314, 19.26190982)&gt;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1625,6 +1737,7 @@ Created TAP+ (v1.2.1) - Connection:
135d25m17.902s 25d52m38.594s 135d25m17.902s 25d52m38.594s
141d36m09.5337s 34d18m17.3891s 141d36m09.5337s 34d18m17.3891s
152d49m00.1576s 27d08m10.0051s 152d49m00.1576s 27d08m10.0051s
146d16m31.1993s 19d15m42.8754s
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1642,6 +1755,7 @@ Created TAP+ (v1.2.1) - Connection:
135.42163944306296 25.87738722767213 135.42163944306296 25.87738722767213
141.60264825107333 34.304830296257144 141.60264825107333 34.304830296257144
152.81671044675923 27.136112541397996 152.81671044675923 27.136112541397996
146.27533313607782 19.261909820533692
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1661,7 +1775,8 @@ Created TAP+ (v1.2.1) - Connection:
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;146.27533313607782, 19.261909820533692&#39;, <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;135.42163944306296, 25.87738722767213&#39;,
&#39;141.60264825107333, 34.304830296257144&#39;, &#39;141.60264825107333, 34.304830296257144&#39;,
&#39;152.81671044675923, 27.136112541397996&#39;] &#39;152.81671044675923, 27.136112541397996&#39;,
&#39;146.27533313607782, 19.261909820533692&#39;]
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1675,7 +1790,7 @@ Created TAP+ (v1.2.1) - Connection:
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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; <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, 146.27533313607782, 19.261909820533692&#39;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1718,7 +1833,7 @@ FROM gaiadr2.gaia_source
WHERE parallax &lt; 1 WHERE parallax &lt; 1
AND bp_rp BETWEEN -0.75 AND 2 AND bp_rp BETWEEN -0.75 AND 2
AND 1 = CONTAINS(POINT(ra, dec), AND 1 = CONTAINS(POINT(ra, dec),
POLYGON(146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996)) POLYGON(146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996, 146.27533313607782, 19.261909820533692))
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1745,10 +1860,10 @@ WHERE parallax &lt; 1
parallax float64 mas Parallax 0 parallax float64 mas Parallax 0
parallax_error float64 mas Standard error of parallax 0 parallax_error float64 mas Standard error of parallax 0
radial_velocity float64 km / s Radial velocity 139374 radial_velocity float64 km / s Radial velocity 139374
Jobid: 1605624329053O Jobid: 1609260439320O
Phase: COMPLETED Phase: COMPLETED
Owner: None Owner: None
Output file: async_20201117094529.vot Output file: async_20201229114719.vot
Results: None Results: None
</pre></div> </pre></div>
</div> </div>
@@ -1793,7 +1908,7 @@ Results: None
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 8.6M Dec 29 11:47 gd1_results.fits
</pre></div> </pre></div>
</div> </div>
</div> </div>

View File

@@ -297,6 +297,11 @@
Selecting the centerline Selecting the centerline
</a> </a>
</li> </li>
<li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#plotting-proper-motion">
Plotting proper motion
</a>
</li>
<li class="toc-h2 nav-item toc-entry"> <li class="toc-h2 nav-item toc-entry">
<a class="reference internal nav-link" href="#filtering-based-on-proper-motion"> <a class="reference internal nav-link" href="#filtering-based-on-proper-motion">
Filtering based on proper motion Filtering based on proper motion
@@ -497,7 +502,7 @@ radial_velocity float64 km / s
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Row index=0</i> <div class="output text_html"><i>Row index=0</i>
<table id="table140419756472688"> <table id="table140569154410096">
<thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>parallax_error</th><th>radial_velocity</th></tr></thead> <thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>parallax_error</th><th>radial_velocity</th></tr></thead>
<thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>mas</th><th>km / s</th></tr></thead> <thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>mas</th><th>km / s</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead> <thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>
@@ -589,13 +594,20 @@ radial_velocity float64 km / s
<p>To fix this, we can provide optional arguments to control the size and transparency of the points.</p> <p>To fix this, we can provide optional arguments to control the size and transparency of the points.</p>
<div class="section" id="exercise"> <div class="section" id="exercise">
<h3>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline"></a></h3> <h3>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline"></a></h3>
<p>In the call to <code class="docutils literal notranslate"><span class="pre">plt.plot</span></code>, add the keyword argument <code class="docutils literal notranslate"><span class="pre">markersize=0.1</span></code> to make the markers smaller.</p> <p>In the call to <code class="docutils literal notranslate"><span class="pre">plt.plot</span></code>, use the keyword argument <code class="docutils literal notranslate"><span class="pre">markersize</span></code> to make the markers smaller.</p>
<p>Then add the argument <code class="docutils literal notranslate"><span class="pre">alpha=0.1</span></code> to make the markers nearly transparent.</p> <p>Then add the keyword argument <code class="docutils literal notranslate"><span class="pre">alpha</span></code> to make the markers partly transparent.</p>
<p>Adjust these arguments until you think the figure shows the data most clearly.</p> <p>Adjust these arguments until you think the figure shows the data most clearly.</p>
<p>Note: Once you have made these changes, you might notice that the figure shows stripes with lower density of stars. These stripes are caused by the way Gaia scans the sky, which <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/scanning-law">you can read about here</a>. The dataset we are using, <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/dr2">Gaia Data Release 2</a>, covers 22 months of observations; during this time, some parts of the sky were scanned more than others.</p> <p>Note: Once you have made these changes, you might notice that the figure shows stripes with lower density of stars. These stripes are caused by the way Gaia scans the sky, which <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/scanning-law">you can read about here</a>. The dataset we are using, <a class="reference external" href="https://www.cosmos.esa.int/web/gaia/dr2">Gaia Data Release 2</a>, covers 22 months of observations; during this time, some parts of the sky were scanned more than others.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span>
<span class="c1"># x = results[&#39;ra&#39;]</span>
<span class="c1"># y = results[&#39;dec&#39;]</span>
<span class="c1"># plt.plot(x, y, &#39;ko&#39;, markersize=0.1, alpha=0.1)</span>
<span class="c1"># plt.xlabel(&#39;ra (degree ICRS)&#39;)</span>
<span class="c1"># plt.ylabel(&#39;dec (degree ICRS)&#39;);</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -606,15 +618,18 @@ radial_velocity float64 km / s
<h2>Transform back<a class="headerlink" href="#transform-back" title="Permalink to this headline"></a></h2> <h2>Transform back<a class="headerlink" href="#transform-back" title="Permalink to this headline"></a></h2>
<p>Remember that we selected data from a rectangle of coordinates in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame, then transformed them to ICRS when we constructed the query. <p>Remember that we selected data from a rectangle of coordinates in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame, then transformed them to ICRS when we constructed the query.
The coordinates in <code class="docutils literal notranslate"><span class="pre">results</span></code> are in ICRS.</p> The coordinates in <code class="docutils literal notranslate"><span class="pre">results</span></code> are in ICRS.</p>
<p>To plot them, we will transform them back to the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame; that way, the axes of the figure are aligned with the GD-1, which will make it easy to select stars near the centerline of the stream.</p> <p>To plot them, we will transform them back to the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame; that way, the axes of the figure are aligned with the orbit of GD-1, which is useful for two reasons:</p>
<p>To do that, well put the results into a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object, <ul class="simple">
which is an “interface for celestial coordinate representation, manipulation, and transformation between systems”, provided by Astropy.</p> <li><p>We can identify stars that are likely to be in GD-1 by selecting stars near the centerline of the stream, where <span class="math notranslate nohighlight">\(\phi_2\)</span> is close to 0.</p></li>
<li><p>We expect stars in GD-1 to have similar proper motion along the <span class="math notranslate nohighlight">\(\phi_1\)</span> axis.</p></li>
</ul>
<p>To do the transformation, well put the results into a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">astropy.coordinates</span> <span class="kn">import</span> <span class="n">SkyCoord</span>
<span class="kn">import</span> <span class="nn">astropy.units</span> <span class="k">as</span> <span class="nn">u</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">skycoord</span> <span class="o">=</span> <span class="n">coord</span><span class="o">.</span><span class="n">SkyCoord</span><span class="p">(</span> <span class="n">skycoord</span> <span class="o">=</span> <span class="n">SkyCoord</span><span class="p">(</span>
<span class="n">ra</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;ra&#39;</span><span class="p">],</span> <span class="n">ra</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;ra&#39;</span><span class="p">],</span>
<span class="n">dec</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;dec&#39;</span><span class="p">],</span> <span class="n">dec</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;dec&#39;</span><span class="p">],</span>
<span class="n">pm_ra_cosdec</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">],</span> <span class="n">pm_ra_cosdec</span><span class="o">=</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">],</span>
@@ -627,26 +642,13 @@ which is an “interface for celestial coordinate representation, manipulation,
</div> </div>
<p>Most of the arguments we send to <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> come directly from <code class="docutils literal notranslate"><span class="pre">results</span></code>.</p> <p>Most of the arguments we send to <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> come directly from <code class="docutils literal notranslate"><span class="pre">results</span></code>.</p>
<p>We provide <code class="docutils literal notranslate"><span class="pre">distance</span></code> and <code class="docutils literal notranslate"><span class="pre">radial_velocity</span></code> to prepare the data for reflex correction, which we explain below.</p> <p>We provide <code class="docutils literal notranslate"><span class="pre">distance</span></code> and <code class="docutils literal notranslate"><span class="pre">radial_velocity</span></code> to prepare the data for reflex correction, which we explain below.</p>
<p>The result is a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object (<a class="reference external" href="https://docs.astropy.org/en/stable/api/astropy.coordinates.SkyCoord.html#astropy.coordinates.SkyCoord">documentation here</a>).</p> <p>The result is an Astropy <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object, which we can transform to the GD-1 frame.</p>
<p>The result is an Astropy <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">type</span><span class="p">(</span><span class="n">skycoord</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">gala.coordinates</span> <span class="kn">import</span> <span class="n">GD1Koposov10</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.sky_coordinate.SkyCoord
</pre></div>
</div>
</div>
</div>
<p><code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> provides <code class="docutils literal notranslate"><span class="pre">transform_to</span></code>, so we can transform the coordinates to other frames.</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">transformed</span> <span class="o">=</span> <span class="n">skycoord</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">gc</span><span class="o">.</span><span class="n">GD1Koposov10</span><span class="p">)</span> <span class="n">gd1_frame</span> <span class="o">=</span> <span class="n">GD1Koposov10</span><span class="p">()</span>
<span class="n">transformed</span> <span class="o">=</span> <span class="n">skycoord</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">gd1_frame</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@@ -659,7 +661,7 @@ which is an “interface for celestial coordinate representation, manipulation,
</div> </div>
<p>The result is another <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object, now in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame.</p> <p>The result is another <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object, now in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame.</p>
<p>The next step is to correct the proper motion measurements from Gaia for reflex due to the motion of our solar system around the Galactic center.</p> <p>The next step is to correct the proper motion measurements from Gaia for reflex due to the motion of our solar system around the Galactic center.</p>
<p>When we created <code class="docutils literal notranslate"><span class="pre">skycoord</span></code>, we provided <code class="docutils literal notranslate"><span class="pre">distance</span></code> and <code class="docutils literal notranslate"><span class="pre">radial_velocity</span></code> as arguments, which means we ignore the measurements provided by Gaia and replace them with these fixed values.</p> <p>When we created <code class="docutils literal notranslate"><span class="pre">skycoord</span></code>, we provided <code class="docutils literal notranslate"><span class="pre">distance</span></code> and <code class="docutils literal notranslate"><span class="pre">radial_velocity</span></code> as arguments, but we did not use the measurements provided by Gaia. Instead, we use fixed values for these parameters.</p>
<p>That might seem like a strange thing to do, but heres the motivation:</p> <p>That might seem like a strange thing to do, but heres the motivation:</p>
<ul class="simple"> <ul class="simple">
<li><p>Because the stars in GD-1 are so far away, the distance estimates we get from Gaia, which are based on parallax, are not very precise. So we replace them with our current best estimate of the mean distance to GD-1, about 8 kpc. See <a class="reference external" href="https://ui.adsabs.harvard.edu/abs/2010ApJ...712..260K/abstract">Koposov, Rix, and Hogg, 2010</a>.</p></li> <li><p>Because the stars in GD-1 are so far away, the distance estimates we get from Gaia, which are based on parallax, are not very precise. So we replace them with our current best estimate of the mean distance to GD-1, about 8 kpc. See <a class="reference external" href="https://ui.adsabs.harvard.edu/abs/2010ApJ...712..260K/abstract">Koposov, Rix, and Hogg, 2010</a>.</p></li>
@@ -670,8 +672,9 @@ which is an “interface for celestial coordinate representation, manipulation,
<p>With this preparation, we can use <code class="docutils literal notranslate"><span class="pre">reflex_correct</span></code> from Gala (<a class="reference external" href="https://gala-astro.readthedocs.io/en/latest/api/gala.coordinates.reflex_correct.html">documentation here</a>) to correct for solar reflex motion.</p> <p>With this preparation, we can use <code class="docutils literal notranslate"><span class="pre">reflex_correct</span></code> from Gala (<a class="reference external" href="https://gala-astro.readthedocs.io/en/latest/api/gala.coordinates.reflex_correct.html">documentation here</a>) to correct for solar reflex motion.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">gd1_coord</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">reflex_correct</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">gala.coordinates</span> <span class="kn">import</span> <span class="n">reflex_correct</span>
<span class="n">gd1_coord</span> <span class="o">=</span> <span class="n">reflex_correct</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">gd1_coord</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">gd1_coord</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@@ -684,8 +687,8 @@ which is an “interface for celestial coordinate representation, manipulation,
</div> </div>
<p>The result is a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object that contains</p> <p>The result is a <code class="docutils literal notranslate"><span class="pre">SkyCoord</span></code> object that contains</p>
<ul class="simple"> <ul class="simple">
<li><p>The transformed coordinates as attributes named <code class="docutils literal notranslate"><span class="pre">phi1</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2</span></code>, which represent right ascension and declination in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">phi1</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2</span></code>, which represent the transformed coordinates in the <code class="docutils literal notranslate"><span class="pre">GD1Koposov10</span></code> frame.</p></li>
<li><p>The transformed and corrected proper motions as <code class="docutils literal notranslate"><span class="pre">pm_phi1_cosphi2</span></code> and <code class="docutils literal notranslate"><span class="pre">pm_phi2</span></code>.</p></li> <li><p><code class="docutils literal notranslate"><span class="pre">pm_phi1_cosphi2</span></code> and <code class="docutils literal notranslate"><span class="pre">pm_phi2</span></code>, which represent the transformed and corrected proper motions.</p></li>
</ul> </ul>
<p>We can select the coordinates like this:</p> <p>We can select the coordinates like this:</p>
<div class="cell docutils container"> <div class="cell docutils container">
@@ -707,7 +710,7 @@ which is an “interface for celestial coordinate representation, manipulation,
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/03_motion_47_0.png" src="_images/03_motion_47_0.png" /> <img alt="_images/03_motion_43_0.png" src="_images/03_motion_43_0.png" />
</div> </div>
</div> </div>
<p>Remember that we started with a rectangle in GD-1 coordinates. When transformed to ICRS, its a non-rectangular polygon. Now that we have transformed back to GD-1 coordinates, its a rectangle again.</p> <p>Remember that we started with a rectangle in GD-1 coordinates. When transformed to ICRS, its a non-rectangular polygon. Now that we have transformed back to GD-1 coordinates, its a rectangle again.</p>
@@ -752,8 +755,8 @@ which is an “interface for celestial coordinate representation, manipulation,
<div class="cell_input 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">pandas</span> <span class="k">as</span> <span class="nn">pd</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">results</span><span class="o">.</span><span class="n">to_pandas</span><span class="p">()</span> <span class="n">results_df</span> <span class="o">=</span> <span class="n">results</span><span class="o">.</span><span class="n">to_pandas</span><span class="p">()</span>
<span class="n">df</span><span class="o">.</span><span class="n">shape</span> <span class="n">results_df</span><span class="o">.</span><span class="n">shape</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -767,7 +770,7 @@ which is an “interface for celestial coordinate representation, manipulation,
<p>It also provides <code class="docutils literal notranslate"><span class="pre">head</span></code>, which displays the first few rows. It is useful for spot-checking large results as you go along.</p> <p>It also provides <code class="docutils literal notranslate"><span class="pre">head</span></code>, which displays the first few rows. It is useful for spot-checking large results as you go along.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">df</span><span class="o">.</span><span class="n">head</span><span class="p">()</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">results_df</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -864,14 +867,14 @@ which is an “interface for celestial coordinate representation, manipulation,
<p>Now we can extract the columns we want from <code class="docutils literal notranslate"><span class="pre">gd1_coord</span></code> and add them as columns in the <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>. <code class="docutils literal notranslate"><span class="pre">phi1</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2</span></code> contain the transformed coordinates.</p> <p>Now we can extract the columns we want from <code class="docutils literal notranslate"><span class="pre">gd1_coord</span></code> and add them as columns in the <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>. <code class="docutils literal notranslate"><span class="pre">phi1</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2</span></code> contain the transformed coordinates.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi1</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi1</span>
<span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi2</span> <span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi2</span>
<span class="n">df</span><span class="o">.</span><span class="n">shape</span> <span class="n">results_df</span><span class="o">.</span><span class="n">shape</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(140340, 12) <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>(140340, 10)
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -879,9 +882,9 @@ which is an “interface for celestial coordinate representation, manipulation,
<p><code class="docutils literal notranslate"><span class="pre">pm_phi1_cosphi2</span></code> and <code class="docutils literal notranslate"><span class="pre">pm_phi2</span></code> contain the components of proper motion in the transformed frame.</p> <p><code class="docutils literal notranslate"><span class="pre">pm_phi1_cosphi2</span></code> and <code class="docutils literal notranslate"><span class="pre">pm_phi2</span></code> contain the components of proper motion in the transformed frame.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">pm_phi1_cosphi2</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">pm_phi1_cosphi2</span>
<span class="n">df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">pm_phi2</span> <span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">pm_phi2</span>
<span class="n">df</span><span class="o">.</span><span class="n">shape</span> <span class="n">results_df</span><span class="o">.</span><span class="n">shape</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -900,7 +903,7 @@ which is an “interface for celestial coordinate representation, manipulation,
<p>One of the most useful of these functions is <code class="docutils literal notranslate"><span class="pre">describe</span></code>, which computes summary statistics for each column.</p> <p>One of the most useful of these functions is <code class="docutils literal notranslate"><span class="pre">describe</span></code>, which computes summary statistics for each column.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">df</span><span class="o">.</span><span class="n">describe</span><span class="p">()</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">results_df</span><span class="o">.</span><span class="n">describe</span><span class="p">()</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1098,17 +1101,17 @@ which is an “interface for celestial coordinate representation, manipulation,
<li><p>Due to the nature of tidal streams, we expect the proper motion for most stars to be along the axis of the stream; that is, we expect motion in the direction of <code class="docutils literal notranslate"><span class="pre">phi2</span></code> to be near 0.</p></li> <li><p>Due to the nature of tidal streams, we expect the proper motion for most stars to be along the axis of the stream; that is, we expect motion in the direction of <code class="docutils literal notranslate"><span class="pre">phi2</span></code> to be near 0.</p></li>
<li><p>In the direction of <code class="docutils literal notranslate"><span class="pre">phi1</span></code>, we dont have a prior expectation for proper motion, except that it should form a cluster at a non-zero value.</p></li> <li><p>In the direction of <code class="docutils literal notranslate"><span class="pre">phi1</span></code>, we dont have a prior expectation for proper motion, except that it should form a cluster at a non-zero value.</p></li>
</ul> </ul>
<p>To locate this cluster, well select stars near the centerline of GD-1 and plot their proper motion.</p> <p>To locate this cluster, we will select stars near the centerline_df of GD-1.</p>
</div> </div>
<div class="section" id="selecting-the-centerline"> <div class="section" id="selecting-the-centerline">
<h2>Selecting the centerline<a class="headerlink" href="#selecting-the-centerline" title="Permalink to this headline"></a></h2> <h2>Selecting the centerline<a class="headerlink" href="#selecting-the-centerline" title="Permalink to this headline"></a></h2>
<p>As we can see in the following figure, many stars in GD-1 are less than 1 degree of declination from the line <code class="docutils literal notranslate"><span class="pre">phi2=0</span></code>.</p> <p>As we can see in the following figure, many stars in GD-1 are less than 1 degree from the line <code class="docutils literal notranslate"><span class="pre">phi2=0</span></code>.</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" /> <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>If we select stars near this line, they are more likely to be in GD-1.</p> <p>So stars near this line have the highest probability of being in GD-1.</p>
<p>Well start by selecting the <code class="docutils literal notranslate"><span class="pre">phi2</span></code> column from the <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>:</p> <p>To select them, we will use a “Boolean mask”. Well start by selecting the <code class="docutils literal notranslate"><span class="pre">phi2</span></code> column from the <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi2</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi2</span> <span class="o">=</span> <span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span>
<span class="nb">type</span><span class="p">(</span><span class="n">phi2</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">phi2</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@@ -1126,7 +1129,7 @@ which is an “interface for celestial coordinate representation, manipulation,
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.0</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1.0</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span> <span class="n">phi2_max</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">deg</span>
<span class="n">mask</span> <span class="o">=</span> <span class="p">(</span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">phi2_min</span><span class="p">)</span> <span class="n">mask</span> <span class="o">=</span> <span class="p">(</span><span class="n">phi2</span> <span class="o">&gt;</span> <span class="n">phi2_min</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">mask</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">mask</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@@ -1137,18 +1140,6 @@ which is an “interface for celestial coordinate representation, manipulation,
</div> </div>
</div> </div>
</div> </div>
<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">mask</span><span class="o">.</span><span class="n">dtype</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>dtype(&#39;bool&#39;)
</pre></div>
</div>
</div>
</div>
<p>The result is a <code class="docutils literal notranslate"><span class="pre">Series</span></code> of Boolean values, that is, <code class="docutils literal notranslate"><span class="pre">True</span></code> and <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p> <p>The result is a <code class="docutils literal notranslate"><span class="pre">Series</span></code> of Boolean values, that is, <code class="docutils literal notranslate"><span class="pre">True</span></code> and <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
@@ -1167,11 +1158,33 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
</div> </div>
<p>The <code class="docutils literal notranslate"><span class="pre">&amp;</span></code> operator computes “logical AND”, which means the result is true where elements from both Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> are true.</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">mask</span> <span class="o">=</span> <span class="p">(</span><span class="n">phi2</span> <span class="o">&gt;</span> <span class="n">phi2_min</span><span class="p">)</span> <span class="o">&amp;</span> <span class="p">(</span><span class="n">phi2</span> <span class="o">&lt;</span> <span class="n">phi2_max</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<p>Python note: We need the parentheses around the conditions; otherwise the order of operations is incorrect.</p>
<p>The sum of a Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> is the number of <code class="docutils literal notranslate"><span class="pre">True</span></code> values, so we can use <code class="docutils literal notranslate"><span class="pre">sum</span></code> to see how many stars are in the selected region.</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">mask</span><span class="o">.</span><span class="n">sum</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>25084
</pre></div>
</div>
</div>
</div>
<p>A Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> is sometimes called a “mask” because we can use it to mask out some of the rows in a <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code> and select the rest, like this:</p> <p>A Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> is sometimes called a “mask” because we can use it to mask out some of the rows in a <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code> and select the rest, like this:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">subset</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="n">mask</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">centerline_df</span> <span class="o">=</span> <span class="n">results_df</span><span class="p">[</span><span class="n">mask</span><span class="p">]</span>
<span class="nb">type</span><span class="p">(</span><span class="n">subset</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">centerline_df</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1181,49 +1194,15 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
</div> </div>
<p><code class="docutils literal notranslate"><span class="pre">subset</span></code> is a <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code> that contains only the rows from <code class="docutils literal notranslate"><span class="pre">df</span></code> that correspond to <code class="docutils literal notranslate"><span class="pre">True</span></code> values in <code class="docutils literal notranslate"><span class="pre">mask</span></code>.</p> <p><code class="docutils literal notranslate"><span class="pre">centerline_df</span></code> is a <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code> that contains only the rows from <code class="docutils literal notranslate"><span class="pre">results_df</span></code> that correspond to <code class="docutils literal notranslate"><span class="pre">True</span></code> values in <code class="docutils literal notranslate"><span class="pre">mask</span></code>; that is, in contains the stars near the centerline of GD-1.</p>
<p>The previous mask selects all stars where <code class="docutils literal notranslate"><span class="pre">phi2</span></code> exceeds <code class="docutils literal notranslate"><span class="pre">phi2_min</span></code>; now well select stars where <code class="docutils literal notranslate"><span class="pre">phi2</span></code> falls between <code class="docutils literal notranslate"><span class="pre">phi2_min</span></code> and <code class="docutils literal notranslate"><span class="pre">phi2_max</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">phi_mask</span> <span class="o">=</span> <span class="p">((</span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="n">phi2_min</span><span class="p">)</span> <span class="o">&amp;</span>
<span class="p">(</span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="o">&lt;</span> <span class="n">phi2_max</span><span class="p">))</span>
</pre></div>
</div>
</div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">&amp;</span></code> operator computes “logical AND”, which means the result is true where elements from both Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> are true.</p>
<p>The sum of a Boolean <code class="docutils literal notranslate"><span class="pre">Series</span></code> is the number of <code class="docutils literal notranslate"><span class="pre">True</span></code> values, so we can use <code class="docutils literal notranslate"><span class="pre">sum</span></code> to see how many stars are in the selected region.</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">phi_mask</span><span class="o">.</span><span class="n">sum</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>25084
</pre></div>
</div>
</div>
</div>
<p>And we can use <code class="docutils literal notranslate"><span class="pre">phi1_mask</span></code> to select stars near the centerline, which are more likely to be in GD-1.</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">centerline</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="n">phi_mask</span><span class="p">]</span>
<span class="nb">len</span><span class="p">(</span><span class="n">centerline</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>25084
</pre></div>
</div>
</div>
</div> </div>
<div class="section" id="plotting-proper-motion">
<h2>Plotting proper motion<a class="headerlink" href="#plotting-proper-motion" title="Permalink to this headline"></a></h2>
<p>Heres a scatter plot of proper motion for the selected stars.</p> <p>Heres a scatter plot of proper motion for the selected stars.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.1</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.1</span><span class="p">)</span>
@@ -1233,15 +1212,15 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/03_motion_85_0.png" src="_images/03_motion_85_0.png" /> <img alt="_images/03_motion_80_0.png" src="_images/03_motion_80_0.png" />
</div> </div>
</div> </div>
<p>Looking at these results, we see a large cluster around (0, 0), and a smaller cluster near (0, -10).</p> <p>Looking at these results, we see a large cluster around (0, 0), and a smaller cluster near (0, -10).</p>
<p>We can use <code class="docutils literal notranslate"><span class="pre">xlim</span></code> and <code class="docutils literal notranslate"><span class="pre">ylim</span></code> to set the limits on the axes and zoom in on the region near (0, 0).</p> <p>We can use <code class="docutils literal notranslate"><span class="pre">xlim</span></code> and <code class="docutils literal notranslate"><span class="pre">ylim</span></code> to set the limits on the axes and zoom in on the region near (0, 0).</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
@@ -1254,7 +1233,7 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/03_motion_87_0.png" src="_images/03_motion_87_0.png" /> <img alt="_images/03_motion_82_0.png" src="_images/03_motion_82_0.png" />
</div> </div>
</div> </div>
<p>Now we can see the smaller cluster more clearly.</p> <p>Now we can see the smaller cluster more clearly.</p>
@@ -1281,8 +1260,19 @@ Name: phi2, dtype: bool
<p>To draw these bounds, well make two lists containing the coordinates of the corners of the rectangle.</p> <p>To draw these bounds, well make two lists containing the coordinates of the corners of the rectangle.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm1_min</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">mas</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">yr</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">make_rectangle</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">):</span>
<span class="n">pm2_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">mas</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">yr</span> <span class="sd">&quot;&quot;&quot;Return the corners of a rectangle.&quot;&quot;&quot;</span>
<span class="n">xs</span> <span class="o">=</span> <span class="p">[</span><span class="n">x1</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x1</span><span class="p">]</span>
<span class="n">ys</span> <span class="o">=</span> <span class="p">[</span><span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y1</span><span class="p">]</span>
<span class="k">return</span> <span class="n">xs</span><span class="p">,</span> <span class="n">ys</span>
</pre></div>
</div>
</div>
</div>
<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">pm1_rect</span><span class="p">,</span> <span class="n">pm2_rect</span> <span class="o">=</span> <span class="n">make_rectangle</span><span class="p">(</span>
<span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1302,7 +1292,7 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/03_motion_94_0.png" src="_images/03_motion_94_0.png" /> <img alt="_images/03_motion_90_0.png" src="_images/03_motion_90_0.png" />
</div> </div>
</div> </div>
<p>To select rows that fall within these bounds, well use the following function, which uses Pandas operators to make a mask that selects rows where <code class="docutils literal notranslate"><span class="pre">series</span></code> falls between <code class="docutils literal notranslate"><span class="pre">low</span></code> and <code class="docutils literal notranslate"><span class="pre">high</span></code>.</p> <p>To select rows that fall within these bounds, well use the following function, which uses Pandas operators to make a mask that selects rows where <code class="docutils literal notranslate"><span class="pre">series</span></code> falls between <code class="docutils literal notranslate"><span class="pre">low</span></code> and <code class="docutils literal notranslate"><span class="pre">high</span></code>.</p>
@@ -1325,8 +1315,11 @@ Name: phi2, dtype: bool
<p>The following mask select stars with proper motion in the region we chose.</p> <p>The following mask select stars with proper motion in the region we chose.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm_mask</span> <span class="o">=</span> <span class="p">(</span><span class="n">between</span><span class="p">(</span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">],</span> <span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">)</span> <span class="o">&amp;</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span>
<span class="n">between</span><span class="p">(</span><span class="n">df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">],</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">))</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">results_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span>
<span class="n">pm_mask</span> <span class="o">=</span> <span class="p">(</span><span class="n">between</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">)</span> <span class="o">&amp;</span>
<span class="n">between</span><span class="p">(</span><span class="n">pm2</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">))</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1344,11 +1337,11 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
</div> </div>
<p>Now we can use this mask to select rows from <code class="docutils literal notranslate"><span class="pre">df</span></code>.</p> <p>Now we can use this mask to select rows from <code class="docutils literal notranslate"><span class="pre">results_df</span></code>.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">selected</span> <span class="o">=</span> <span class="n">df</span><span class="p">[</span><span class="n">pm_mask</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">selected_df</span> <span class="o">=</span> <span class="n">results_df</span><span class="p">[</span><span class="n">pm_mask</span><span class="p">]</span>
<span class="nb">len</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span> <span class="nb">len</span><span class="p">(</span><span class="n">selected_df</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1361,18 +1354,18 @@ Name: phi2, dtype: bool
<p>These are the stars we think are likely to be in GD-1. Lets see what they look like, plotting their coordinates (not their proper motion).</p> <p>These are the stars we think are likely to be in GD-1. Lets see what they look like, plotting their coordinates (not their proper motion).</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span>
<span class="n">phi2</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span> <span class="n">phi2</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;phi2&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">phi1</span><span class="p">,</span> <span class="n">phi2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">phi1</span><span class="p">,</span> <span class="n">phi2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.5</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;ra (degree GD1)&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;$\phi_1$ (degree GD1)&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;dec (degree GD1)&#39;</span><span class="p">);</span> <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="sa">r</span><span class="s1">&#39;$\phi_2$ (degree GD1)&#39;</span><span class="p">);</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/03_motion_104_0.png" src="_images/03_motion_104_0.png" /> <img alt="_images/03_motion_100_0.png" src="_images/03_motion_100_0.png" />
</div> </div>
</div> </div>
<p>Now thats starting to look like a tidal stream!</p> <p>Now thats starting to look like a tidal stream!</p>
@@ -1383,7 +1376,7 @@ Name: phi2, dtype: bool
<p>To save a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>, one option is to convert it to an Astropy <code class="docutils literal notranslate"><span class="pre">Table</span></code>, like this:</p> <p>To save a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>, one option is to convert it to an Astropy <code class="docutils literal notranslate"><span class="pre">Table</span></code>, like this:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">selected_table</span> <span class="o">=</span> <span class="n">Table</span><span class="o">.</span><span class="n">from_pandas</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">selected_table</span> <span class="o">=</span> <span class="n">Table</span><span class="o">.</span><span class="n">from_pandas</span><span class="p">(</span><span class="n">selected_df</span><span class="p">)</span>
<span class="nb">type</span><span class="p">(</span><span class="n">selected_table</span><span class="p">)</span> <span class="nb">type</span><span class="p">(</span><span class="n">selected_table</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
@@ -1406,22 +1399,22 @@ Name: phi2, dtype: bool
<div class="cell_input 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_dataframe.hdf5&#39;</span> <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_dataframe.hdf5&#39;</span>
<span class="n">df</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;df&#39;</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s1">&#39;w&#39;</span><span class="p">)</span> <span class="n">results_df</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;results_df&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
</div> </div>
<p>Because an HDF5 file can contain more than one Dataset, we have to provide a name, or “key”, that identifies the Dataset in the file.</p> <p>Because an HDF5 file can contain more than one Dataset, we have to provide a name, or “key”, that identifies the Dataset in the file.</p>
<p>We could use any string as the key, but in this example I use the variable name <code class="docutils literal notranslate"><span class="pre">df</span></code>.</p> <p>We could use any string as the key, but in this example I use the variable name <code class="docutils literal notranslate"><span class="pre">results_df</span></code>.</p>
<div class="section" id="id2"> <div class="section" id="id2">
<h3>Exercise<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3> <h3>Exercise<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<p>Were going to need <code class="docutils literal notranslate"><span class="pre">centerline</span></code> and <code class="docutils literal notranslate"><span class="pre">selected</span></code> later as well. Write a line or two of code to add it as a second Dataset in the HDF5 file.</p> <p>Were going to need <code class="docutils literal notranslate"><span class="pre">centerline_df</span></code> and <code class="docutils literal notranslate"><span class="pre">selected_df</span></code> later as well. Write a line or two of code to add it as a second Dataset in the HDF5 file.</p>
<div class="cell tag_hide-cell docutils container"> <div class="cell tag_hide-cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span>
<span class="n">centerline</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline&#39;</span><span class="p">)</span> <span class="n">centerline_df</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline_df&#39;</span><span class="p">)</span>
<span class="n">selected</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected&#39;</span><span class="p">)</span> <span class="n">selected_df</span><span class="o">.</span><span class="n">to_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected_df&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1442,7 +1435,7 @@ Name: phi2, dtype: bool
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 17M Nov 18 19:06 gd1_dataframe.hdf5 <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 20M Dec 29 11:48 gd1_dataframe.hdf5
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -1454,7 +1447,7 @@ Name: phi2, dtype: bool
<p>We can read the file back like this:</p> <p>We can read the file back like this:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">read_back_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;df&#39;</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">read_back_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;results_df&#39;</span><span class="p">)</span>
<span class="n">read_back_df</span><span class="o">.</span><span class="n">shape</span> <span class="n">read_back_df</span><span class="o">.</span><span class="n">shape</span>
</pre></div> </pre></div>
</div> </div>
@@ -1471,7 +1464,7 @@ Name: phi2, dtype: bool
<div class="section" id="summary"> <div class="section" id="summary">
<h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline"></a></h2> <h2>Summary<a class="headerlink" href="#summary" title="Permalink to this headline"></a></h2>
<p>In this lesson, we re-loaded the Gaia data we saved from a previous query.</p> <p>In this lesson, we re-loaded the Gaia data we saved from a previous query.</p>
<p>We transformed the coordinates and proper motion from ICRS to a frame aligned with GD-1, and stored the results in a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p> <p>We transformed the coordinates and proper motion from ICRS to a frame aligned with the orbit of GD-1, and stored the results in a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p>
<p>Then we replicated the selection process from the Price-Whelan and Bonaca paper:</p> <p>Then we replicated the selection process from the Price-Whelan and Bonaca paper:</p>
<ul class="simple"> <ul class="simple">
<li><p>We selected stars near the centerline of GD-1 and made a scatter plot of their proper motion.</p></li> <li><p>We selected stars near the centerline of GD-1 and made a scatter plot of their proper motion.</p></li>

View File

@@ -356,9 +356,8 @@
<div class="cell_input 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">pandas</span> <span class="k">as</span> <span class="nn">pd</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;df&#39;</span><span class="p">)</span> <span class="n">centerline_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline_df&#39;</span><span class="p">)</span>
<span class="n">centerline</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline&#39;</span><span class="p">)</span> <span class="n">selected_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected_df&#39;</span><span class="p">)</span>
<span class="n">selected</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -389,10 +388,19 @@
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">make_rectangle</span><span class="p">(</span><span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Return the corners of a rectangle.&quot;&quot;&quot;</span>
<span class="n">pm1_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm1_min</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">mas</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">yr</span> <span class="n">xs</span> <span class="o">=</span> <span class="p">[</span><span class="n">x1</span><span class="p">,</span> <span class="n">x1</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x2</span><span class="p">,</span> <span class="n">x1</span><span class="p">]</span>
<span class="n">pm2_rect</span> <span class="o">=</span> <span class="p">[</span><span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">]</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">mas</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">yr</span> <span class="n">ys</span> <span class="o">=</span> <span class="p">[</span><span class="n">y1</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y2</span><span class="p">,</span> <span class="n">y1</span><span class="p">,</span> <span class="n">y1</span><span class="p">]</span>
<span class="k">return</span> <span class="n">xs</span><span class="p">,</span> <span class="n">ys</span>
</pre></div>
</div>
</div>
</div>
<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">pm1_rect</span><span class="p">,</span> <span class="n">pm2_rect</span> <span class="o">=</span> <span class="n">make_rectangle</span><span class="p">(</span>
<span class="n">pm1_min</span><span class="p">,</span> <span class="n">pm1_max</span><span class="p">,</span> <span class="n">pm2_min</span><span class="p">,</span> <span class="n">pm2_max</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -407,12 +415,12 @@
<div class="cell_input 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">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">pm1</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span> <span class="n">pm1</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pm_phi1&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pm_phi2&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1_rect</span><span class="p">,</span> <span class="n">pm2_rect</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1_rect</span><span class="p">,</span> <span class="n">pm2_rect</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">)</span>
@@ -426,18 +434,18 @@
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/04_select_12_0.png" src="_images/04_select_12_0.png" /> <img alt="_images/04_select_13_0.png" src="_images/04_select_13_0.png" />
</div> </div>
</div> </div>
<p>Now well make the same plot using proper motions in the ICRS frame, which are stored in columns <code class="docutils literal notranslate"><span class="pre">pmra</span></code> and <code class="docutils literal notranslate"><span class="pre">pmdec</span></code>.</p> <p>Now well make the same plot using proper motions in the ICRS frame, which are stored in columns <code class="docutils literal notranslate"><span class="pre">pmra</span></code> and <code class="docutils literal notranslate"><span class="pre">pmdec</span></code>.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">pm1</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span> <span class="n">pm1</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;Proper motion ra (ICRS frame)&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;Proper motion ra (ICRS frame)&#39;</span><span class="p">)</span>
@@ -449,7 +457,7 @@
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/04_select_14_0.png" src="_images/04_select_14_0.png" /> <img alt="_images/04_select_15_0.png" src="_images/04_select_15_0.png" />
</div> </div>
</div> </div>
<p>The proper motions of the selected stars are more spread out in this frame, which is why it was preferable to do the selection in the GD-1 frame.</p> <p>The proper motions of the selected stars are more spread out in this frame, which is why it was preferable to do the selection in the GD-1 frame.</p>
@@ -463,7 +471,7 @@
<div class="cell_input 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">numpy</span> <span class="k">as</span> <span class="nn">np</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="n">points</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[[</span><span class="s1">&#39;pmra&#39;</span><span class="p">,</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">to_numpy</span><span class="p">()</span> <span class="n">points</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[[</span><span class="s1">&#39;pmra&#39;</span><span class="p">,</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">to_numpy</span><span class="p">()</span>
<span class="n">points</span><span class="o">.</span><span class="n">shape</span> <span class="n">points</span><span class="o">.</span><span class="n">shape</span>
</pre></div> </pre></div>
</div> </div>
@@ -475,7 +483,7 @@
</div> </div>
</div> </div>
<p>NOTE: If you are using an older version of Pandas, you might not have <code class="docutils literal notranslate"><span class="pre">to_numpy()</span></code>; you can use <code class="docutils literal notranslate"><span class="pre">values</span></code> instead, like this:</p> <p>NOTE: If you are using an older version of Pandas, you might not have <code class="docutils literal notranslate"><span class="pre">to_numpy()</span></code>; you can use <code class="docutils literal notranslate"><span class="pre">values</span></code> instead, like this:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">points</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[[</span><span class="s1">&#39;pmra&#39;</span><span class="p">,</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">values</span> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">points</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[[</span><span class="s1">&#39;pmra&#39;</span><span class="p">,</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]]</span><span class="o">.</span><span class="n">values</span>
</pre></div> </pre></div>
</div> </div>
@@ -490,7 +498,7 @@
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;scipy.spatial.qhull.ConvexHull at 0x7f0d570cd700&gt; <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;scipy.spatial.qhull.ConvexHull at 0x7fa7c4c03a90&gt;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -550,12 +558,12 @@
<p>The following figure shows proper motion in ICRS again, along with the convex hull we just computed.</p> <p>The following figure shows proper motion in ICRS again, along with the convex hull we just computed.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">pm1</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">centerline_df</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;ko&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">pm1</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span> <span class="n">pm1</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">]</span>
<span class="n">pm2</span> <span class="o">=</span> <span class="n">selected</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span> <span class="n">pm2</span> <span class="o">=</span> <span class="n">selected_df</span><span class="p">[</span><span class="s1">&#39;pmdec&#39;</span><span class="p">]</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pm1</span><span class="p">,</span> <span class="n">pm2</span><span class="p">,</span> <span class="s1">&#39;gx&#39;</span><span class="p">,</span> <span class="n">markersize</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pmra_poly</span><span class="p">,</span> <span class="n">pmdec_poly</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">pmra_poly</span><span class="p">,</span> <span class="n">pmdec_poly</span><span class="p">)</span>
@@ -569,7 +577,7 @@
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/04_select_28_0.png" src="_images/04_select_28_0.png" /> <img alt="_images/04_select_29_0.png" src="_images/04_select_29_0.png" />
</div> </div>
</div> </div>
<p>So <code class="docutils literal notranslate"><span class="pre">pm_vertices</span></code> represents the polygon we want to select. <p>So <code class="docutils literal notranslate"><span class="pre">pm_vertices</span></code> represents the polygon we want to select.
@@ -661,18 +669,20 @@ The next step is to use it as part of an ADQL query.</p>
<p>Here are the coordinates of the rectangle well select, in the GD-1 frame.</p> <p>Here are the coordinates of the rectangle well select, in the GD-1 frame.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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">70</span> <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">phi1_max</span> <span class="o">=</span> <span class="o">-</span><span class="mi">20</span>
<span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">5</span> <span class="n">phi1_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">70</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mi">5</span> <span class="n">phi1_max</span> <span class="o">=</span> <span class="o">-</span><span class="mi">20</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_min</span> <span class="o">=</span> <span class="o">-</span><span class="mi">5</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
<span class="n">phi2_max</span> <span class="o">=</span> <span class="mi">5</span> <span class="o">*</span> <span class="n">u</span><span class="o">.</span><span class="n">degree</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">phi1_rect</span><span class="p">,</span> <span class="n">phi2_rect</span> <span class="o">=</span> <span class="n">make_rectangle</span><span class="p">(</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> <span class="n">phi1_min</span><span class="p">,</span> <span class="n">phi1_max</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>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -680,16 +690,11 @@ The next step is to use it as part of an ADQL query.</p>
<p>Heres how we transform it to ICRS, as we saw in the previous lesson.</p> <p>Heres how we transform it to ICRS, as we saw in the previous lesson.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">gala.coordinates</span> <span class="kn">import</span> <span class="n">GD1Koposov10</span>
<span class="kn">import</span> <span class="nn">astropy.coordinates</span> <span class="k">as</span> <span class="nn">coord</span> <span class="kn">from</span> <span class="nn">astropy.coordinates</span> <span class="kn">import</span> <span class="n">SkyCoord</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="n">corners</span> <span class="o">=</span> <span class="n">SkyCoord</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="n">frame</span><span class="o">=</span><span class="n">GD1Koposov10</span><span class="p">)</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="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="s1">&#39;icrs&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>WARNING: AstropyDeprecationWarning: Transforming a frame instance to a frame class (as opposed to another frame instance) will not be supported in the future. Either explicitly instantiate the target frame, or first convert the source frame instance to a `astropy.coordinates.SkyCoord` and use its `transform_to()` method. [astropy.coordinates.baseframe]
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -708,7 +713,7 @@ The next step is to use it as part of an ADQL query.</p>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&#39;135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258&#39; <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&#39;135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258, 135.30559858565638, 8.398623940157561&#39;
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -780,7 +785,7 @@ FROM gaiadr2.gaia_source
WHERE parallax &lt; 1 WHERE parallax &lt; 1
AND bp_rp BETWEEN -0.75 AND 2 AND bp_rp BETWEEN -0.75 AND 2
AND 1 = CONTAINS(POINT(ra, dec), AND 1 = CONTAINS(POINT(ra, dec),
POLYGON(135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258)) POLYGON(135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258, 135.30559858565638, 8.398623940157561))
AND 1 = CONTAINS(POINT(pmra, pmdec), AND 1 = CONTAINS(POINT(pmra, pmdec),
POLYGON(-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883)) POLYGON(-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883))
</pre></div> </pre></div>
@@ -819,10 +824,10 @@ INFO: Query finished. [astroquery.utils.tap.core]
pmdec float64 mas / yr Proper motion in declination direction 0 pmdec float64 mas / yr Proper motion in declination direction 0
parallax float64 mas Parallax 0 parallax float64 mas Parallax 0
radial_velocity float64 km / s Radial velocity 7295 radial_velocity float64 km / s Radial velocity 7295
Jobid: 1607614394159O Jobid: 1609260557475O
Phase: COMPLETED Phase: COMPLETED
Owner: None Owner: None
Output file: async_20201210103314.vot Output file: async_20201229114917.vot
Results: None Results: None
</pre></div> </pre></div>
</div> </div>
@@ -859,21 +864,23 @@ Results: None
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/04_select_56_0.png" src="_images/04_select_56_0.png" /> <img alt="_images/04_select_57_0.png" src="_images/04_select_57_0.png" />
</div> </div>
</div> </div>
<p>Here we can see why it was useful to transform these coordinates. In ICRS, it is more difficult to identity the stars near the centerline of GD-1.</p> <p>Here we can see why it was useful to transform these coordinates. In ICRS, it is more difficult to identity the stars near the centerline of GD-1.</p>
<p>So, before we move on to the next step, lets collect the code we used to transform the coordinates and make a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>:</p> <p>So, before we move on to the next step, lets collect the code we used to transform the coordinates and make a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>:</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">make_dataframe</span><span class="p">(</span><span class="n">table</span><span class="p">):</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">gala.coordinates</span> <span class="kn">import</span> <span class="n">reflex_correct</span>
<span class="k">def</span> <span class="nf">make_dataframe</span><span class="p">(</span><span class="n">table</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Transform coordinates from ICRS to GD-1 frame.</span> <span class="sd">&quot;&quot;&quot;Transform coordinates from ICRS to GD-1 frame.</span>
<span class="sd"> </span> <span class="sd"> </span>
<span class="sd"> table: Astropy Table</span> <span class="sd"> table: Astropy Table</span>
<span class="sd"> </span> <span class="sd"> </span>
<span class="sd"> returns: Pandas DataFrame</span> <span class="sd"> returns: Pandas DataFrame</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="n">skycoord</span> <span class="o">=</span> <span class="n">coord</span><span class="o">.</span><span class="n">SkyCoord</span><span class="p">(</span> <span class="n">skycoord</span> <span class="o">=</span> <span class="n">SkyCoord</span><span class="p">(</span>
<span class="n">ra</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;ra&#39;</span><span class="p">],</span> <span class="n">ra</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;ra&#39;</span><span class="p">],</span>
<span class="n">dec</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;dec&#39;</span><span class="p">],</span> <span class="n">dec</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;dec&#39;</span><span class="p">],</span>
<span class="n">pm_ra_cosdec</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">],</span> <span class="n">pm_ra_cosdec</span><span class="o">=</span><span class="n">table</span><span class="p">[</span><span class="s1">&#39;pmra&#39;</span><span class="p">],</span>
@@ -881,8 +888,8 @@ Results: None
<span class="n">distance</span><span class="o">=</span><span class="mi">8</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">kpc</span><span class="p">,</span> <span class="n">distance</span><span class="o">=</span><span class="mi">8</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">kpc</span><span class="p">,</span>
<span class="n">radial_velocity</span><span class="o">=</span><span class="mi">0</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">km</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">s</span><span class="p">)</span> <span class="n">radial_velocity</span><span class="o">=</span><span class="mi">0</span><span class="o">*</span><span class="n">u</span><span class="o">.</span><span class="n">km</span><span class="o">/</span><span class="n">u</span><span class="o">.</span><span class="n">s</span><span class="p">)</span>
<span class="n">transformed</span> <span class="o">=</span> <span class="n">skycoord</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">gc</span><span class="o">.</span><span class="n">GD1Koposov10</span><span class="p">)</span> <span class="n">transformed</span> <span class="o">=</span> <span class="n">skycoord</span><span class="o">.</span><span class="n">transform_to</span><span class="p">(</span><span class="n">GD1Koposov10</span><span class="p">)</span>
<span class="n">gd1_coord</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">reflex_correct</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span> <span class="n">gd1_coord</span> <span class="o">=</span> <span class="n">reflex_correct</span><span class="p">(</span><span class="n">transformed</span><span class="p">)</span>
<span class="n">df</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">to_pandas</span><span class="p">()</span> <span class="n">df</span> <span class="o">=</span> <span class="n">table</span><span class="o">.</span><span class="n">to_pandas</span><span class="p">()</span>
<span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi1</span> <span class="n">df</span><span class="p">[</span><span class="s1">&#39;phi1&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">gd1_coord</span><span class="o">.</span><span class="n">phi1</span>
@@ -916,7 +923,7 @@ Results: None
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/04_select_62_0.png" src="_images/04_select_62_0.png" /> <img alt="_images/04_select_63_0.png" src="_images/04_select_63_0.png" />
</div> </div>
</div> </div>
<p>Were starting to see GD-1 more clearly.</p> <p>Were starting to see GD-1 more clearly.</p>
@@ -947,7 +954,7 @@ Results: None
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 698K Dec 10 19:18 gd1_candidates.hdf5 <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 698K Dec 29 11:50 gd1_candidates.hdf5
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -980,7 +987,7 @@ Results: None
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 1.4M Dec 10 19:19 gd1_candidates.csv <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 1.4M Dec 29 11:50 gd1_candidates.csv
</pre></div> </pre></div>
</div> </div>
</div> </div>

View File

@@ -332,7 +332,8 @@
<h1>Joining Tables<a class="headerlink" href="#joining-tables" title="Permalink to this headline"></a></h1> <h1>Joining Tables<a class="headerlink" href="#joining-tables" title="Permalink to this headline"></a></h1>
<p>This is the fifth in a series of notebooks related to astronomy data.</p> <p>This is the fifth in a series of notebooks related to astronomy data.</p>
<p>As a continuing example, we will replicate part 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>As a continuing example, we will replicate part 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>Picking up where we left off, the next step in the analysis is to select candidate stars based on photometry data. The following figure from the paper is a color-magnitude diagram for the stars selected based on proper motion:</p> <p>Picking up where we left off, the next step in the analysis is to select candidate stars based on photometry data.
The following figure from the paper is a color-magnitude diagram for the stars selected based on proper motion:</p>
<a class="reference internal image-reference" href="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png"><img alt="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png" src="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png" style="width: 300px;" /></a> <a class="reference internal image-reference" href="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png"><img alt="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png" src="https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png" style="width: 300px;" /></a>
<p>In red is a <a class="reference external" href="https://en.wikipedia.org/wiki/Stellar_isochrone">stellar isochrone</a>, showing where we expect the stars in GD-1 to fall based on the metallicity and age of their original globular cluster.</p> <p>In red is a <a class="reference external" href="https://en.wikipedia.org/wiki/Stellar_isochrone">stellar isochrone</a>, showing where we expect the stars in GD-1 to fall based on the metallicity and age of their original globular cluster.</p>
<p>By selecting stars in the shaded area, we can further distinguish the main sequence of GD-1 from younger background stars.</p> <p>By selecting stars in the shaded area, we can further distinguish the main sequence of GD-1 from younger background stars.</p>
@@ -499,7 +500,7 @@ The size of the file is about 750 KB, so thats not too bad.</p>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 396K Dec 10 11:33 candidate_df.xml <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 396K Dec 29 11:50 candidate_df.xml
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -511,38 +512,30 @@ The size of the file is about 750 KB, so thats not too bad.</p>
<div class="section" id="exercise"> <div class="section" id="exercise">
<h3>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline"></a></h3> <h3>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline"></a></h3>
<p>Theres a gotcha here we want to warn you about. Why do you think we used double brackets to specify the column we wanted? What happens if you use single brackets?</p> <p>Theres a gotcha here we want to warn you about. Why do you think we used double brackets to specify the column we wanted? What happens if you use single brackets?</p>
<p>Run these cells to find out.</p> <p>Run these code snippets to find out.</p>
<div class="cell docutils container"> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">table_id</span> <span class="o">=</span> <span class="n">candidate_table</span><span class="p">[[</span><span class="s1">&#39;source_id&#39;</span><span class="p">]]</span>
<div class="cell_input docutils container"> <span class="nb">print</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">table_id</span><span class="p">))</span>
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">table_id</span> <span class="o">=</span> <span class="n">candidate_table</span><span class="p">[[</span><span class="s1">&#39;source_id&#39;</span><span class="p">]]</span>
<span class="nb">type</span><span class="p">(</span><span class="n">table_id</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">column</span> <span class="o">=</span> <span class="n">candidate_table</span><span class="p">[</span><span class="s1">&#39;source_id&#39;</span><span class="p">]</span>
<div class="cell_output docutils container"> <span class="nb">print</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">column</span><span class="p">))</span>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>astropy.table.table.Table
</pre></div> </pre></div>
</div> </div>
</div> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="c1"># This one should cause an error</span>
<span class="n">table_id</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;candidate_df.xml&#39;</span><span class="p">,</span>
<span class="nb">format</span><span class="o">=</span><span class="s1">&#39;votable&#39;</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 class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">column</span> <span class="o">=</span> <span class="n">candidate_table</span><span class="p">[</span><span class="s1">&#39;source_id&#39;</span><span class="p">]</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span>
<span class="nb">type</span><span class="p">(</span><span class="n">column</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.table.column.Column
</pre></div>
</div>
</div>
</div>
<div class="cell docutils container">
<div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># This line is commented out because it would cause an error</span>
<span class="c1"># writeto(column, &#39;candidate_df.xml&#39;)</span> <span class="c1"># table_id is a Table</span>
<span class="c1"># column is a Column</span>
<span class="c1"># Column does not provide `write`, so you get an AttributeError</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -604,7 +597,7 @@ INFO: Query finished. [astroquery.utils.tap.core]
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=7346</i> <div class="output text_html"><i>Table length=7346</i>
<table id="table140668290919488" class="table-striped table-bordered table-condensed"> <table id="table139832308444608" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th></tr></thead> <thead><tr><th>source_id</th></tr></thead>
<thead><tr><th>int64</th></tr></thead> <thead><tr><th>int64</th></tr></thead>
<tr><td>635559124339440000</td></tr> <tr><td>635559124339440000</td></tr>
@@ -633,7 +626,7 @@ INFO: Query finished. [astroquery.utils.tap.core]
<p>If things go according to plan, the result should contain the same rows and columns as the uploaded table.</p> <p>If things go according to plan, the result should contain the same rows and columns as the uploaded table.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">len</span><span class="p">(</span><span class="n">candidate_table</span><span class="p">),</span> <span class="nb">len</span><span class="p">(</span><span class="n">results</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">len</span><span class="p">(</span><span class="n">table_id</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> </pre></div>
</div> </div>
</div> </div>
@@ -645,12 +638,24 @@ INFO: Query finished. [astroquery.utils.tap.core]
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="nb">set</span><span class="p">(</span><span class="n">candidate_table</span><span class="p">[</span><span class="s1">&#39;source_id&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="nb">set</span><span class="p">(</span><span class="n">results</span><span class="p">[</span><span class="s1">&#39;source_id&#39;</span><span class="p">])</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">table_id</span><span class="o">.</span><span class="n">colnames</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>True <div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>[&#39;source_id&#39;]
</pre></div>
</div>
</div>
</div>
<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">colnames</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;source_id&#39;]
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -705,7 +710,7 @@ INFO: Query finished. [astroquery.utils.tap.core]
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=3724</i> <div class="output text_html"><i>Table length=3724</i>
<table id="table140668268803072" class="table-striped table-bordered table-condensed"> <table id="table139832308265696" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>original_ext_source_id</th><th>angular_distance</th><th>number_of_neighbours</th><th>number_of_mates</th><th>best_neighbour_multiplicity</th><th>gaia_astrometric_params</th><th>source_id_2</th></tr></thead> <thead><tr><th>source_id</th><th>original_ext_source_id</th><th>angular_distance</th><th>number_of_neighbours</th><th>number_of_mates</th><th>best_neighbour_multiplicity</th><th>gaia_astrometric_params</th><th>source_id_2</th></tr></thead>
<thead><tr><th></th><th></th><th>arcsec</th><th></th><th></th><th></th><th></th><th></th></tr></thead> <thead><tr><th></th><th></th><th>arcsec</th><th></th><th></th><th></th><th></th><th></th></tr></thead>
<thead><tr><th>int64</th><th>int64</th><th>float64</th><th>int32</th><th>int16</th><th>int16</th><th>int16</th><th>int64</th></tr></thead> <thead><tr><th>int64</th><th>int64</th><th>float64</th><th>int32</th><th>int16</th><th>int16</th><th>int16</th><th>int64</th></tr></thead>
@@ -929,7 +934,7 @@ dtype: float64
<span class="c1"># Second test</span> <span class="c1"># Second test</span>
<span class="n">query2</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;SELECT TOP 10 *</span> <span class="n">query2</span> <span class="o">=</span> <span class="s2">&quot;&quot;&quot;SELECT TOP 10</span>
<span class="s2">FROM gaiadr2.panstarrs1_original_valid</span> <span class="s2">FROM gaiadr2.panstarrs1_original_valid</span>
<span class="s2">&quot;&quot;&quot;</span> <span class="s2">&quot;&quot;&quot;</span>
@@ -977,7 +982,7 @@ dtype: float64
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_html"><i>Table length=3724</i> <div class="output text_html"><i>Table length=3724</i>
<table id="table140668299958448" class="table-striped table-bordered table-condensed"> <table id="table139832332951360" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead> <thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead>
<thead><tr><th></th><th></th><th>mag</th></tr></thead> <thead><tr><th></th><th></th><th>mag</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead> <thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead>
@@ -1022,44 +1027,14 @@ dtype: float64
<span class="s2">&quot;&quot;&quot;</span> <span class="s2">&quot;&quot;&quot;</span>
<span class="c1"># job3 = Gaia.launch_job_async(query=query3, </span> <span class="c1"># job3 = Gaia.launch_job_async(query=query3, </span>
<span class="n">upload_resource</span><span class="o">=</span><span class="s1">&#39;candidate_df.xml&#39;</span><span class="p">,</span> <span class="c1"># upload_resource=&#39;candidate_df.xml&#39;, </span>
<span class="n">upload_table_name</span><span class="o">=</span><span class="s1">&#39;candidate_df&#39;</span><span class="p">)</span> <span class="c1"># upload_table_name=&#39;candidate_df&#39;)</span>
<span class="c1"># results3 = job3.get_results()</span> <span class="c1"># results3 = job3.get_results()</span>
<span class="c1"># results3</span> <span class="c1"># results3</span>
</pre></div> </pre></div>
</div> </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]
</pre></div>
</div>
<div class="output text_html"><i>Table length=3724</i>
<table id="table140668275467456" class="table-striped table-bordered table-condensed">
<thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead>
<thead><tr><th></th><th></th><th>mag</th></tr></thead>
<thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead>
<tr><td>635860218726658176</td><td>17.8978004455566</td><td>17.5174007415771</td></tr>
<tr><td>635674126383965568</td><td>19.2873001098633</td><td>17.6781005859375</td></tr>
<tr><td>635535454774983040</td><td>16.9237995147705</td><td>16.478099822998</td></tr>
<tr><td>635497276810313600</td><td>19.9242000579834</td><td>18.3339996337891</td></tr>
<tr><td>635614168640132864</td><td>16.1515998840332</td><td>14.6662998199463</td></tr>
<tr><td>635598607974369792</td><td>16.5223999023438</td><td>16.1375007629395</td></tr>
<tr><td>635737661835496576</td><td>14.5032997131348</td><td>13.9849004745483</td></tr>
<tr><td>635850945892748672</td><td>16.5174999237061</td><td>16.0450000762939</td></tr>
<tr><td>635600532119713664</td><td>20.4505996704102</td><td>19.5177001953125</td></tr>
<tr><td>...</td><td>...</td><td>...</td></tr>
<tr><td>612241781249124608</td><td>20.2343997955322</td><td>18.6518001556396</td></tr>
<tr><td>612332147361443072</td><td>21.3848991394043</td><td>20.3076000213623</td></tr>
<tr><td>612426744016802432</td><td>17.8281002044678</td><td>17.4281005859375</td></tr>
<tr><td>612331739340341760</td><td>21.8656997680664</td><td>19.5223007202148</td></tr>
<tr><td>612282738058264960</td><td>22.5151996612549</td><td>19.9743995666504</td></tr>
<tr><td>612386332668697600</td><td>19.3792991638184</td><td>17.9923000335693</td></tr>
<tr><td>612296172717818624</td><td>17.4944000244141</td><td>16.926700592041</td></tr>
<tr><td>612250375480101760</td><td>15.3330001831055</td><td>14.6280002593994</td></tr>
<tr><td>612394926899159168</td><td>16.4414005279541</td><td>15.8212003707886</td></tr>
<tr><td>612256418500423168</td><td>20.8715991973877</td><td>19.9612007141113</td></tr>
</table></div></div>
</div> </div>
</div> </div>
</div> </div>
@@ -1082,7 +1057,7 @@ dtype: float64
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <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 96K Dec 10 11:34 gd1_photo.fits <div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>-rw-rw-r-- 1 downey downey 96K Dec 29 11:51 gd1_photo.fits
</pre></div> </pre></div>
</div> </div>
</div> </div>

File diff suppressed because it is too large Load Diff

View File

@@ -458,17 +458,12 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gd1_merged.hdf5
</pre></div>
</div>
</div>
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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">pandas</span> <span class="k">as</span> <span class="nn">pd</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="n">selected</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected&#39;</span><span class="p">)</span> <span class="n">selected2</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;selected2&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -496,7 +491,7 @@
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mf">2.5</span><span class="p">))</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">plt</span><span class="o">.</span><span class="n">figure</span><span class="p">(</span><span class="n">figsize</span><span class="o">=</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mf">2.5</span><span class="p">))</span>
<span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span> <span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected2</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -722,7 +717,7 @@
</div> </div>
<div class="section" id="upper-right"> <div class="section" id="upper-right">
<h2>Upper right<a class="headerlink" href="#upper-right" title="Permalink to this headline"></a></h2> <h2>Upper right<a class="headerlink" href="#upper-right" title="Permalink to this headline"></a></h2>
<p>To make the panel in the upper right, we have to reload <code class="docutils literal notranslate"><span class="pre">centerline</span></code>.</p> <p>To make the panel in the upper right, we have to reload <code class="docutils literal notranslate"><span class="pre">centerline_df</span></code>.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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">os</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
@@ -735,17 +730,12 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gd1_dataframe.hdf5
</pre></div>
</div>
</div>
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input 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">pandas</span> <span class="k">as</span> <span class="nn">pd</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="n">centerline</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline&#39;</span><span class="p">)</span> <span class="n">centerline_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;centerline_df&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -815,7 +805,7 @@
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="p">[</span><span class="s1">&#39;text.usetex&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">plt</span><span class="o">.</span><span class="n">rcParams</span><span class="p">[</span><span class="s1">&#39;text.usetex&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">plt</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s1">&#39;default&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">style</span><span class="o">.</span><span class="n">use</span><span class="p">(</span><span class="s1">&#39;default&#39;</span><span class="p">)</span>
<span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline</span><span class="p">)</span> <span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline_df</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -839,11 +829,6 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gd1_candidates.hdf5
</pre></div>
</div>
</div>
</div> </div>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
@@ -919,8 +904,8 @@
<span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">([</span><span class="mi">14</span><span class="p">,</span> <span class="mi">22</span><span class="p">])</span> <span class="n">plt</span><span class="o">.</span><span class="n">ylim</span><span class="p">([</span><span class="mi">14</span><span class="p">,</span> <span class="mi">22</span><span class="p">])</span>
<span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">invert_yaxis</span><span class="p">()</span> <span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">invert_yaxis</span><span class="p">()</span>
<span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;$g_0$&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">ylabel</span><span class="p">(</span><span class="s1">&#39;$Magnitude (g)$&#39;</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;$(g-i)_0$&#39;</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">xlabel</span><span class="p">(</span><span class="s1">&#39;$Color (g-i)$&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
@@ -949,283 +934,67 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gd1_polygon.hdf5
</pre></div>
</div>
</div>
</div> </div>
<p>And heres how we read it back.</p> <p>And heres how we read it back.</p>
<div class="cell docutils container"> <div class="cell docutils container">
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">loop</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;loop&#39;</span><span class="p">)</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">loop_df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_hdf</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span> <span class="s1">&#39;loop_df&#39;</span><span class="p">)</span>
<span class="n">loop</span> <span class="n">loop_df</span><span class="o">.</span><span class="n">head</span><span class="p">()</span>
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>gi <div class="output text_html"><div>
0.587571 21.411746 <style scoped>
0.567801 21.322466 .dataframe tbody tr th:only-of-type {
0.548134 21.233380 vertical-align: middle;
0.528693 21.144427 }
0.509300 21.054549
... .dataframe tbody tr th {
0.773743 21.054549 vertical-align: top;
0.798829 21.144427 }
0.824000 21.233380
0.849503 21.322466 .dataframe thead th {
0.875220 21.411746 text-align: right;
Name: g, Length: 234, dtype: float64 }
</pre></div> </style>
</div> <table border="1" class="dataframe">
</div> <thead>
</div> <tr style="text-align: right;">
<div class="cell docutils container"> <th></th>
<div class="cell_input docutils container"> <th>color_loop</th>
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="n">coords</span> <span class="o">=</span> <span class="n">loop</span><span class="o">.</span><span class="n">reset_index</span><span class="p">()</span><span class="o">.</span><span class="n">to_numpy</span><span class="p">()</span> <th>mag_loop</th>
<span class="n">coords</span> </tr>
</pre></div> </thead>
</div> <tbody>
</div> <tr>
<div class="cell_output docutils container"> <th>0</th>
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([[ 0.58757135, 21.41174601], <td>0.632171</td>
[ 0.56780097, 21.32246601], <td>21.411746</td>
[ 0.54813409, 21.23338001], </tr>
[ 0.5286928 , 21.14442701], <tr>
[ 0.50929987, 21.05454901], <th>1</th>
[ 0.48991266, 20.96383501], <td>0.610238</td>
[ 0.47084777, 20.87386601], <td>21.322466</td>
[ 0.45222635, 20.78511001], </tr>
[ 0.43438902, 20.69865301], <tr>
[ 0.42745198, 20.66469601], <th>2</th>
[ 0.42067029, 20.63135301], <td>0.588449</td>
[ 0.41402867, 20.59850601], <td>21.233380</td>
[ 0.40738016, 20.56529901], </tr>
[ 0.40088387, 20.53264001], <tr>
[ 0.39449608, 20.50023501], <th>3</th>
[ 0.38843797, 20.46871801], <td>0.566924</td>
[ 0.38251577, 20.43765101], <td>21.144427</td>
[ 0.3766547 , 20.40653701], </tr>
[ 0.37088531, 20.37564701], <tr>
[ 0.36522325, 20.34505401], <th>4</th>
[ 0.35962415, 20.31443001], <td>0.545461</td>
[ 0.35413292, 20.28413501], <td>21.054549</td>
[ 0.34871894, 20.25390101], </tr>
[ 0.34339273, 20.22385701], </tbody>
[ 0.33815825, 20.19395801], </table>
[ 0.33305724, 20.16427301], </div></div></div>
[ 0.32820637, 20.13508501],
[ 0.32348139, 20.10604901],
[ 0.31883343, 20.07716101],
[ 0.31425423, 20.04833101],
[ 0.30974976, 20.01961701],
[ 0.30531997, 19.99097001],
[ 0.30097354, 19.96246401],
[ 0.29669999, 19.93401801],
[ 0.29250157, 19.90573101],
[ 0.28837983, 19.87746501],
[ 0.28441584, 19.84955001],
[ 0.28065057, 19.82188301],
[ 0.27700644, 19.79450101],
[ 0.27342328, 19.76713801],
[ 0.26989305, 19.73985301],
[ 0.26641258, 19.71265801],
[ 0.26298257, 19.68540001],
[ 0.25960216, 19.65824401],
[ 0.2562733 , 19.63113701],
[ 0.25299978, 19.60409301],
[ 0.24977307, 19.57714401],
[ 0.24660506, 19.55024001],
[ 0.24348829, 19.52341001],
[ 0.24042159, 19.49666601],
[ 0.23741737, 19.46998501],
[ 0.23447423, 19.44339301],
[ 0.23158726, 19.41688701],
[ 0.22876474, 19.39045101],
[ 0.22600432, 19.36410901],
[ 0.22330395, 19.33786601],
[ 0.220663 , 19.31170101],
[ 0.21808571, 19.28560101],
[ 0.21557456, 19.25960101],
[ 0.21312279, 19.23368701],
[ 0.21073349, 19.20785601],
[ 0.20840975, 19.18210401],
[ 0.20614799, 19.15640601],
[ 0.20395119, 19.13076401],
[ 0.20182156, 19.10523201],
[ 0.19975572, 19.07977101],
[ 0.19775195, 19.05436401],
[ 0.19581903, 19.02902801],
[ 0.19395701, 19.00376101],
[ 0.19216276, 18.97857301],
[ 0.19044513, 18.95347601],
[ 0.1888007 , 18.92850001],
[ 0.18723796, 18.90368201],
[ 0.18576648, 18.87905401],
[ 0.18438763, 18.85466301],
[ 0.18310871, 18.83056001],
[ 0.18193706, 18.80672701],
[ 0.18087817, 18.78327401],
[ 0.17993184, 18.76015001],
[ 0.17910244, 18.73740501],
[ 0.17838817, 18.71496101],
[ 0.17779005, 18.69282101],
[ 0.177312 , 18.67099501],
[ 0.17694971, 18.64944001],
[ 0.1767112 , 18.62815801],
[ 0.17659065, 18.60714001],
[ 0.17658939, 18.58636601],
[ 0.17671618, 18.56585701],
[ 0.17696696, 18.54562201],
[ 0.17733781, 18.52565801],
[ 0.1778346 , 18.50597901],
[ 0.17846661, 18.48656801],
[ 0.17922891, 18.46742401],
[ 0.18012796, 18.44859001],
[ 0.18116197, 18.43005501],
[ 0.18233604, 18.41181501],
[ 0.18363223, 18.39379401],
[ 0.18506009, 18.37602901],
[ 0.18660932, 18.35862101],
[ 0.18829849, 18.34153201],
[ 0.19012805, 18.32480701],
[ 0.19210919, 18.30851301],
[ 0.19422686, 18.29250401],
[ 0.1964951 , 18.27685701],
[ 0.19890209, 18.26156301],
[ 0.20145338, 18.24666001],
[ 0.20417715, 18.23260501],
[ 0.20705285, 18.21898101],
[ 0.21005661, 18.20562501],
[ 0.21319339, 18.19254201],
[ 0.22126873, 18.16185301],
[ 0.2300065 , 18.13259301],
[ 0.23950909, 18.10508001],
[ 0.24974677, 18.07932501],
[ 0.26066153, 18.05527801],
[ 0.27224553, 18.03295501],
[ 0.28447607, 18.01227601],
[ 0.40566013, 18.01227601],
[ 0.39412682, 18.03295501],
[ 0.38329907, 18.05527801],
[ 0.37320316, 18.07932501],
[ 0.36384734, 18.10508001],
[ 0.35529237, 18.13259301],
[ 0.34756872, 18.16185301],
[ 0.34056407, 18.19254201],
[ 0.33788593, 18.20562501],
[ 0.33535176, 18.21898101],
[ 0.33295648, 18.23260501],
[ 0.33072983, 18.24666001],
[ 0.32870734, 18.26156301],
[ 0.32684482, 18.27685701],
[ 0.3251355 , 18.29250401],
[ 0.32359167, 18.30851301],
[ 0.32219665, 18.32480701],
[ 0.32097089, 18.34153201],
[ 0.31990093, 18.35862101],
[ 0.31898485, 18.37602901],
[ 0.3182056 , 18.39379401],
[ 0.31756993, 18.41181501],
[ 0.31706705, 18.43005501],
[ 0.31671781, 18.44859001],
[ 0.3165174 , 18.46742401],
[ 0.31646817, 18.48656801],
[ 0.3165622 , 18.50597901],
[ 0.31680458, 18.52565801],
[ 0.31718682, 18.54562201],
[ 0.31770268, 18.56585701],
[ 0.31835632, 18.58636601],
[ 0.31915162, 18.60714001],
[ 0.32007915, 18.62815801],
[ 0.3211385 , 18.64944001],
[ 0.32233599, 18.67099501],
[ 0.32366367, 18.69282101],
[ 0.32512771, 18.71496101],
[ 0.32672398, 18.73740501],
[ 0.32845154, 18.76015001],
[ 0.33031546, 18.78327401],
[ 0.33230964, 18.80672701],
[ 0.33443651, 18.83056001],
[ 0.3366864 , 18.85466301],
[ 0.3390529 , 18.87905401],
[ 0.34152681, 18.90368201],
[ 0.34410502, 18.92850001],
[ 0.34677677, 18.95347601],
[ 0.34953217, 18.97857301],
[ 0.35237348, 19.00376101],
[ 0.35529144, 19.02902801],
[ 0.35828883, 19.05436401],
[ 0.36136575, 19.07977101],
[ 0.36451277, 19.10523201],
[ 0.36773241, 19.13076401],
[ 0.37102978, 19.15640601],
[ 0.37440044, 19.18210401],
[ 0.37784139, 19.20785601],
[ 0.38135736, 19.23368701],
[ 0.38494552, 19.25960101],
[ 0.388603 , 19.28560101],
[ 0.39233725, 19.31170101],
[ 0.39614435, 19.33786601],
[ 0.40002069, 19.36410901],
[ 0.40396796, 19.39045101],
[ 0.40798805, 19.41688701],
[ 0.41208235, 19.44339301],
[ 0.41624335, 19.46998501],
[ 0.42047622, 19.49666601],
[ 0.42478124, 19.52341001],
[ 0.42914714, 19.55024001],
[ 0.43357463, 19.57714401],
[ 0.43806989, 19.60409301],
[ 0.44262347, 19.63113701],
[ 0.44724247, 19.65824401],
[ 0.4519225 , 19.68540001],
[ 0.45666424, 19.71265801],
[ 0.46146067, 19.73985301],
[ 0.46631851, 19.76713801],
[ 0.47124047, 19.79450101],
[ 0.47623175, 19.82188301],
[ 0.48136578, 19.84955001],
[ 0.48671855, 19.87746501],
[ 0.49225451, 19.90573101],
[ 0.49787627, 19.93401801],
[ 0.50358931, 19.96246401],
[ 0.50938655, 19.99097001],
[ 0.51528266, 20.01961701],
[ 0.52126534, 20.04833101],
[ 0.52733726, 20.07716101],
[ 0.53348957, 20.10604901],
[ 0.53973535, 20.13508501],
[ 0.54612384, 20.16427301],
[ 0.55279781, 20.19395801],
[ 0.55962597, 20.22385701],
[ 0.56656311, 20.25390101],
[ 0.57360789, 20.28413501],
[ 0.58074299, 20.31443001],
[ 0.5880138 , 20.34505401],
[ 0.59535596, 20.37564701],
[ 0.60283203, 20.40653701],
[ 0.61042265, 20.43765101],
[ 0.61808231, 20.46871801],
[ 0.62591386, 20.50023501],
[ 0.63413647, 20.53264001],
[ 0.64249372, 20.56529901],
[ 0.65104657, 20.59850601],
[ 0.659584 , 20.63135301],
[ 0.66830253, 20.66469601],
[ 0.67722496, 20.69865301],
[ 0.70017638, 20.78511001],
[ 0.72413715, 20.87386601],
[ 0.74870785, 20.96383501],
[ 0.77374297, 21.05454901],
[ 0.7988286 , 21.14442701],
[ 0.8240001 , 21.23338001],
[ 0.84950281, 21.32246601],
[ 0.8752204 , 21.41174601]])
</pre></div>
</div>
</div>
</div> </div>
<div class="section" id="id3"> <div class="section" id="id3">
<h3>Exercise<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3> <h3>Exercise<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
@@ -1235,7 +1004,7 @@ Name: g, Length: 234, dtype: float64
<div class="cell_input docutils container"> <div class="cell_input docutils container">
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span> <div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="c1"># Solution</span>
<span class="c1"># poly = Polygon(coords, closed=True, </span> <span class="c1"># poly = Polygon(loop_df, closed=True, </span>
<span class="c1"># facecolor=&#39;C1&#39;, alpha=0.4)</span> <span class="c1"># facecolor=&#39;C1&#39;, alpha=0.4)</span>
<span class="c1"># plt.gca().add_patch(poly)</span> <span class="c1"># plt.gca().add_patch(poly)</span>
</pre></div> </pre></div>
@@ -1261,14 +1030,14 @@ Name: g, Length: 234, dtype: float64
<span class="n">plot_first_selection</span><span class="p">(</span><span class="n">candidate_df</span><span class="p">)</span> <span class="n">plot_first_selection</span><span class="p">(</span><span class="n">candidate_df</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline</span><span class="p">)</span> <span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline_df</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span>
<span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span> <span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected2</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">))</span>
<span class="n">plot_cmd</span><span class="p">(</span><span class="n">merged</span><span class="p">)</span> <span class="n">plot_cmd</span><span class="p">(</span><span class="n">merged</span><span class="p">)</span>
<span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">coords</span><span class="p">,</span> <span class="n">closed</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">loop_df</span><span class="p">,</span> <span class="n">closed</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">facecolor</span><span class="o">=</span><span class="s1">&#39;C1&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span> <span class="n">facecolor</span><span class="o">=</span><span class="s1">&#39;C1&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">poly</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">poly</span><span class="p">)</span>
@@ -1277,7 +1046,7 @@ Name: g, Length: 234, dtype: float64
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/07_plot_76_0.png" src="_images/07_plot_76_0.png" /> <img alt="_images/07_plot_75_0.png" src="_images/07_plot_75_0.png" />
</div> </div>
</div> </div>
<p>We use <a class="reference external" href="https://matplotlib.org/3.3.1/tutorials/intermediate/tight_layout_guide.html"><code class="docutils literal notranslate"><span class="pre">plt.tight_layout</span></code></a> at the end, which adjusts the sizes of the panels to make sure the titles and axis labels dont overlap.</p> <p>We use <a class="reference external" href="https://matplotlib.org/3.3.1/tutorials/intermediate/tight_layout_guide.html"><code class="docutils literal notranslate"><span class="pre">plt.tight_layout</span></code></a> at the end, which adjusts the sizes of the panels to make sure the titles and axis labels dont overlap.</p>
@@ -1299,14 +1068,14 @@ Name: g, Length: 234, dtype: float64
<span class="n">plot_first_selection</span><span class="p">(</span><span class="n">candidate_df</span><span class="p">)</span> <span class="n">plot_first_selection</span><span class="p">(</span><span class="n">candidate_df</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline</span><span class="p">)</span> <span class="n">plot_proper_motion</span><span class="p">(</span><span class="n">centerline_df</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">colspan</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected</span><span class="p">)</span> <span class="n">plot_second_selection</span><span class="p">(</span><span class="n">selected2</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplot2grid</span><span class="p">(</span><span class="n">shape</span><span class="p">,</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="n">plot_cmd</span><span class="p">(</span><span class="n">merged</span><span class="p">)</span> <span class="n">plot_cmd</span><span class="p">(</span><span class="n">merged</span><span class="p">)</span>
<span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">coords</span><span class="p">,</span> <span class="n">closed</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">poly</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">(</span><span class="n">loop_df</span><span class="p">,</span> <span class="n">closed</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span>
<span class="n">facecolor</span><span class="o">=</span><span class="s1">&#39;C1&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span> <span class="n">facecolor</span><span class="o">=</span><span class="s1">&#39;C1&#39;</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.4</span><span class="p">)</span>
<span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">poly</span><span class="p">)</span> <span class="n">plt</span><span class="o">.</span><span class="n">gca</span><span class="p">()</span><span class="o">.</span><span class="n">add_patch</span><span class="p">(</span><span class="n">poly</span><span class="p">)</span>
@@ -1315,7 +1084,7 @@ Name: g, Length: 234, dtype: float64
</div> </div>
</div> </div>
<div class="cell_output docutils container"> <div class="cell_output docutils container">
<img alt="_images/07_plot_79_0.png" src="_images/07_plot_79_0.png" /> <img alt="_images/07_plot_78_0.png" src="_images/07_plot_78_0.png" />
</div> </div>
</div> </div>
<p>This is looking more and more like the figure in the paper.</p> <p>This is looking more and more like the figure in the paper.</p>
@@ -1333,10 +1102,10 @@ Name: g, Length: 234, dtype: float64
<span class="c1"># plot_first_selection(candidate_df)</span> <span class="c1"># plot_first_selection(candidate_df)</span>
<span class="c1"># plt.subplot2grid(shape, (0, 3), colspan=2) # CHANGED</span> <span class="c1"># plt.subplot2grid(shape, (0, 3), colspan=2) # CHANGED</span>
<span class="c1"># plot_proper_motion(centerline)</span> <span class="c1"># plot_proper_motion(centerline_df)</span>
<span class="c1"># plt.subplot2grid(shape, (1, 0), colspan=3)</span> <span class="c1"># plt.subplot2grid(shape, (1, 0), colspan=3)</span>
<span class="c1"># plot_second_selection(selected)</span> <span class="c1"># plot_second_selection(selected2)</span>
<span class="c1"># plt.subplot2grid(shape, (1, 3), colspan=2) # CHANGED</span> <span class="c1"># plt.subplot2grid(shape, (1, 3), colspan=2) # CHANGED</span>
<span class="c1"># plot_cmd(merged)</span> <span class="c1"># plot_cmd(merged)</span>

BIN
_images/03_motion_100_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
_images/03_motion_43_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
_images/03_motion_90_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_images/04_select_13_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
_images/04_select_15_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
_images/04_select_29_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
_images/04_select_57_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
_images/04_select_63_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
_images/06_photo_106_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
_images/06_photo_108_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
_images/06_photo_44_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
_images/06_photo_54_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
_images/06_photo_64_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 37 KiB

BIN
_images/07_plot_75_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

BIN
_images/07_plot_78_0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

View File

@@ -397,7 +397,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -412,10 +412,10 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<astroquery.utils.tap.model.taptable.TapTableMeta at 0x7eff7a9d80a0>" "<astroquery.utils.tap.model.taptable.TapTableMeta at 0x7f2e23f089d0>"
] ]
}, },
"execution_count": 63, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -436,7 +436,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -468,7 +468,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 7,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-output", "hide-output",
@@ -605,7 +605,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 44, "execution_count": 8,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -616,6 +616,76 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Retrieving table 'gaiadr2.panstarrs1_original_valid'\n",
"Parsing table 'gaiadr2.panstarrs1_original_valid'...\n",
"Done.\n",
"TAP Table name: gaiadr2.gaiadr2.panstarrs1_original_valid\n",
"Description: The Panoramic Survey Telescope and Rapid Response System (Pan-STARRS) is\n",
"a system for wide-field astronomical imaging developed and operated by\n",
"the Institute for Astronomy at the University of Hawaii. Pan-STARRS1\n",
"(PS1) is the first part of Pan-STARRS to be completed and is the basis\n",
"for Data Release 1 (DR1). The PS1 survey used a 1.8 meter telescope and\n",
"its 1.4 Gigapixel camera to image the sky in five broadband filters (g,\n",
"r, i, z, y).\n",
"\n",
"The current table contains a filtered subsample of the 10723304629\n",
"entries listed in the original ObjectThin table.\n",
"We used only ObjectThin and MeanObject tables to extract\n",
"panstarrs1OriginalValid table, this means that objects detected only in\n",
"stack images are not included here. The main reason for us to avoid the\n",
"use of objects detected in stack images is that their astrometry is not\n",
"as good as the mean objects astrometry: “The stack positions (raStack,\n",
"decStack) have considerably larger systematic astrometric errors than\n",
"the mean epoch positions (raMean, decMean).” The astrometry for the\n",
"MeanObject positions uses Gaia DR1 as a reference catalog, while the\n",
"stack positions use 2MASS as a reference catalog.\n",
"\n",
"In details, we filtered out all objects where:\n",
"\n",
"- nDetections = 1\n",
"\n",
"- no good quality data in Pan-STARRS, objInfoFlag 33554432 not set\n",
"\n",
"- mean astrometry could not be measured, objInfoFlag 524288 set\n",
"\n",
"- stack position used for mean astrometry, objInfoFlag 1048576 set\n",
"\n",
"- error on all magnitudes equal to 0 or to -999;\n",
"\n",
"- all magnitudes set to -999;\n",
"\n",
"- error on RA or DEC greater than 1 arcsec.\n",
"\n",
"The number of objects in panstarrs1OriginalValid is 2264263282.\n",
"\n",
"The panstarrs1OriginalValid table contains only a subset of the columns\n",
"available in the combined ObjectThin and MeanObject tables. A\n",
"description of the original ObjectThin and MeanObjects tables can be\n",
"found at:\n",
"https://outerspace.stsci.edu/display/PANSTARRS/PS1+Database+object+and+detection+tables\n",
"\n",
"Download:\n",
"http://mastweb.stsci.edu/ps1casjobs/home.aspx\n",
"Documentation:\n",
"https://outerspace.stsci.edu/display/PANSTARRS\n",
"http://pswww.ifa.hawaii.edu/pswww/\n",
"References:\n",
"The Pan-STARRS1 Surveys, Chambers, K.C., et al. 2016, arXiv:1612.05560\n",
"Pan-STARRS Data Processing System, Magnier, E. A., et al. 2016,\n",
"arXiv:1612.05240\n",
"Pan-STARRS Pixel Processing: Detrending, Warping, Stacking, Waters, C.\n",
"Z., et al. 2016, arXiv:1612.05245\n",
"Pan-STARRS Pixel Analysis: Source Detection and Characterization,\n",
"Magnier, E. A., et al. 2016, arXiv:1612.05244\n",
"Pan-STARRS Photometric and Astrometric Calibration, Magnier, E. A., et\n",
"al. 2016, arXiv:1612.05242\n",
"The Pan-STARRS1 Database and Data Products, Flewelling, H. A., et al.\n",
"2016, arXiv:1612.05243\n",
"\n",
"Catalogue curator:\n",
"SSDC - ASI Space Science Data Center\n",
"https://www.ssdc.asi.it/\n",
"Num. columns: 26\n",
"obj_name\n", "obj_name\n",
"obj_id\n", "obj_id\n",
"ra\n", "ra\n",
@@ -670,7 +740,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 45, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -708,16 +778,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 46, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<astroquery.utils.tap.model.job.Job at 0x7eff7aa87d00>" "<astroquery.utils.tap.model.job.Job at 0x7f2e23f2afa0>"
] ]
}, },
"execution_count": 46, "execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -738,7 +808,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 47, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -752,11 +822,11 @@
"ref_epoch float64 yr Reference epoch 0\n", "ref_epoch float64 yr Reference epoch 0\n",
" ra float64 deg Right ascension 0\n", " ra float64 deg Right ascension 0\n",
" dec float64 deg Declination 0\n", " dec float64 deg Declination 0\n",
" parallax float64 mas Parallax 5\n", " parallax float64 mas Parallax 2\n",
"Jobid: None\n", "Jobid: None\n",
"Phase: COMPLETED\n", "Phase: COMPLETED\n",
"Owner: None\n", "Owner: None\n",
"Output file: sync_20201203154608.xml.gz\n", "Output file: sync_20201229114647.xml.gz\n",
"Results: None\n" "Results: None\n"
] ]
} }
@@ -776,7 +846,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 48, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -785,7 +855,7 @@
"astropy.table.table.Table" "astropy.table.table.Table"
] ]
}, },
"execution_count": 48, "execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -817,27 +887,27 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 49, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=10</i>\n", "<i>Table length=10</i>\n",
"<table id=\"table139635743203392\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139836148327136\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>\n", "<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>\n",
"<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>\n", "<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>\n",
"<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n", "<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n",
"<tr><td>5958819901197208576</td><td>2015.5</td><td>261.7857283398199</td><td>-42.03004488213482</td><td>-0.5002044267802102</td></tr>\n", "<tr><td>6758509757594141440</td><td>2015.5</td><td>290.4899010727352</td><td>-30.34317218420783</td><td>0.48023816159705535</td></tr>\n",
"<tr><td>5958821378666779136</td><td>2015.5</td><td>261.62657416766683</td><td>-42.0248496385989</td><td>--</td></tr>\n", "<tr><td>6758508692437976960</td><td>2015.5</td><td>290.64176055082714</td><td>-30.28972013142225</td><td>2.2625971293368154</td></tr>\n",
"<tr><td>5958828525443694976</td><td>2015.5</td><td>264.1345018277737</td><td>-43.16302120806172</td><td>--</td></tr>\n", "<tr><td>6758527036250849280</td><td>2015.5</td><td>290.35703708993327</td><td>-30.193657826181596</td><td>-0.2763960334229464</td></tr>\n",
"<tr><td>5958821103796633472</td><td>2015.5</td><td>261.6583640022332</td><td>-42.036988110447425</td><td>--</td></tr>\n", "<tr><td>6758564458298242944</td><td>2015.5</td><td>290.77376294142846</td><td>-29.765368439225238</td><td>0.5907906528352993</td></tr>\n",
"<tr><td>5958823886946980352</td><td>2015.5</td><td>261.65568041401264</td><td>-41.922401166547274</td><td>--</td></tr>\n", "<tr><td>6758558612842155776</td><td>2015.5</td><td>290.67550630386245</td><td>-29.92113396078169</td><td>0.2858563565989917</td></tr>\n",
"<tr><td>5958822890506247552</td><td>2015.5</td><td>261.55820707086946</td><td>-41.95720763183602</td><td>--</td></tr>\n", "<tr><td>6758556379459921920</td><td>2015.5</td><td>290.5454006212404</td><td>-29.900709054816964</td><td>-1.0012355835832834</td></tr>\n",
"<tr><td>5958825944161775616</td><td>2015.5</td><td>264.1886024158743</td><td>-43.322283668549964</td><td>0.3111803012975799</td></tr>\n", "<tr><td>6758537520260385152</td><td>2015.5</td><td>290.7341683169994</td><td>-30.158181298418626</td><td>--</td></tr>\n",
"<tr><td>5958839726713099904</td><td>2015.5</td><td>263.94936860247236</td><td>-42.99642220007396</td><td>0.34188414063767153</td></tr>\n", "<tr><td>6758506355980010624</td><td>2015.5</td><td>290.586950869878</td><td>-30.37137642167569</td><td>0.3769870991981157</td></tr>\n",
"<tr><td>5958828559794975744</td><td>2015.5</td><td>264.1060944261551</td><td>-43.24271464140307</td><td>0.19982119290900674</td></tr>\n", "<tr><td>6758561606433968128</td><td>2015.5</td><td>290.82697136098506</td><td>-29.75247697212053</td><td>--</td></tr>\n",
"<tr><td>5958831720947299072</td><td>2015.5</td><td>263.9019720829655</td><td>-43.154506897707854</td><td>0.7055097280886358</td></tr>\n", "<tr><td>6758564183414408448</td><td>2015.5</td><td>290.7133096669958</td><td>-29.781743673679607</td><td>0.9376387942856869</td></tr>\n",
"</table>" "</table>"
], ],
"text/plain": [ "text/plain": [
@@ -846,19 +916,19 @@
" yr ... deg mas \n", " yr ... deg mas \n",
" int64 float64 ... float64 float64 \n", " int64 float64 ... float64 float64 \n",
"------------------- --------- ... ------------------- -------------------\n", "------------------- --------- ... ------------------- -------------------\n",
"5958819901197208576 2015.5 ... -42.03004488213482 -0.5002044267802102\n", "6758509757594141440 2015.5 ... -30.34317218420783 0.48023816159705535\n",
"5958821378666779136 2015.5 ... -42.0248496385989 --\n", "6758508692437976960 2015.5 ... -30.28972013142225 2.2625971293368154\n",
"5958828525443694976 2015.5 ... -43.16302120806172 --\n", "6758527036250849280 2015.5 ... -30.193657826181596 -0.2763960334229464\n",
"5958821103796633472 2015.5 ... -42.036988110447425 --\n", "6758564458298242944 2015.5 ... -29.765368439225238 0.5907906528352993\n",
"5958823886946980352 2015.5 ... -41.922401166547274 --\n", "6758558612842155776 2015.5 ... -29.92113396078169 0.2858563565989917\n",
"5958822890506247552 2015.5 ... -41.95720763183602 --\n", "6758556379459921920 2015.5 ... -29.900709054816964 -1.0012355835832834\n",
"5958825944161775616 2015.5 ... -43.322283668549964 0.3111803012975799\n", "6758537520260385152 2015.5 ... -30.158181298418626 --\n",
"5958839726713099904 2015.5 ... -42.99642220007396 0.34188414063767153\n", "6758506355980010624 2015.5 ... -30.37137642167569 0.3769870991981157\n",
"5958828559794975744 2015.5 ... -43.24271464140307 0.19982119290900674\n", "6758561606433968128 2015.5 ... -29.75247697212053 --\n",
"5958831720947299072 2015.5 ... -43.154506897707854 0.7055097280886358" "6758564183414408448 2015.5 ... -29.781743673679607 0.9376387942856869"
] ]
}, },
"execution_count": 49, "execution_count": 13,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -889,7 +959,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -919,7 +989,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 50, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -943,7 +1013,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -959,10 +1029,10 @@
" ra float64 deg Right ascension\n", " ra float64 deg Right ascension\n",
" dec float64 deg Declination\n", " dec float64 deg Declination\n",
" parallax float64 mas Parallax\n", " parallax float64 mas Parallax\n",
"Jobid: 1607028117072O\n", "Jobid: 1609260407863O\n",
"Phase: COMPLETED\n", "Phase: COMPLETED\n",
"Owner: None\n", "Owner: None\n",
"Output file: async_20201203154157.vot\n", "Output file: async_20201229114648.vot\n",
"Results: None\n" "Results: None\n"
] ]
} }
@@ -981,37 +1051,37 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=3000</i>\n", "<i>Table length=3000</i>\n",
"<table id=\"table139635740092688\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139836145366016\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>\n", "<thead><tr><th>source_id</th><th>ref_epoch</th><th>ra</th><th>dec</th><th>parallax</th></tr></thead>\n",
"<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>\n", "<thead><tr><th></th><th>yr</th><th>deg</th><th>deg</th><th>mas</th></tr></thead>\n",
"<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n", "<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n",
"<tr><td>6101968476761520256</td><td>2015.5</td><td>222.97412023194306</td><td>-40.712359294192744</td><td>0.9580315447630948</td></tr>\n", "<tr><td>6758509757594141440</td><td>2015.5</td><td>290.4899010727352</td><td>-30.34317218420783</td><td>0.48023816159705535</td></tr>\n",
"<tr><td>6102006203756731136</td><td>2015.5</td><td>223.3837572031525</td><td>-40.18295977800455</td><td>0.4654078698855609</td></tr>\n", "<tr><td>6758527036250849280</td><td>2015.5</td><td>290.35703708993327</td><td>-30.193657826181596</td><td>-0.2763960334229464</td></tr>\n",
"<tr><td>6101999537971250816</td><td>2015.5</td><td>223.39452656831827</td><td>-40.38078271831785</td><td>0.6324535932708285</td></tr>\n", "<tr><td>6758564458298242944</td><td>2015.5</td><td>290.77376294142846</td><td>-29.765368439225238</td><td>0.5907906528352993</td></tr>\n",
"<tr><td>6101989230045046912</td><td>2015.5</td><td>222.9349537562596</td><td>-40.30216757702745</td><td>-0.1120282976060022</td></tr>\n", "<tr><td>6758558612842155776</td><td>2015.5</td><td>290.67550630386245</td><td>-29.92113396078169</td><td>0.2858563565989917</td></tr>\n",
"<tr><td>6102019432256470144</td><td>2015.5</td><td>223.2987634951956</td><td>-40.07122353409279</td><td>0.4252570435065329</td></tr>\n", "<tr><td>6758556379459921920</td><td>2015.5</td><td>290.5454006212404</td><td>-29.900709054816964</td><td>-1.0012355835832834</td></tr>\n",
"<tr><td>6101990020319424768</td><td>2015.5</td><td>222.89497451675032</td><td>-40.29644668414232</td><td>-0.5473391189616934</td></tr>\n", "<tr><td>6758506355980010624</td><td>2015.5</td><td>290.586950869878</td><td>-30.37137642167569</td><td>0.3769870991981157</td></tr>\n",
"<tr><td>6102009914608095744</td><td>2015.5</td><td>223.08065715961308</td><td>-40.2690582632144</td><td>-0.37215204032841775</td></tr>\n", "<tr><td>6758564183414408448</td><td>2015.5</td><td>290.7133096669958</td><td>-29.781743673679607</td><td>0.9376387942856869</td></tr>\n",
"<tr><td>6101991463427276160</td><td>2015.5</td><td>223.29761379788724</td><td>-40.50754907738312</td><td>0.845560802664492</td></tr>\n", "<tr><td>6758529789322653184</td><td>2015.5</td><td>290.35449465190385</td><td>-30.10231481465004</td><td>-1.3305133038319952</td></tr>\n",
"<tr><td>6102028571944992000</td><td>2015.5</td><td>222.70417749659205</td><td>-40.42670615599747</td><td>-0.6195307007338599</td></tr>\n", "<tr><td>6758507485555336064</td><td>2015.5</td><td>290.6745961953205</td><td>-30.35965148061028</td><td>0.057302711920868686</td></tr>\n",
"<tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr>\n", "<tr><td>...</td><td>...</td><td>...</td><td>...</td><td>...</td></tr>\n",
"<tr><td>2266125732937920640</td><td>2015.5</td><td>282.3511779667985</td><td>72.58152826290214</td><td>0.611248163129301</td></tr>\n", "<tr><td>4660464894038295424</td><td>2015.5</td><td>79.74509945051724</td><td>-66.49656012737759</td><td>0.1631257821260955</td></tr>\n",
"<tr><td>2266098932341998336</td><td>2015.5</td><td>282.4753368202474</td><td>72.42703933645112</td><td>-0.07096965217830103</td></tr>\n", "<tr><td>4660463519650480128</td><td>2015.5</td><td>80.06150680482719</td><td>-66.42891601595986</td><td>-0.5822669736733328</td></tr>\n",
"<tr><td>5844916131519471872</td><td>2015.5</td><td>192.9660362377181</td><td>-69.57840395657252</td><td>0.3439372751682742</td></tr>\n", "<tr><td>4660487674554071040</td><td>2015.5</td><td>80.03536662790846</td><td>-66.33136792885134</td><td>-1.4978065466579966</td></tr>\n",
"<tr><td>5844905857953792768</td><td>2015.5</td><td>193.68288866724032</td><td>-69.49181695753501</td><td>0.07481443392415044</td></tr>\n", "<tr><td>4660494718300886784</td><td>2015.5</td><td>79.6181997343967</td><td>-66.17472335318212</td><td>0.1488652133861382</td></tr>\n",
"<tr><td>5844885242102786688</td><td>2015.5</td><td>194.6557957952714</td><td>-69.47882731331919</td><td>0.34993373247988196</td></tr>\n", "<tr><td>4660476473274159360</td><td>2015.5</td><td>79.12508291180023</td><td>-66.35644844757275</td><td>0.10671540523101529</td></tr>\n",
"<tr><td>5844898882924614272</td><td>2015.5</td><td>193.25908185345685</td><td>-69.73387320199522</td><td>0.8081386490572667</td></tr>\n", "<tr><td>4660471010093940224</td><td>2015.5</td><td>79.1908378165463</td><td>-66.48916840294096</td><td>0.8152150079365807</td></tr>\n",
"<tr><td>5844868680708131712</td><td>2015.5</td><td>194.68567535488484</td><td>-69.6114926600852</td><td>0.8402524443841332</td></tr>\n", "<tr><td>4660498394807167744</td><td>2015.5</td><td>80.23431532382547</td><td>-66.08688681815092</td><td>-0.14060596426163252</td></tr>\n",
"<tr><td>5844898814205127552</td><td>2015.5</td><td>193.29020065769623</td><td>-69.74069115214805</td><td>0.10499541379687834</td></tr>\n", "<tr><td>4660498738391722880</td><td>2015.5</td><td>80.20205898946918</td><td>-66.04392313295126</td><td>0.1894642263668475</td></tr>\n",
"<tr><td>5844874728027086336</td><td>2015.5</td><td>195.95342635179594</td><td>-69.43994738640447</td><td>-0.8998207133359908</td></tr>\n", "<tr><td>4660474068091096960</td><td>2015.5</td><td>78.93686107060341</td><td>-66.45795576745896</td><td>0.4665513634059366</td></tr>\n",
"<tr><td>5844875174699986048</td><td>2015.5</td><td>195.7213758541214</td><td>-69.45438843217347</td><td>0.04510342308702224</td></tr>\n", "<tr><td>4660437303162697728</td><td>2015.5</td><td>80.63872120225027</td><td>-66.46144560233674</td><td>-1.1319163320535979</td></tr>\n",
"</table>" "</table>"
], ],
"text/plain": [ "text/plain": [
@@ -1020,29 +1090,29 @@
" yr ... deg mas \n", " yr ... deg mas \n",
" int64 float64 ... float64 float64 \n", " int64 float64 ... float64 float64 \n",
"------------------- --------- ... ------------------- --------------------\n", "------------------- --------- ... ------------------- --------------------\n",
"6101968476761520256 2015.5 ... -40.712359294192744 0.9580315447630948\n", "6758509757594141440 2015.5 ... -30.34317218420783 0.48023816159705535\n",
"6102006203756731136 2015.5 ... -40.18295977800455 0.4654078698855609\n", "6758527036250849280 2015.5 ... -30.193657826181596 -0.2763960334229464\n",
"6101999537971250816 2015.5 ... -40.38078271831785 0.6324535932708285\n", "6758564458298242944 2015.5 ... -29.765368439225238 0.5907906528352993\n",
"6101989230045046912 2015.5 ... -40.30216757702745 -0.1120282976060022\n", "6758558612842155776 2015.5 ... -29.92113396078169 0.2858563565989917\n",
"6102019432256470144 2015.5 ... -40.07122353409279 0.4252570435065329\n", "6758556379459921920 2015.5 ... -29.900709054816964 -1.0012355835832834\n",
"6101990020319424768 2015.5 ... -40.29644668414232 -0.5473391189616934\n", "6758506355980010624 2015.5 ... -30.37137642167569 0.3769870991981157\n",
"6102009914608095744 2015.5 ... -40.2690582632144 -0.37215204032841775\n", "6758564183414408448 2015.5 ... -29.781743673679607 0.9376387942856869\n",
"6101991463427276160 2015.5 ... -40.50754907738312 0.845560802664492\n", "6758529789322653184 2015.5 ... -30.10231481465004 -1.3305133038319952\n",
"6102028571944992000 2015.5 ... -40.42670615599747 -0.6195307007338599\n", "6758507485555336064 2015.5 ... -30.35965148061028 0.057302711920868686\n",
" ... ... ... ... ...\n", " ... ... ... ... ...\n",
"2266125732937920640 2015.5 ... 72.58152826290214 0.611248163129301\n", "4660464894038295424 2015.5 ... -66.49656012737759 0.1631257821260955\n",
"2266098932341998336 2015.5 ... 72.42703933645112 -0.07096965217830103\n", "4660463519650480128 2015.5 ... -66.42891601595986 -0.5822669736733328\n",
"5844916131519471872 2015.5 ... -69.57840395657252 0.3439372751682742\n", "4660487674554071040 2015.5 ... -66.33136792885134 -1.4978065466579966\n",
"5844905857953792768 2015.5 ... -69.49181695753501 0.07481443392415044\n", "4660494718300886784 2015.5 ... -66.17472335318212 0.1488652133861382\n",
"5844885242102786688 2015.5 ... -69.47882731331919 0.34993373247988196\n", "4660476473274159360 2015.5 ... -66.35644844757275 0.10671540523101529\n",
"5844898882924614272 2015.5 ... -69.73387320199522 0.8081386490572667\n", "4660471010093940224 2015.5 ... -66.48916840294096 0.8152150079365807\n",
"5844868680708131712 2015.5 ... -69.6114926600852 0.8402524443841332\n", "4660498394807167744 2015.5 ... -66.08688681815092 -0.14060596426163252\n",
"5844898814205127552 2015.5 ... -69.74069115214805 0.10499541379687834\n", "4660498738391722880 2015.5 ... -66.04392313295126 0.1894642263668475\n",
"5844874728027086336 2015.5 ... -69.43994738640447 -0.8998207133359908\n", "4660474068091096960 2015.5 ... -66.45795576745896 0.4665513634059366\n",
"5844875174699986048 2015.5 ... -69.45438843217347 0.04510342308702224" "4660437303162697728 2015.5 ... -66.46144560233674 -1.1319163320535979"
] ]
}, },
"execution_count": 18, "execution_count": 17,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1082,7 +1152,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1130,7 +1200,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 53, "execution_count": 19,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -1181,16 +1251,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"(None, '1607028117072O')" "(None, '1609260407863O')"
] ]
}, },
"execution_count": 21, "execution_count": 20,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1208,7 +1278,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 21,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -1217,7 +1287,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"Removed jobs: '['1607028117072O']'.\n" "Removed jobs: '['1609260407863O']'.\n"
] ]
} }
], ],
@@ -1250,7 +1320,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 54, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1266,7 +1336,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 55, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1289,7 +1359,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1305,7 +1375,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 57, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1314,7 +1384,7 @@
"'SELECT TOP 10 \\nsource_id, ra, dec, pmra, pmdec, parallax, radial_velocity\\nFROM gaiadr2.gaia_source\\nWHERE parallax < 1\\n AND bp_rp BETWEEN -0.75 AND 2\\n'" "'SELECT TOP 10 \\nsource_id, ra, dec, pmra, pmdec, parallax, radial_velocity\\nFROM gaiadr2.gaia_source\\nWHERE parallax < 1\\n AND bp_rp BETWEEN -0.75 AND 2\\n'"
] ]
}, },
"execution_count": 57, "execution_count": 25,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1332,7 +1402,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 58, "execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1363,7 +1433,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 59, "execution_count": 27,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -1381,11 +1451,11 @@
" pmra float64 mas / yr Proper motion in right ascension direction 0\n", " pmra float64 mas / yr Proper motion in right ascension direction 0\n",
" pmdec float64 mas / yr Proper motion in declination direction 0\n", " pmdec float64 mas / yr Proper motion in declination direction 0\n",
" parallax float64 mas Parallax 0\n", " parallax float64 mas Parallax 0\n",
"radial_velocity float64 km / s Radial velocity 9\n", "radial_velocity float64 km / s Radial velocity 10\n",
"Jobid: None\n", "Jobid: None\n",
"Phase: COMPLETED\n", "Phase: COMPLETED\n",
"Owner: None\n", "Owner: None\n",
"Output file: sync_20201203155727.xml.gz\n", "Output file: sync_20201229114653.xml.gz\n",
"Results: None\n" "Results: None\n"
] ]
} }
@@ -1397,48 +1467,48 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=10</i>\n", "<i>Table length=10</i>\n",
"<table id=\"table139635739621120\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139836148327184\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>radial_velocity</th></tr></thead>\n", "<thead><tr><th>source_id</th><th>ra</th><th>dec</th><th>pmra</th><th>pmdec</th><th>parallax</th><th>radial_velocity</th></tr></thead>\n",
"<thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>km / s</th></tr></thead>\n", "<thead><tr><th></th><th>deg</th><th>deg</th><th>mas / yr</th><th>mas / yr</th><th>mas</th><th>km / s</th></tr></thead>\n",
"<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n", "<thead><tr><th>int64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th><th>float64</th></tr></thead>\n",
"<tr><td>5933096203842096896</td><td>243.78205426182762</td><td>-53.059795438840304</td><td>-2.424817873751699</td><td>-4.466522248547865</td><td>0.5068567863750518</td><td>-42.33885843170957</td></tr>\n", "<tr><td>4660466371507774848</td><td>79.49100199261952</td><td>-66.41411777672668</td><td>2.6073927760139983</td><td>-1.1968907801968522</td><td>-0.13534455558687877</td><td>--</td></tr>\n",
"<tr><td>5933101877528899712</td><td>243.97057838444422</td><td>-52.986714478669484</td><td>-2.1222196983029993</td><td>-3.0754927489169264</td><td>0.23373208336686707</td><td>--</td></tr>\n", "<tr><td>4660498704031984000</td><td>80.19346436358076</td><td>-66.04907675232856</td><td>1.644062563874402</td><td>-1.954975321006136</td><td>-0.1774586376397</td><td>--</td></tr>\n",
"<tr><td>5933092909682644736</td><td>243.79077939157932</td><td>-53.210873915640164</td><td>-3.247331739283727</td><td>-3.0721472876242912</td><td>0.22141430054832106</td><td>--</td></tr>\n", "<tr><td>4660458949824817024</td><td>79.68666778641992</td><td>-66.52220959662557</td><td>1.4777697275880581</td><td>0.3328961930362448</td><td>-0.030149510331454386</td><td>--</td></tr>\n",
"<tr><td>5933099403674089344</td><td>244.10992316666963</td><td>-52.99682662964451</td><td>-7.42237468704238</td><td>0.9808177052973058</td><td>-0.5694816136281146</td><td>--</td></tr>\n", "<tr><td>4660451974773926528</td><td>79.89972073493868</td><td>-66.75037858071191</td><td>2.4635048563021065</td><td>-0.7474574729840501</td><td>-0.005219591141134416</td><td>--</td></tr>\n",
"<tr><td>5933099712864927488</td><td>244.14352482183628</td><td>-53.00718804864607</td><td>-1.8469803654970902</td><td>-2.061311622119096</td><td>-0.15119359534047053</td><td>--</td></tr>\n", "<tr><td>4660474033731357056</td><td>78.93214036467484</td><td>-66.46483644591667</td><td>1.2369118132455594</td><td>-1.7187143034638677</td><td>0.6018032937392243</td><td>--</td></tr>\n",
"<tr><td>5933100430094343296</td><td>244.05583528078185</td><td>-52.97056623530601</td><td>-2.4175778689836607</td><td>-1.7741006184538501</td><td>0.6126293653016116</td><td>--</td></tr>\n", "<tr><td>4660454105077874688</td><td>79.91045649235578</td><td>-66.68106846135971</td><td>1.4747855407533677</td><td>0.022464361420165786</td><td>-0.19949109843083218</td><td>--</td></tr>\n",
"<tr><td>5933090195214793088</td><td>244.0040474187424</td><td>-53.2398318316935</td><td>-1.9355723547012178</td><td>-3.2456307745304516</td><td>-0.5994721050902905</td><td>--</td></tr>\n", "<tr><td>4660494855753740544</td><td>79.63101881952036</td><td>-66.15063315813536</td><td>1.6227863263222113</td><td>0.20490893261905152</td><td>0.0013030724292998944</td><td>--</td></tr>\n",
"<tr><td>5933092359874146816</td><td>243.77339485386585</td><td>-53.25788614096572</td><td>1.205055772227777</td><td>-3.1082961813495587</td><td>-1.5130414932866274</td><td>--</td></tr>\n", "<tr><td>4660439536571308160</td><td>80.24817961417894</td><td>-66.46303270664092</td><td>1.8652105429518493</td><td>-0.5618584442373111</td><td>-0.10578442360531497</td><td>--</td></tr>\n",
"<tr><td>5933093974783111808</td><td>243.7622231489827</td><td>-53.164944966614065</td><td>-4.665032988958056</td><td>-1.8667474849003503</td><td>-0.0273302633914116</td><td>--</td></tr>\n", "<tr><td>4660470185440466560</td><td>79.25942306061864</td><td>-66.51120777549605</td><td>3.373561172003989</td><td>0.25326243152876704</td><td>-0.6932631338638376</td><td>--</td></tr>\n",
"<tr><td>4118427651760743808</td><td>264.39377925009563</td><td>-20.39238597203732</td><td>2.5862935758007417</td><td>-1.7887209864551123</td><td>0.4865048585491827</td><td>--</td></tr>\n", "<tr><td>4660441460690365568</td><td>80.38862155241748</td><td>-66.34404494135046</td><td>1.6588478675146066</td><td>-0.09646951910977163</td><td>-0.2100859303087445</td><td>--</td></tr>\n",
"</table>" "</table>"
], ],
"text/plain": [ "text/plain": [
"<Table length=10>\n", "<Table length=10>\n",
" source_id ra ... radial_velocity \n", " source_id ra ... parallax radial_velocity\n",
" deg ... km / s \n", " deg ... mas km / s \n",
" int64 float64 ... float64 \n", " int64 float64 ... float64 float64 \n",
"------------------- ------------------ ... ------------------\n", "------------------- ----------------- ... --------------------- ---------------\n",
"5933096203842096896 243.78205426182762 ... -42.33885843170957\n", "4660466371507774848 79.49100199261952 ... -0.13534455558687877 --\n",
"5933101877528899712 243.97057838444422 ... --\n", "4660498704031984000 80.19346436358076 ... -0.1774586376397 --\n",
"5933092909682644736 243.79077939157932 ... --\n", "4660458949824817024 79.68666778641992 ... -0.030149510331454386 --\n",
"5933099403674089344 244.10992316666963 ... --\n", "4660451974773926528 79.89972073493868 ... -0.005219591141134416 --\n",
"5933099712864927488 244.14352482183628 ... --\n", "4660474033731357056 78.93214036467484 ... 0.6018032937392243 --\n",
"5933100430094343296 244.05583528078185 ... --\n", "4660454105077874688 79.91045649235578 ... -0.19949109843083218 --\n",
"5933090195214793088 244.0040474187424 ... --\n", "4660494855753740544 79.63101881952036 ... 0.0013030724292998944 --\n",
"5933092359874146816 243.77339485386585 ... --\n", "4660439536571308160 80.24817961417894 ... -0.10578442360531497 --\n",
"5933093974783111808 243.7622231489827 ... --\n", "4660470185440466560 79.25942306061864 ... -0.6932631338638376 --\n",
"4118427651760743808 264.39377925009563 ... --" "4660441460690365568 80.38862155241748 ... -0.2100859303087445 --"
] ]
}, },
"execution_count": 60, "execution_count": 28,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1468,13 +1538,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 29,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
] ]
}, },
"outputs": [], "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"SELECT TOP 10\n",
"source_id, ref_epoch, ra, dec, parallax\n",
"FROM gaiadr2.gaia_source\n",
"WHERE parallax < 1 \n",
" AND bp_rp BETWEEN -0.75 AND 2\n",
"\n"
]
}
],
"source": [ "source": [
"# Solution\n", "# Solution\n",
"\n", "\n",

View File

@@ -66,7 +66,7 @@
"\n", "\n",
"* Use `Quantity` objects to represent measurements with units.\n", "* Use `Quantity` objects to represent measurements with units.\n",
"\n", "\n",
"* Use the `Gala` library to convert coordinates from one frame to another.\n", "* Use Astropy to convert coordinates from one frame to another.\n",
"\n", "\n",
"* Use the ADQL keywords `POLYGON`, `CONTAINS`, and `POINT` to select stars that fall within a polygonal region.\n", "* Use the ADQL keywords `POLYGON`, `CONTAINS`, and `POINT` to select stars that fall within a polygonal region.\n",
"\n", "\n",
@@ -114,20 +114,15 @@
"IN_COLAB = 'google.colab' in sys.modules\n", "IN_COLAB = 'google.colab' in sys.modules\n",
"\n", "\n",
"if IN_COLAB:\n", "if IN_COLAB:\n",
" !pip install astroquery astro-gala" " !pip install astroquery gala"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Selecting a region"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Selecting a region\n",
"\n",
"One of the most common ways to restrict a query is to select stars in a particular region of the sky.\n", "One of the most common ways to restrict a query is to select stars in a particular region of the sky.\n",
"\n", "\n",
"For example, here's a query from the [Gaia archive documentation](https://gea.esac.esa.int/archive-help/adql/examples/index.html) 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).\"" "For example, here's a query from the [Gaia archive documentation](https://gea.esac.esa.int/archive-help/adql/examples/index.html) 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).\""
@@ -189,11 +184,34 @@
"\tSSL Port: 443\n" "\tSSL Port: 443\n"
] ]
}, },
{
"data": {
"text/plain": [
"<astroquery.utils.tap.model.job.Job at 0x7f59bd93e490>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from astroquery.gaia import Gaia\n",
"\n",
"job = Gaia.launch_job(query)\n",
"job"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=10</i>\n", "<i>Table length=10</i>\n",
"<table id=\"table140686245658336\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table140023409350736\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th></tr></thead>\n", "<thead><tr><th>source_id</th></tr></thead>\n",
"<thead><tr><th>int64</th></tr></thead>\n", "<thead><tr><th>int64</th></tr></thead>\n",
"<tr><td>4057468321929794432</td></tr>\n", "<tr><td>4057468321929794432</td></tr>\n",
@@ -225,15 +243,12 @@
"4057470555320409600" "4057470555320409600"
] ]
}, },
"execution_count": 3, "execution_count": 4,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"from astroquery.gaia import Gaia\n",
"\n",
"job = Gaia.launch_job(query)\n",
"result = job.get_results()\n", "result = job.get_results()\n",
"result" "result"
] ]
@@ -253,7 +268,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -284,19 +299,21 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Along the axis of right ascension ($\\phi_1$) the figure extends from -100 to 20 degrees.\n", "The axes of this figure are defined so the x-axis is aligned with the stars in GD-1, and the y-axis is perpendicular.\n",
"\n", "\n",
"Along the axis of declination ($\\phi_2$) the figure extends from about -8 to 4 degrees.\n", "* Along the x-axis ($\\phi_1$) the figure extends from -100 to 20 degrees.\n",
"\n",
"* Along the y-axis ($\\phi_2$) the figure extends from about -8 to 4 degrees.\n",
"\n", "\n",
"Ideally, we would select all stars from this rectangle, but there are more than 10 million of them, so\n", "Ideally, we would select all stars from this rectangle, but there are more than 10 million of them, so\n",
"\n", "\n",
"* That would be difficult to work with,\n", "* That would be difficult to work with,\n",
"\n", "\n",
"* As anonymous users, we are limited to 3 million rows in a single query, and\n", "* As anonymous Gaia users, we are limited to 3 million rows in a single query, and\n",
"\n", "\n",
"* While we are developing and testing code, it will be faster to work with a smaller dataset.\n", "* While we are developing and testing code, it will be faster to work with a smaller dataset.\n",
"\n", "\n",
"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.\n", "So we'll start by selecting stars in a smaller rectangle near the center of GD-1, from -55 to -45 degrees $\\phi_1$ and -8 to 4 degrees $\\phi_2$.\n",
"\n", "\n",
"But first we let's see how to represent quantities with units like degrees." "But first we let's see how to represent quantities with units like degrees."
] ]
@@ -311,7 +328,7 @@
"\n", "\n",
"For example, the coordinate $30^{\\circ}$ has value 30 and its units are degrees.\n", "For example, the coordinate $30^{\\circ}$ has value 30 and its units are degrees.\n",
"\n", "\n",
"Until recently, most scientific computation was done with values only; units were left out of the program altogether, [often with disastrous results](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_failure).\n", "Until recently, most scientific computation was done with values only; units were left out of the program altogether, [often with catastrophic results](https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_failure).\n",
"\n", "\n",
"Astropy provides tools for including units explicitly in computations, which makes it possible to detect errors before they cause disasters.\n", "Astropy provides tools for including units explicitly in computations, which makes it possible to detect errors before they cause disasters.\n",
"\n", "\n",
@@ -320,24 +337,11 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"data": {
"text/plain": [
"<module 'astropy.units' from '/home/downey/anaconda3/envs/AstronomicalData/lib/python3.8/site-packages/astropy/units/__init__.py'>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"import astropy.units as u\n", "import astropy.units as u"
"\n",
"u"
] ]
}, },
{ {
@@ -351,7 +355,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -821,6 +825,7 @@
" 'Tmin',\n", " 'Tmin',\n",
" 'Tmol',\n", " 'Tmol',\n",
" 'Tohm',\n", " 'Tohm',\n",
" 'Torr',\n",
" 'Tpc',\n", " 'Tpc',\n",
" 'Tph',\n", " 'Tph',\n",
" 'Tphoton',\n", " 'Tphoton',\n",
@@ -1356,11 +1361,10 @@
" 'dRy',\n", " 'dRy',\n",
" 'dS',\n", " 'dS',\n",
" 'dSt',\n", " 'dSt',\n",
" 'dT',\n",
" ...]" " ...]"
] ]
}, },
"execution_count": 5, "execution_count": 7,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1378,7 +1382,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1387,14 +1391,14 @@
"astropy.units.quantity.Quantity" "astropy.units.quantity.Quantity"
] ]
}, },
"execution_count": 6, "execution_count": 8,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"coordinate = 30 * u.deg\n", "quantity = 30 * u.degree\n",
"type(coordinate)" "type(quantity)"
] ]
}, },
{ {
@@ -1408,7 +1412,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1420,13 +1424,189 @@
"<Quantity 30. deg>" "<Quantity 30. deg>"
] ]
}, },
"execution_count": 7, "execution_count": 9,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"coordinate" "quantity"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Transforming coordinates\n",
"\n",
"Astropy provides a `SkyCoord` object that represents sky coordinates relative to a specified frame.\n",
"\n",
"The following example creates a `SkyCoord` object that represents the approximate coordinates of [Betelgeuse](http://simbad.u-strasbg.fr/simbad/sim-basic?Ident=Betelgeuse) (alf Ori) in the ICRS frame."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (ICRS): (ra, dec) in deg\n",
" (88.8, 7.4)>"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from astropy.coordinates import SkyCoord\n",
"\n",
"ra = 88.8 * u.degree\n",
"dec = 7.4 * u.degree\n",
"coord_icrs = SkyCoord(ra=ra, dec=dec, frame='icrs')\n",
"\n",
"coord_icrs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`SkyCoord` provides a function that transforms to other frames.\n",
"For example, we can transform `coords_icrs` to Galactic coordinates like this:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (Galactic): (l, b) in deg\n",
" (199.79693102, -8.95591653)>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coord_galactic = coord_icrs.transform_to('galactic')\n",
"coord_galactic"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To transform to and from GD-1 coordinates, we'll use a frame defined by [Gala](https://gala-astro.readthedocs.io/en/latest/), which is an Astropy-affiliated library that provides tools for galactic dynamics.\n",
"\n",
"Gala provides `GD1Koposov10`, which is \"[a Heliocentric spherical coordinate system defined by the orbit of the GD-1 stream](https://gala-astro.readthedocs.io/en/latest/_modules/gala/coordinates/gd1.html)\""
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<GD1Koposov10 Frame>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from gala.coordinates import GD1Koposov10\n",
"\n",
"gd1_frame = GD1Koposov10()\n",
"gd1_frame"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can use it to find the coordinates of Betelgeuse in the GD-1 frame, like this:"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (GD1Koposov10): (phi1, phi2) in deg\n",
" (-94.97222038, 34.5813813)>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"coord_gd1 = coord_icrs.transform_to(gd1_frame)\n",
"coord_gd1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exercise\n",
"\n",
"Let's find the location of GD-1 in ICRS coordinates.\n",
"\n",
"1. Create a `SkyCoord` object at 0°, 0° in the GD-1 frame.\n",
"\n",
"2. Transform it to the ICRS frame.\n",
"\n",
"Hint: Because ICRS is built into Astropy, you can specify it by name, `icrs` (as we did with `galactic`). "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<SkyCoord (ICRS): (ra, dec) in deg\n",
" (200., 59.4504341)>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Solution\n",
"\n",
"coord_gd1 = SkyCoord(0*u.degree, 0*u.degree, frame=gd1_frame)\n",
"\n",
"# Note: because ICRS is built into Astropy, \n",
"# we can identify it by name\n",
"coord_gd1.transform_to('icrs')\n",
"\n",
"# More formally, we could instantiate it\n",
"from astropy.coordinates import ICRS\n",
"icrs_frame = ICRS()\n",
"coord_gd1.transform_to(icrs_frame)"
] ]
}, },
{ {
@@ -1435,21 +1615,21 @@
"source": [ "source": [
"## Selecting a rectangle\n", "## Selecting a rectangle\n",
"\n", "\n",
"Now we'll select a rectangle from -55 to -45 degrees right ascension and -8 to 4 degrees of declination.\n", "Now we'll use these coordinate transformations to define a rectangle in the GD-1 frame and transform it to ICRS. \n",
"\n", "\n",
"We'll define variables to contain these limits." "The following variables define the boundaries of the rectangle in $\\phi_1$ and $\\phi_2$."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"phi1_min = -55\n", "phi1_min = -55 * u.degree\n",
"phi1_max = -45\n", "phi1_max = -45 * u.degree\n",
"phi2_min = -8\n", "phi2_min = -8 * u.degree\n",
"phi2_max = 4" "phi2_max = 4 * u.degree"
] ]
}, },
{ {
@@ -1461,37 +1641,49 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"phi1_rect = [phi1_min, phi1_min, phi1_max, phi1_max] * u.deg\n", "def make_rectangle(x1, x2, y1, y2):\n",
"phi2_rect = [phi2_min, phi2_max, phi2_max, phi2_min] * u.deg" " \"\"\"Return the corners of a rectangle.\"\"\"\n",
" xs = [x1, x1, x2, x2, x1]\n",
" ys = [y1, y2, y2, y1, y1]\n",
" return xs, ys"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"phi1_rect, phi2_rect = make_rectangle(\n",
" phi1_min, phi1_max, phi2_min, phi2_max)"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"`phi1_rect` and `phi2_rect` represent the coordinates of the corners of a rectangle. \n", "`phi1_rect` and `phi2_rect` represent the coordinates of the corners of a rectangle in the GD-1 frame.\n",
"\n", "\n",
"But they are in \"[a Heliocentric spherical coordinate system defined by the orbit of the GD1 stream](https://gala-astro.readthedocs.io/en/latest/_modules/gala/coordinates/gd1.html)\"\n", "In order to use them in a Gaia query, we have to convert them to ICRS."
"\n",
"In order to use them in a Gaia query, we have to convert them to [International Celestial Reference System](https://en.wikipedia.org/wiki/International_Celestial_Reference_System) (ICRS) coordinates. We can do that by storing the coordinates in a `GD1Koposov10` object provided by [Gala](https://gala-astro.readthedocs.io/en/latest/coordinates/)."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"gala.coordinates.gd1.GD1Koposov10" "<SkyCoord (GD1Koposov10): (phi1, phi2) in deg\n",
" [(-55., -8.), (-55., 4.), (-45., 4.), (-45., -8.), (-55., -8.)]>"
] ]
}, },
"execution_count": 10, "execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1499,35 +1691,7 @@
"source": [ "source": [
"import gala.coordinates as gc\n", "import gala.coordinates as gc\n",
"\n", "\n",
"corners = gc.GD1Koposov10(phi1=phi1_rect, phi2=phi2_rect)\n", "corners = SkyCoord(phi1=phi1_rect, phi2=phi2_rect, frame=gd1_frame)\n",
"type(corners)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can display the result like this:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<GD1Koposov10 Coordinate: (phi1, phi2) in deg\n",
" [(-55., -8.), (-55., 4.), (-45., 4.), (-45., -8.)]>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"corners" "corners"
] ]
}, },
@@ -1540,16 +1704,19 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"astropy.coordinates.builtin_frames.icrs.ICRS" "<SkyCoord (ICRS): (ra, dec) in deg\n",
" [(146.27533314, 19.26190982), (135.42163944, 25.87738723),\n",
" (141.60264825, 34.3048303 ), (152.81671045, 27.13611254),\n",
" (146.27533314, 19.26190982)]>"
] ]
}, },
"execution_count": 12, "execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1557,36 +1724,7 @@
"source": [ "source": [
"import astropy.coordinates as coord\n", "import astropy.coordinates as coord\n",
"\n", "\n",
"corners_icrs = corners.transform_to(coord.ICRS)\n", "corners_icrs = corners.transform_to('icrs')\n",
"type(corners_icrs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The result is an `ICRS` object."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<ICRS Coordinate: (ra, dec) in deg\n",
" [(146.27533314, 19.26190982), (135.42163944, 25.87738723),\n",
" (141.60264825, 34.3048303 ), (152.81671045, 27.13611254)]>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"corners_icrs" "corners_icrs"
] ]
}, },
@@ -1612,33 +1750,30 @@
" 140.58, 34.85, \n", " 140.58, 34.85, \n",
" 150.16, 29.01)\n", " 150.16, 29.01)\n",
"\"\"\"\n", "\"\"\"\n",
"```" "```\n",
] "\n",
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`corners_icrs` behaves like a list, so we can use a `for` loop to iterate through the points." "`corners_icrs` behaves like a list, so we can use a `for` loop to iterate through the points."
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"<ICRS Coordinate: (ra, dec) in deg\n", "<SkyCoord (ICRS): (ra, dec) in deg\n",
" (146.27533314, 19.26190982)>\n", " (146.27533314, 19.26190982)>\n",
"<ICRS Coordinate: (ra, dec) in deg\n", "<SkyCoord (ICRS): (ra, dec) in deg\n",
" (135.42163944, 25.87738723)>\n", " (135.42163944, 25.87738723)>\n",
"<ICRS Coordinate: (ra, dec) in deg\n", "<SkyCoord (ICRS): (ra, dec) in deg\n",
" (141.60264825, 34.3048303)>\n", " (141.60264825, 34.3048303)>\n",
"<ICRS Coordinate: (ra, dec) in deg\n", "<SkyCoord (ICRS): (ra, dec) in deg\n",
" (152.81671045, 27.13611254)>\n" " (152.81671045, 27.13611254)>\n",
"<SkyCoord (ICRS): (ra, dec) in deg\n",
" (146.27533314, 19.26190982)>\n"
] ]
} }
], ],
@@ -1656,7 +1791,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1666,7 +1801,8 @@
"146d16m31.1993s 19d15m42.8754s\n", "146d16m31.1993s 19d15m42.8754s\n",
"135d25m17.902s 25d52m38.594s\n", "135d25m17.902s 25d52m38.594s\n",
"141d36m09.5337s 34d18m17.3891s\n", "141d36m09.5337s 34d18m17.3891s\n",
"152d49m00.1576s 27d08m10.0051s\n" "152d49m00.1576s 27d08m10.0051s\n",
"146d16m31.1993s 19d15m42.8754s\n"
] ]
} }
], ],
@@ -1684,7 +1820,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1694,7 +1830,8 @@
"146.27533313607782 19.261909820533692\n", "146.27533313607782 19.261909820533692\n",
"135.42163944306296 25.87738722767213\n", "135.42163944306296 25.87738722767213\n",
"141.60264825107333 34.304830296257144\n", "141.60264825107333 34.304830296257144\n",
"152.81671044675923 27.136112541397996\n" "152.81671044675923 27.136112541397996\n",
"146.27533313607782 19.261909820533692\n"
] ]
} }
], ],
@@ -1712,7 +1849,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1721,10 +1858,11 @@
"['146.27533313607782, 19.261909820533692',\n", "['146.27533313607782, 19.261909820533692',\n",
" '135.42163944306296, 25.87738722767213',\n", " '135.42163944306296, 25.87738722767213',\n",
" '141.60264825107333, 34.304830296257144',\n", " '141.60264825107333, 34.304830296257144',\n",
" '152.81671044675923, 27.136112541397996']" " '152.81671044675923, 27.136112541397996',\n",
" '146.27533313607782, 19.261909820533692']"
] ]
}, },
"execution_count": 17, "execution_count": 23,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1746,16 +1884,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 24,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"'146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996'" "'146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996, 146.27533313607782, 19.261909820533692'"
] ]
}, },
"execution_count": 18, "execution_count": 24,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1776,7 +1914,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1792,7 +1930,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 26,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1814,7 +1952,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 27,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1826,7 +1964,7 @@
"WHERE parallax < 1\n", "WHERE parallax < 1\n",
" AND bp_rp BETWEEN -0.75 AND 2 \n", " AND bp_rp BETWEEN -0.75 AND 2 \n",
" AND 1 = CONTAINS(POINT(ra, dec), \n", " AND 1 = CONTAINS(POINT(ra, dec), \n",
" POLYGON(146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996))\n", " POLYGON(146.27533313607782, 19.261909820533692, 135.42163944306296, 25.87738722767213, 141.60264825107333, 34.304830296257144, 152.81671044675923, 27.136112541397996, 146.27533313607782, 19.261909820533692))\n",
"\n" "\n"
] ]
} }
@@ -1848,7 +1986,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 28,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -1869,10 +2007,10 @@
" parallax float64 mas Parallax 0\n", " parallax float64 mas Parallax 0\n",
" parallax_error float64 mas Standard error of parallax 0\n", " parallax_error float64 mas Standard error of parallax 0\n",
"radial_velocity float64 km / s Radial velocity 139374\n", "radial_velocity float64 km / s Radial velocity 139374\n",
"Jobid: 1605624329053O\n", "Jobid: 1609260439320O\n",
"Phase: COMPLETED\n", "Phase: COMPLETED\n",
"Owner: None\n", "Owner: None\n",
"Output file: async_20201117094529.vot\n", "Output file: async_20201229114719.vot\n",
"Results: None\n" "Results: None\n"
] ]
} }
@@ -1891,7 +2029,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1900,7 +2038,7 @@
"140340" "140340"
] ]
}, },
"execution_count": 23, "execution_count": 29,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1932,7 +2070,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1953,14 +2091,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 31,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-rw-rw-r-- 1 downey downey 8.6M Nov 17 09:45 gd1_results.fits\r\n" "-rw-rw-r-- 1 downey downey 8.6M Dec 29 11:47 gd1_results.fits\r\n"
] ]
} }
], ],

File diff suppressed because one or more lines are too long

View File

@@ -14,7 +14,7 @@
"exercises: 0\n", "exercises: 0\n",
"questions:\n", "questions:\n",
"\n", "\n",
"- \"How do we transform proper motion from one frame to another?\"\n", "- \"How do we move the computation to the data?\"\n",
"\n", "\n",
"objectives:\n", "objectives:\n",
"\n", "\n",
@@ -150,9 +150,8 @@
"source": [ "source": [
"import pandas as pd\n", "import pandas as pd\n",
"\n", "\n",
"df = pd.read_hdf(filename, 'df')\n", "centerline_df = pd.read_hdf(filename, 'centerline_df')\n",
"centerline = pd.read_hdf(filename, 'centerline')\n", "selected_df = pd.read_hdf(filename, 'selected_df')"
"selected = pd.read_hdf(filename, 'selected')"
] ]
}, },
{ {
@@ -198,10 +197,21 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"import astropy.units as u\n", "def make_rectangle(x1, x2, y1, y2):\n",
"\n", " \"\"\"Return the corners of a rectangle.\"\"\"\n",
"pm1_rect = [pm1_min, pm1_min, pm1_max, pm1_max, pm1_min] * u.mas/u.yr\n", " xs = [x1, x1, x2, x2, x1]\n",
"pm2_rect = [pm2_min, pm2_max, pm2_max, pm2_min, pm2_min] * u.mas/u.yr" " ys = [y1, y2, y2, y1, y1]\n",
" return xs, ys"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"pm1_rect, pm2_rect = make_rectangle(\n",
" pm1_min, pm1_max, pm2_min, pm2_max)"
] ]
}, },
{ {
@@ -219,7 +229,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -238,12 +248,12 @@
"source": [ "source": [
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"\n", "\n",
"pm1 = centerline['pm_phi1']\n", "pm1 = centerline_df['pm_phi1']\n",
"pm2 = centerline['pm_phi2']\n", "pm2 = centerline_df['pm_phi2']\n",
"plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n", "plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n",
"\n", "\n",
"pm1 = selected['pm_phi1']\n", "pm1 = selected_df['pm_phi1']\n",
"pm2 = selected['pm_phi2']\n", "pm2 = selected_df['pm_phi2']\n",
"plt.plot(pm1, pm2, 'gx', markersize=0.3, alpha=0.3)\n", "plt.plot(pm1, pm2, 'gx', markersize=0.3, alpha=0.3)\n",
"\n", "\n",
"plt.plot(pm1_rect, pm2_rect, '-')\n", "plt.plot(pm1_rect, pm2_rect, '-')\n",
@@ -264,7 +274,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 8,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -281,12 +291,12 @@
} }
], ],
"source": [ "source": [
"pm1 = centerline['pmra']\n", "pm1 = centerline_df['pmra']\n",
"pm2 = centerline['pmdec']\n", "pm2 = centerline_df['pmdec']\n",
"plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n", "plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n",
"\n", "\n",
"pm1 = selected['pmra']\n", "pm1 = selected_df['pmra']\n",
"pm2 = selected['pmdec']\n", "pm2 = selected_df['pmdec']\n",
"plt.plot(pm1, pm2, 'gx', markersize=1, alpha=0.3)\n", "plt.plot(pm1, pm2, 'gx', markersize=1, alpha=0.3)\n",
" \n", " \n",
"plt.xlabel('Proper motion ra (ICRS frame)')\n", "plt.xlabel('Proper motion ra (ICRS frame)')\n",
@@ -318,7 +328,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -327,7 +337,7 @@
"(1049, 2)" "(1049, 2)"
] ]
}, },
"execution_count": 8, "execution_count": 9,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -335,7 +345,7 @@
"source": [ "source": [
"import numpy as np\n", "import numpy as np\n",
"\n", "\n",
"points = selected[['pmra','pmdec']].to_numpy()\n", "points = selected_df[['pmra','pmdec']].to_numpy()\n",
"points.shape" "points.shape"
] ]
}, },
@@ -346,7 +356,7 @@
"NOTE: If you are using an older version of Pandas, you might not have `to_numpy()`; you can use `values` instead, like this:\n", "NOTE: If you are using an older version of Pandas, you might not have `to_numpy()`; you can use `values` instead, like this:\n",
"\n", "\n",
"```\n", "```\n",
"points = selected[['pmra','pmdec']].values\n", "points = selected_df[['pmra','pmdec']].values\n",
"\n", "\n",
"```" "```"
] ]
@@ -360,16 +370,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<scipy.spatial.qhull.ConvexHull at 0x7f0d570cd700>" "<scipy.spatial.qhull.ConvexHull at 0x7fa7c4c03a90>"
] ]
}, },
"execution_count": 9, "execution_count": 10,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -390,7 +400,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -400,7 +410,7 @@
" 971, 967, 1001, 969, 940], dtype=int32)" " 971, 967, 1001, 969, 940], dtype=int32)"
] ]
}, },
"execution_count": 10, "execution_count": 11,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -418,7 +428,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 12,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -442,7 +452,7 @@
" [ -4.42442296, -14.74641176]])" " [ -4.42442296, -14.74641176]])"
] ]
}, },
"execution_count": 11, "execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -461,7 +471,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -479,7 +489,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 14,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -496,12 +506,12 @@
} }
], ],
"source": [ "source": [
"pm1 = centerline['pmra']\n", "pm1 = centerline_df['pmra']\n",
"pm2 = centerline['pmdec']\n", "pm2 = centerline_df['pmdec']\n",
"plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n", "plt.plot(pm1, pm2, 'ko', markersize=0.3, alpha=0.3)\n",
"\n", "\n",
"pm1 = selected['pmra']\n", "pm1 = selected_df['pmra']\n",
"pm2 = selected['pmdec']\n", "pm2 = selected_df['pmdec']\n",
"plt.plot(pm1, pm2, 'gx', markersize=0.3, alpha=0.3)\n", "plt.plot(pm1, pm2, 'gx', markersize=0.3, alpha=0.3)\n",
"\n", "\n",
"plt.plot(pmra_poly, pmdec_poly)\n", "plt.plot(pmra_poly, pmdec_poly)\n",
@@ -532,7 +542,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 15,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -563,7 +573,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -603,7 +613,7 @@
" '-14.7464117578883']" " '-14.7464117578883']"
] ]
}, },
"execution_count": 15, "execution_count": 16,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -622,7 +632,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -631,7 +641,7 @@
"'-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883'" "'-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883'"
] ]
}, },
"execution_count": 16, "execution_count": 17,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -652,24 +662,26 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 19,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"phi1_min = -70\n", "import astropy.units as u\n",
"phi1_max = -20\n", "\n",
"phi2_min = -5\n", "phi1_min = -70 * u.degree\n",
"phi2_max = 5" "phi1_max = -20 * u.degree\n",
"phi2_min = -5 * u.degree\n",
"phi2_max = 5 * u.degree"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"phi1_rect = [phi1_min, phi1_min, phi1_max, phi1_max] * u.deg\n", "phi1_rect, phi2_rect = make_rectangle(\n",
"phi2_rect = [phi2_min, phi2_max, phi2_max, phi2_min] * u.deg" " phi1_min, phi1_max, phi2_min, phi2_max)"
] ]
}, },
{ {
@@ -681,23 +693,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: AstropyDeprecationWarning: Transforming a frame instance to a frame class (as opposed to another frame instance) will not be supported in the future. Either explicitly instantiate the target frame, or first convert the source frame instance to a `astropy.coordinates.SkyCoord` and use its `transform_to()` method. [astropy.coordinates.baseframe]\n"
]
}
],
"source": [ "source": [
"import gala.coordinates as gc\n", "from gala.coordinates import GD1Koposov10\n",
"import astropy.coordinates as coord\n", "from astropy.coordinates import SkyCoord\n",
"\n", "\n",
"corners = gc.GD1Koposov10(phi1=phi1_rect, phi2=phi2_rect)\n", "corners = SkyCoord(phi1=phi1_rect, phi2=phi2_rect, frame=GD1Koposov10)\n",
"corners_icrs = corners.transform_to(coord.ICRS)" "corners_icrs = corners.transform_to('icrs')"
] ]
}, },
{ {
@@ -709,16 +713,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"'135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258'" "'135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258, 135.30559858565638, 8.398623940157561'"
] ]
}, },
"execution_count": 20, "execution_count": 22,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -743,7 +747,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -768,7 +772,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 24,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -799,7 +803,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -817,7 +821,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 26,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -834,7 +838,7 @@
"WHERE parallax < 1\n", "WHERE parallax < 1\n",
" AND bp_rp BETWEEN -0.75 AND 2 \n", " AND bp_rp BETWEEN -0.75 AND 2 \n",
" AND 1 = CONTAINS(POINT(ra, dec), \n", " AND 1 = CONTAINS(POINT(ra, dec), \n",
" POLYGON(135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258))\n", " POLYGON(135.30559858565638, 8.398623940157561, 126.50951508623503, 13.44494195652069, 163.0173655836748, 54.24242734020255, 172.9328536286811, 46.47260492416258, 135.30559858565638, 8.398623940157561))\n",
" AND 1 = CONTAINS(POINT(pmra, pmdec),\n", " AND 1 = CONTAINS(POINT(pmra, pmdec),\n",
" POLYGON(-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883))\n", " POLYGON(-4.050371212154984, -14.75623260987968, -3.4198108491382455, -14.723655456335619, -3.035219883740934, -14.443571352854612, -2.268479190206636, -13.714023598831554, -2.611722027231764, -13.247974712069263, -2.7347140078529106, -13.090544709622938, -3.199231461993783, -12.594265302440828, -3.34082545787549, -12.476119260818695, -5.674894125178565, -11.160833381392624, -5.95159272432137, -11.105478836426514, -6.423940229776128, -11.05981294804957, -7.096310230579248, -11.951878058650085, -7.306415190921692, -12.245599765990594, -7.040166963232815, -12.885807024935527, -6.0034770546523735, -13.759120984106968, -4.42442296194263, -14.7464117578883))\n",
"\n" "\n"
@@ -859,7 +863,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 27,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -889,10 +893,10 @@
" pmdec float64 mas / yr Proper motion in declination direction 0\n", " pmdec float64 mas / yr Proper motion in declination direction 0\n",
" parallax float64 mas Parallax 0\n", " parallax float64 mas Parallax 0\n",
"radial_velocity float64 km / s Radial velocity 7295\n", "radial_velocity float64 km / s Radial velocity 7295\n",
"Jobid: 1607614394159O\n", "Jobid: 1609260557475O\n",
"Phase: COMPLETED\n", "Phase: COMPLETED\n",
"Owner: None\n", "Owner: None\n",
"Output file: async_20201210103314.vot\n", "Output file: async_20201229114917.vot\n",
"Results: None\n" "Results: None\n"
] ]
} }
@@ -913,7 +917,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -922,7 +926,7 @@
"7346" "7346"
] ]
}, },
"execution_count": 26, "execution_count": 28,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -943,7 +947,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 29,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -979,10 +983,12 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 33,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"from gala.coordinates import reflex_correct\n",
"\n",
"def make_dataframe(table):\n", "def make_dataframe(table):\n",
" \"\"\"Transform coordinates from ICRS to GD-1 frame.\n", " \"\"\"Transform coordinates from ICRS to GD-1 frame.\n",
" \n", " \n",
@@ -990,7 +996,7 @@
" \n", " \n",
" returns: Pandas DataFrame\n", " returns: Pandas DataFrame\n",
" \"\"\"\n", " \"\"\"\n",
" skycoord = coord.SkyCoord(\n", " skycoord = SkyCoord(\n",
" ra=table['ra'], \n", " ra=table['ra'], \n",
" dec=table['dec'],\n", " dec=table['dec'],\n",
" pm_ra_cosdec=table['pmra'],\n", " pm_ra_cosdec=table['pmra'],\n",
@@ -998,8 +1004,8 @@
" distance=8*u.kpc, \n", " distance=8*u.kpc, \n",
" radial_velocity=0*u.km/u.s)\n", " radial_velocity=0*u.km/u.s)\n",
"\n", "\n",
" transformed = skycoord.transform_to(gc.GD1Koposov10)\n", " transformed = skycoord.transform_to(GD1Koposov10)\n",
" gd1_coord = gc.reflex_correct(transformed)\n", " gd1_coord = reflex_correct(transformed)\n",
"\n", "\n",
" df = table.to_pandas()\n", " df = table.to_pandas()\n",
" df['phi1'] = gd1_coord.phi1\n", " df['phi1'] = gd1_coord.phi1\n",
@@ -1018,7 +1024,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 34,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1034,7 +1040,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 35,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1064,16 +1070,26 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"We're starting to see GD-1 more clearly.\n", "We're starting to see GD-1 more clearly."
"\n", ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can compare this figure with one of these panels in Figure 1 from the original paper:\n", "We can compare this figure with one of these panels in Figure 1 from the original paper:\n",
"\n", "\n",
"<img height=\"150\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-2.png\">\n", "<img height=\"150\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-2.png\">\n",
"\n", "\n",
"<img height=\"150\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-4.png\">\n", "<img height=\"150\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-4.png\">\n",
"\n", "\n",
"The top panel shows stars selected based on proper motion only, so it is comparable to our figure (although notice that it covers a wider region).\n", "The top panel shows stars selected based on proper motion only, so it is comparable to our figure (although notice that it covers a wider region)."
"\n", ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In the next lesson, we will use photometry data from Pan-STARRS to do a second round of filtering, and see if we can replicate the bottom panel.\n", "In the next lesson, we will use photometry data from Pan-STARRS to do a second round of filtering, and see if we can replicate the bottom panel.\n",
"\n", "\n",
"We'll also learn how to add annotations like the ones in the figure from the paper, and customize the style of the figure to present the results clearly and compellingly." "We'll also learn how to add annotations like the ones in the figure from the paper, and customize the style of the figure to present the results clearly and compellingly."
@@ -1090,7 +1106,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 36,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1108,14 +1124,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 37,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-rw-rw-r-- 1 downey downey 698K Dec 10 19:18 gd1_candidates.hdf5\r\n" "-rw-rw-r-- 1 downey downey 698K Dec 29 11:50 gd1_candidates.hdf5\r\n"
] ]
} }
], ],
@@ -1155,7 +1171,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 38,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1171,14 +1187,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 36, "execution_count": 39,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-rw-rw-r-- 1 downey downey 1.4M Dec 10 19:19 gd1_candidates.csv\r\n" "-rw-rw-r-- 1 downey downey 1.4M Dec 29 11:50 gd1_candidates.csv\r\n"
] ]
} }
], ],
@@ -1197,7 +1213,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 40,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1225,7 +1241,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 41,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -1241,7 +1257,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 42,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1337,7 +1353,7 @@
"2 NaN -59.133391 -2.306901 -7.560608 -0.741800 " "2 NaN -59.133391 -2.306901 -7.560608 -0.741800 "
] ]
}, },
"execution_count": 39, "execution_count": 42,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1348,7 +1364,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 43,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1448,7 +1464,7 @@
"2 0.779463 NaN -59.133391 -2.306901 -7.560608 -0.741800 " "2 0.779463 NaN -59.133391 -2.306901 -7.560608 -0.741800 "
] ]
}, },
"execution_count": 40, "execution_count": 43,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }

View File

@@ -39,7 +39,8 @@
"\n", "\n",
"As a continuing example, we will replicate part of the analysis in a recent paper, \"[Off the beaten path: Gaia reveals GD-1 stars outside of the main stream](https://arxiv.org/abs/1805.00425)\" by Adrian M. Price-Whelan and Ana Bonaca.\n", "As a continuing example, we will replicate part of the analysis in a recent paper, \"[Off the beaten path: Gaia reveals GD-1 stars outside of the main stream](https://arxiv.org/abs/1805.00425)\" by Adrian M. Price-Whelan and Ana Bonaca.\n",
"\n", "\n",
"Picking up where we left off, the next step in the analysis is to select candidate stars based on photometry data. The following figure from the paper is a color-magnitude diagram for the stars selected based on proper motion:\n", "Picking up where we left off, the next step in the analysis is to select candidate stars based on photometry data.\n",
"The following figure from the paper is a color-magnitude diagram for the stars selected based on proper motion:\n",
"\n", "\n",
"<img width=\"300\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png\">\n", "<img width=\"300\" src=\"https://github.com/datacarpentry/astronomy-python/raw/gh-pages/fig/gd1-3.png\">\n",
"\n", "\n",
@@ -379,7 +380,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-rw-rw-r-- 1 downey downey 396K Dec 10 11:33 candidate_df.xml\r\n" "-rw-rw-r-- 1 downey downey 396K Dec 29 11:50 candidate_df.xml\r\n"
] ]
} }
], ],
@@ -406,60 +407,39 @@
"\n", "\n",
"There's a gotcha here we want to warn you about. Why do you think we used double brackets to specify the column we wanted? What happens if you use single brackets?\n", "There's a gotcha here we want to warn you about. Why do you think we used double brackets to specify the column we wanted? What happens if you use single brackets?\n",
"\n", "\n",
"Run these cells to find out." "Run these code snippets to find out.\n",
] "\n",
}, "```\n",
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"astropy.table.table.Table"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"table_id = candidate_table[['source_id']]\n", "table_id = candidate_table[['source_id']]\n",
"type(table_id)" "print(type(table_id))\n",
] "```\n",
}, "\n",
{ "```\n",
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"astropy.table.column.Column"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"column = candidate_table['source_id']\n", "column = candidate_table['source_id']\n",
"type(column)" "print(type(column))\n",
"```\n",
"\n",
"```\n",
"# This one should cause an error\n",
"table_id.write('candidate_df.xml', \n",
" format='votable', \n",
" overwrite=True)\n",
"```"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 9,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# This line is commented out because it would cause an error\n", "# Solution\n",
"\n", "\n",
"# writeto(column, 'candidate_df.xml')" "# table_id is a Table\n",
"\n",
"# column is a Column\n",
"\n",
"# Column does not provide `write`, so you get an AttributeError"
] ]
}, },
{ {
@@ -477,7 +457,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 10,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -499,7 +479,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 11,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -541,7 +521,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 12,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -550,7 +530,7 @@
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=7346</i>\n", "<i>Table length=7346</i>\n",
"<table id=\"table140668290919488\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139832308444608\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th></tr></thead>\n", "<thead><tr><th>source_id</th></tr></thead>\n",
"<thead><tr><th>int64</th></tr></thead>\n", "<thead><tr><th>int64</th></tr></thead>\n",
"<tr><td>635559124339440000</td></tr>\n", "<tr><td>635559124339440000</td></tr>\n",
@@ -604,7 +584,7 @@
"612429144902815104" "612429144902815104"
] ]
}, },
"execution_count": 14, "execution_count": 12,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -623,7 +603,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 13,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -632,33 +612,53 @@
"(7346, 7346)" "(7346, 7346)"
] ]
}, },
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(table_id), len(results)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['source_id']"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"table_id.colnames"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['source_id']"
]
},
"execution_count": 15, "execution_count": 15,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
], ],
"source": [ "source": [
"len(candidate_table), len(results)" "results.colnames"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"True"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"set(candidate_table['source_id']) == set(results['source_id'])"
] ]
}, },
{ {
@@ -681,7 +681,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 16,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@@ -713,7 +713,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -739,14 +739,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 18,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=3724</i>\n", "<i>Table length=3724</i>\n",
"<table id=\"table140668268803072\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139832308265696\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>original_ext_source_id</th><th>angular_distance</th><th>number_of_neighbours</th><th>number_of_mates</th><th>best_neighbour_multiplicity</th><th>gaia_astrometric_params</th><th>source_id_2</th></tr></thead>\n", "<thead><tr><th>source_id</th><th>original_ext_source_id</th><th>angular_distance</th><th>number_of_neighbours</th><th>number_of_mates</th><th>best_neighbour_multiplicity</th><th>gaia_astrometric_params</th><th>source_id_2</th></tr></thead>\n",
"<thead><tr><th></th><th></th><th>arcsec</th><th></th><th></th><th></th><th></th><th></th></tr></thead>\n", "<thead><tr><th></th><th></th><th>arcsec</th><th></th><th></th><th></th><th></th><th></th></tr></thead>\n",
"<thead><tr><th>int64</th><th>int64</th><th>float64</th><th>int32</th><th>int16</th><th>int16</th><th>int16</th><th>int64</th></tr></thead>\n", "<thead><tr><th>int64</th><th>int64</th><th>float64</th><th>int32</th><th>int16</th><th>int16</th><th>int16</th><th>int64</th></tr></thead>\n",
@@ -800,7 +800,7 @@
"612256418500423168 129931349075297310 ... 612256418500423168" "612256418500423168 129931349075297310 ... 612256418500423168"
] ]
}, },
"execution_count": 19, "execution_count": 18,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -819,7 +819,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 19,
"metadata": { "metadata": {
"scrolled": true "scrolled": true
}, },
@@ -837,7 +837,7 @@
" 'source_id_2']" " 'source_id_2']"
] ]
}, },
"execution_count": 20, "execution_count": 19,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -857,7 +857,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 20,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -866,7 +866,7 @@
"3724" "3724"
] ]
}, },
"execution_count": 21, "execution_count": 20,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -884,7 +884,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 21,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -948,7 +948,7 @@
" 1" " 1"
] ]
}, },
"execution_count": 22, "execution_count": 21,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -968,7 +968,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 22,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -985,7 +985,7 @@
"dtype: float64" "dtype: float64"
] ]
}, },
"execution_count": 23, "execution_count": 22,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1008,7 +1008,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 23,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1025,7 +1025,7 @@
"dtype: float64" "dtype: float64"
] ]
}, },
"execution_count": 24, "execution_count": 23,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1076,7 +1076,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 24,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -1099,7 +1099,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 25,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1155,7 +1155,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 26,
"metadata": { "metadata": {
"tags": [ "tags": [
"hide-cell" "hide-cell"
@@ -1173,7 +1173,7 @@
"\n", "\n",
"# Second test\n", "# Second test\n",
"\n", "\n",
"query2 = \"\"\"SELECT TOP 10 *\n", "query2 = \"\"\"SELECT TOP 10\n",
"FROM gaiadr2.panstarrs1_original_valid\n", "FROM gaiadr2.panstarrs1_original_valid\n",
"\"\"\"\n", "\"\"\"\n",
"\n", "\n",
@@ -1204,7 +1204,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 27,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@@ -1223,14 +1223,14 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 28,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/html": [ "text/html": [
"<i>Table length=3724</i>\n", "<i>Table length=3724</i>\n",
"<table id=\"table140668299958448\" class=\"table-striped table-bordered table-condensed\">\n", "<table id=\"table139832332951360\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead>\n", "<thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead>\n",
"<thead><tr><th></th><th></th><th>mag</th></tr></thead>\n", "<thead><tr><th></th><th></th><th>mag</th></tr></thead>\n",
"<thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead>\n", "<thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead>\n",
@@ -1284,7 +1284,7 @@
"612256418500423168 20.8715991973877 19.9612007141113" "612256418500423168 20.8715991973877 19.9612007141113"
] ]
}, },
"execution_count": 29, "execution_count": 28,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@@ -1309,77 +1309,7 @@
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 30,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO: Query finished. [astroquery.utils.tap.core]\n"
]
},
{
"data": {
"text/html": [
"<i>Table length=3724</i>\n",
"<table id=\"table140668275467456\" class=\"table-striped table-bordered table-condensed\">\n",
"<thead><tr><th>source_id</th><th>g_mean_psf_mag</th><th>i_mean_psf_mag</th></tr></thead>\n",
"<thead><tr><th></th><th></th><th>mag</th></tr></thead>\n",
"<thead><tr><th>int64</th><th>float64</th><th>float64</th></tr></thead>\n",
"<tr><td>635860218726658176</td><td>17.8978004455566</td><td>17.5174007415771</td></tr>\n",
"<tr><td>635674126383965568</td><td>19.2873001098633</td><td>17.6781005859375</td></tr>\n",
"<tr><td>635535454774983040</td><td>16.9237995147705</td><td>16.478099822998</td></tr>\n",
"<tr><td>635497276810313600</td><td>19.9242000579834</td><td>18.3339996337891</td></tr>\n",
"<tr><td>635614168640132864</td><td>16.1515998840332</td><td>14.6662998199463</td></tr>\n",
"<tr><td>635598607974369792</td><td>16.5223999023438</td><td>16.1375007629395</td></tr>\n",
"<tr><td>635737661835496576</td><td>14.5032997131348</td><td>13.9849004745483</td></tr>\n",
"<tr><td>635850945892748672</td><td>16.5174999237061</td><td>16.0450000762939</td></tr>\n",
"<tr><td>635600532119713664</td><td>20.4505996704102</td><td>19.5177001953125</td></tr>\n",
"<tr><td>...</td><td>...</td><td>...</td></tr>\n",
"<tr><td>612241781249124608</td><td>20.2343997955322</td><td>18.6518001556396</td></tr>\n",
"<tr><td>612332147361443072</td><td>21.3848991394043</td><td>20.3076000213623</td></tr>\n",
"<tr><td>612426744016802432</td><td>17.8281002044678</td><td>17.4281005859375</td></tr>\n",
"<tr><td>612331739340341760</td><td>21.8656997680664</td><td>19.5223007202148</td></tr>\n",
"<tr><td>612282738058264960</td><td>22.5151996612549</td><td>19.9743995666504</td></tr>\n",
"<tr><td>612386332668697600</td><td>19.3792991638184</td><td>17.9923000335693</td></tr>\n",
"<tr><td>612296172717818624</td><td>17.4944000244141</td><td>16.926700592041</td></tr>\n",
"<tr><td>612250375480101760</td><td>15.3330001831055</td><td>14.6280002593994</td></tr>\n",
"<tr><td>612394926899159168</td><td>16.4414005279541</td><td>15.8212003707886</td></tr>\n",
"<tr><td>612256418500423168</td><td>20.8715991973877</td><td>19.9612007141113</td></tr>\n",
"</table>"
],
"text/plain": [
"<Table length=3724>\n",
" source_id g_mean_psf_mag i_mean_psf_mag \n",
" mag \n",
" int64 float64 float64 \n",
"------------------ ---------------- ----------------\n",
"635860218726658176 17.8978004455566 17.5174007415771\n",
"635674126383965568 19.2873001098633 17.6781005859375\n",
"635535454774983040 16.9237995147705 16.478099822998\n",
"635497276810313600 19.9242000579834 18.3339996337891\n",
"635614168640132864 16.1515998840332 14.6662998199463\n",
"635598607974369792 16.5223999023438 16.1375007629395\n",
"635737661835496576 14.5032997131348 13.9849004745483\n",
"635850945892748672 16.5174999237061 16.0450000762939\n",
"635600532119713664 20.4505996704102 19.5177001953125\n",
" ... ... ...\n",
"612241781249124608 20.2343997955322 18.6518001556396\n",
"612332147361443072 21.3848991394043 20.3076000213623\n",
"612426744016802432 17.8281002044678 17.4281005859375\n",
"612331739340341760 21.8656997680664 19.5223007202148\n",
"612282738058264960 22.5151996612549 19.9743995666504\n",
"612386332668697600 19.3792991638184 17.9923000335693\n",
"612296172717818624 17.4944000244141 16.926700592041\n",
"612250375480101760 15.3330001831055 14.6280002593994\n",
"612394926899159168 16.4414005279541 15.8212003707886\n",
"612256418500423168 20.8715991973877 19.9612007141113"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"# Solution\n", "# Solution\n",
"\n", "\n",
@@ -1393,8 +1323,8 @@
"\"\"\"\n", "\"\"\"\n",
"\n", "\n",
"# job3 = Gaia.launch_job_async(query=query3, \n", "# job3 = Gaia.launch_job_async(query=query3, \n",
" upload_resource='candidate_df.xml', \n", "# upload_resource='candidate_df.xml', \n",
" upload_table_name='candidate_df')\n", "# upload_table_name='candidate_df')\n",
"\n", "\n",
"# results3 = job3.get_results()\n", "# results3 = job3.get_results()\n",
"# results3" "# results3"
@@ -1435,7 +1365,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"-rw-rw-r-- 1 downey downey 96K Dec 10 11:34 gd1_photo.fits\r\n" "-rw-rw-r-- 1 downey downey 96K Dec 29 11:51 gd1_photo.fits\r\n"
] ]
} }
], ],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -45,7 +45,7 @@ This notebook demonstrates the following steps:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb) [Run Notebook 1 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb)
@@ -68,7 +68,7 @@ Then, to select stars in the vicinity of GD-1, we:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb) [Run Notebook 2 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb)
@@ -89,7 +89,7 @@ Here are the steps in this notebook:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb) [Run Notebook 3 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb)
@@ -108,7 +108,7 @@ That will make it possible to search a bigger region of the sky in a single quer
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb) [Run Notebook 4 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb)
@@ -125,7 +125,7 @@ Here are the steps in this notebook:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb) [Run Notebook 5 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb)
@@ -142,7 +142,7 @@ Here are the steps in this notebook:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb) [Run Notebook 6 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb)
@@ -159,7 +159,7 @@ Here are the steps in this notebook:
Press this button to run this notebook on Colab: Press this button to run this notebook on Colab:
[<img src="run_on_colab_small.png">](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb) [Run Notebook 7 on Colab](https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb)
[or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb) [or click here to read it on NBViewer](https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb)

View File

@@ -1,4 +1,4 @@
pre { line-height: 125%; margin: 0; } pre { line-height: 125%; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }

View File

@@ -107,27 +107,27 @@
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
<a class="reference internal" href="03_motion.html"> <a class="reference internal" href="03_motion.html">
Chapter 3 Proper Motion
</a> </a>
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
<a class="reference internal" href="04_select.html"> <a class="reference internal" href="04_select.html">
Chapter 4 Transformation and Selection
</a> </a>
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
<a class="reference internal" href="05_join.html"> <a class="reference internal" href="05_join.html">
Chapter 5 Joining Tables
</a> </a>
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
<a class="reference internal" href="06_photo.html"> <a class="reference internal" href="06_photo.html">
Chapter 6 Photometry
</a> </a>
</li> </li>
<li class="toctree-l1"> <li class="toctree-l1">
<a class="reference internal" href="07_plot.html"> <a class="reference internal" href="07_plot.html">
Chapter 7 Visualization
</a> </a>
</li> </li>
</ul> </ul>
@@ -303,7 +303,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Downloading the response from the server as an Astropy <code class="docutils literal notranslate"><span class="pre">Table</span></code>.</p></li> <li><p>Downloading the response from the server as an Astropy <code class="docutils literal notranslate"><span class="pre">Table</span></code>.</p></li>
</ol> </ol>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb">Run Notebook 1 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/01_query.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-2"> <div class="section" id="notebook-2">
@@ -318,7 +318,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Store the results in a FITS file.</p></li> <li><p>Store the results in a FITS file.</p></li>
</ul> </ul>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb">Run Notebook 2 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/02_coords.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-3"> <div class="section" id="notebook-3">
@@ -332,7 +332,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Finally, well select and plot the stars whose proper motion is in that region.</p></li> <li><p>Finally, well select and plot the stars whose proper motion is in that region.</p></li>
</ol> </ol>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb">Run Notebook 3 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/03_motion.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-4"> <div class="section" id="notebook-4">
@@ -345,7 +345,7 @@ this repository and follow the instructions below to set up your environment.</p
</ol> </ol>
<p>That will make it possible to search a bigger region of the sky in a single query.</p> <p>That will make it possible to search a bigger region of the sky in a single query.</p>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb">Run Notebook 4 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/04_select.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-5"> <div class="section" id="notebook-5">
@@ -357,7 +357,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Well write the results to a file for use in the next notebook.</p></li> <li><p>Well write the results to a file for use in the next notebook.</p></li>
</ol> </ol>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb">Run Notebook 5 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/05_join.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-6"> <div class="section" id="notebook-6">
@@ -369,7 +369,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Then well merge the photometry data with the list of candidate stars, storing the result in a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p></li> <li><p>Then well merge the photometry data with the list of candidate stars, storing the result in a Pandas <code class="docutils literal notranslate"><span class="pre">DataFrame</span></code>.</p></li>
</ol> </ol>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb">Run Notebook 6 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/06_photo.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="notebook-7"> <div class="section" id="notebook-7">
@@ -381,7 +381,7 @@ this repository and follow the instructions below to set up your environment.</p
<li><p>Finally, well see how to make a figure with multiple panels or subplots.</p></li> <li><p>Finally, well see how to make a figure with multiple panels or subplots.</p></li>
</ol> </ol>
<p>Press this button to run this notebook on Colab:</p> <p>Press this button to run this notebook on Colab:</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb"><img src="run_on_colab_small.png"></a></p> <p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb">Run Notebook 7 on Colab</a></p>
<p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb">or click here to read it on NBViewer</a></p> <p><a class="reference external" href="https://nbviewer.jupyter.org/github/AllenDowney/AstronomicalData/blob/main/07_plot.ipynb">or click here to read it on NBViewer</a></p>
</div> </div>
<div class="section" id="installation-instructions"> <div class="section" id="installation-instructions">

Binary file not shown.

File diff suppressed because one or more lines are too long