diff --git a/soln/02_coords.ipynb b/soln/02_coords.ipynb
index f29a08a..e6df5ef 100644
--- a/soln/02_coords.ipynb
+++ b/soln/02_coords.ipynb
@@ -1341,7 +1341,7 @@
}
],
"source": [
- "## Solution\n",
+ "# Solution\n",
"\n",
"radius = 5 * u.arcmin\n",
"print(radius)\n",
diff --git a/soln/05_join.ipynb b/soln/05_join.ipynb
index b9b3223..b75d4fb 100644
--- a/soln/05_join.ipynb
+++ b/soln/05_join.ipynb
@@ -14,13 +14,11 @@
"\n",
"objectives:\n",
"\n",
- "- \"Upload a table to the Gaia server.\"\n",
- "\n",
"- \"Write ADQL queries involving `JOIN` operations.\"\n",
"\n",
"keypoints:\n",
"\n",
- "- \"Use `JOIN` operations to combine data from multiple tables in a databased, using some kind of identifier to match up records from one table with records from another.\"\n",
+ "- \"Use `JOIN` operations to combine data from multiple tables in a database, using some kind of identifier to match up records from one table with records from another.\"\n",
"\n",
"- \"This is another example of a practice we saw in the previous notebook, moving the computation to the data.\"\n",
"\n",
@@ -1097,34 +1095,7 @@
"WHERE 1=CONTAINS(\n",
" POINT(gaia.ra, gaia.dec),\n",
" CIRCLE(88.8, 7.4, 0.08333333))\n",
- "\"\"\"\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 26,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "SELECT \n",
- "gaia.source_id, gaia.ra, gaia.dec, gaia.pmra, gaia.pmdec, best.best_neighbour_multiplicity, best.number_of_mates, ps.g_mean_psf_mag, ps.i_mean_psf_mag\n",
- "FROM gaiadr2.gaia_source as gaia\n",
- "JOIN gaiadr2.panstarrs1_best_neighbour as best\n",
- " ON gaia.source_id = best.source_id\n",
- "JOIN gaiadr2.panstarrs1_original_valid as ps\n",
- " ON best.original_ext_source_id = ps.obj_id\n",
- "WHERE 1=CONTAINS(\n",
- " POINT(gaia.ra, gaia.dec),\n",
- " CIRCLE(88.8, 7.4, 0.08333333))\n",
- "\n"
- ]
- }
- ],
- "source": [
- "# Solution\n",
+ "\"\"\"\n",
"\n",
"column_list = ['gaia.source_id',\n",
" 'gaia.ra',\n",
@@ -1139,101 +1110,9 @@
"columns = ', '.join(column_list)\n",
"\n",
"query = query_base.format(columns=columns)\n",
- "print(query)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 27,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "INFO: Query finished. [astroquery.utils.tap.core]\n"
- ]
- }
- ],
- "source": [
- "# Solution\n",
- "\n",
- "job = Gaia.launch_job_async(query=query)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 28,
- "metadata": {
- "scrolled": true
- },
- "outputs": [
- {
- "data": {
- "text/html": [
- "Table length=490\n",
- "
\n",
- "| source_id | ra | dec | pmra | pmdec | best_neighbour_multiplicity | number_of_mates | g_mean_psf_mag | i_mean_psf_mag |
\n",
- " | deg | deg | mas / yr | mas / yr | | | | mag |
\n",
- "| int64 | float64 | float64 | float64 | float64 | int16 | int16 | float64 | float64 |
\n",
- "| 3322773965056065536 | 88.78178020183375 | 7.334936530583141 | 0.2980633722108194 | -2.5057036964736907 | 1 | 0 | 19.9431991577148 | 17.4221992492676 |
\n",
- "| 3322774068134271104 | 88.8206092188033 | 7.353158142762173 | -1.1065462654445488 | -1.5260889445858044 | 1 | 0 | 18.6212005615234 | 16.6007995605469 |
\n",
- "| 3322773930696320512 | 88.80843339290348 | 7.334853162299928 | 2.6074384482375215 | -0.9292104395445717 | 1 | 0 | -- | 20.2203998565674 |
\n",
- "| 3322774377374425728 | 88.86806108182265 | 7.371287731275939 | 3.9555477866915383 | -3.8676624830902435 | 1 | 0 | 18.0676002502441 | 16.9762001037598 |
\n",
- "| 3322773724537891456 | 88.81308602813434 | 7.32488574492059 | 51.34995462741039 | -33.078133430952086 | 1 | 0 | 20.1907005310059 | 17.8700008392334 |
\n",
- "| 3322773724537891328 | 88.81570329208743 | 7.3223019772324855 | 1.9389988498951845 | 0.3110526931576576 | 1 | 0 | 22.6308002471924 | 19.6004009246826 |
\n",
- "| 3322773930696321792 | 88.8050736770331 | 7.332371472206583 | 2.264014834476311 | 1.0772755505138008 | 1 | 0 | 21.2119998931885 | 18.3528003692627 |
\n",
- "| 3322773724537890944 | 88.81241651540533 | 7.327864052479726 | -0.36003627434304625 | -6.393939291541333 | 1 | 0 | 20.8094005584717 | 18.1343002319336 |
\n",
- "| 3322773930696322176 | 88.80128682574824 | 7.334292036448643 | -- | -- | 1 | 0 | 19.7306003570557 | -- |
\n",
- "| ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
- "| 3322962359501481088 | 88.85037722908271 | 7.402162717053584 | 2.058216493648542 | -2.249255322558584 | 1 | 0 | 17.4034996032715 | 15.9040002822876 |
\n",
- "| 3322962393861228544 | 88.82108234976155 | 7.4044425496203 | -0.916760881643629 | -1.1113319053861441 | 1 | 0 | -- | -- |
\n",
- "| 3322955831151254912 | 88.74620347799508 | 7.342728619145855 | 0.1559833902071379 | -1.750598455959734 | 1 | 0 | 18.4960994720459 | 17.3892993927002 |
\n",
- "| 3322962118983356032 | 88.76109637722949 | 7.380564308268047 | -- | -- | 1 | 0 | 18.0643997192383 | 16.7395000457764 |
\n",
- "| 3322963527732585984 | 88.78813701704823 | 7.456696889759524 | 1.1363354614104264 | -2.46251296961979 | 1 | 0 | 17.8034992218018 | 16.1214008331299 |
\n",
- "| 3322961775385969024 | 88.79723215862369 | 7.359756552906535 | 2.121021366548921 | -6.605711792572964 | 1 | 0 | 18.2070007324219 | 15.9947996139526 |
\n",
- "| 3322962084625312512 | 88.78286756313868 | 7.384598632215225 | -0.09350717810996487 | 1.3495903680571226 | 1 | 0 | 16.7978992462158 | 15.1180000305176 |
\n",
- "| 3322962939322692608 | 88.73289357818679 | 7.407688975612043 | -0.11002934783569704 | 1.002126813991455 | 1 | 0 | 17.18630027771 | 16.3645992279053 |
\n",
- "| 3322963459013111808 | 88.80348931842845 | 7.438699901204871 | 0.800833828337078 | -3.3780655466364626 | 1 | 0 | -- | 16.294900894165 |
\n",
- "| 3322962015904143872 | 88.74740822271643 | 7.387057037713974 | -0.7201178533250112 | 0.5565841272341593 | 1 | 0 | 18.4706993103027 | 16.8038005828857 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- " source_id ra ... g_mean_psf_mag i_mean_psf_mag \n",
- " deg ... mag \n",
- " int64 float64 ... float64 float64 \n",
- "------------------- ----------------- ... ---------------- ----------------\n",
- "3322773965056065536 88.78178020183375 ... 19.9431991577148 17.4221992492676\n",
- "3322774068134271104 88.8206092188033 ... 18.6212005615234 16.6007995605469\n",
- "3322773930696320512 88.80843339290348 ... -- 20.2203998565674\n",
- "3322774377374425728 88.86806108182265 ... 18.0676002502441 16.9762001037598\n",
- "3322773724537891456 88.81308602813434 ... 20.1907005310059 17.8700008392334\n",
- "3322773724537891328 88.81570329208743 ... 22.6308002471924 19.6004009246826\n",
- "3322773930696321792 88.8050736770331 ... 21.2119998931885 18.3528003692627\n",
- "3322773724537890944 88.81241651540533 ... 20.8094005584717 18.1343002319336\n",
- "3322773930696322176 88.80128682574824 ... 19.7306003570557 --\n",
- " ... ... ... ... ...\n",
- "3322962359501481088 88.85037722908271 ... 17.4034996032715 15.9040002822876\n",
- "3322962393861228544 88.82108234976155 ... -- --\n",
- "3322955831151254912 88.74620347799508 ... 18.4960994720459 17.3892993927002\n",
- "3322962118983356032 88.76109637722949 ... 18.0643997192383 16.7395000457764\n",
- "3322963527732585984 88.78813701704823 ... 17.8034992218018 16.1214008331299\n",
- "3322961775385969024 88.79723215862369 ... 18.2070007324219 15.9947996139526\n",
- "3322962084625312512 88.78286756313868 ... 16.7978992462158 15.1180000305176\n",
- "3322962939322692608 88.73289357818679 ... 17.18630027771 16.3645992279053\n",
- "3322963459013111808 88.80348931842845 ... -- 16.294900894165\n",
- "3322962015904143872 88.74740822271643 ... 18.4706993103027 16.8038005828857"
- ]
- },
- "execution_count": 28,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Solution\n",
+ "print(query)\n",
"\n",
+ "job = Gaia.launch_job_async(query=query)\n",
"results = job.get_results()\n",
"results"
]
@@ -1474,137 +1353,17 @@
" POLYGON({point_list}))\n",
" AND 1 = CONTAINS(POINT(gaia.pmra, gaia.pmdec),\n",
" POLYGON({pm_point_list}))\n",
- "\"\"\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 35,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "\n",
- "SELECT \n",
- "gaia.source_id, gaia.ra, gaia.dec, gaia.pmra, gaia.pmdec, best.best_neighbour_multiplicity, best.number_of_mates, ps.g_mean_psf_mag, ps.i_mean_psf_mag\n",
- "FROM gaiadr2.gaia_source as gaia\n",
- "JOIN gaiadr2.panstarrs1_best_neighbour as best\n",
- " ON gaia.source_id = best.source_id\n",
- "JOIN gaiadr2.panstarrs1_original_valid as ps\n",
- " ON best.original_ext_source_id = ps.obj_id\n",
- "WHERE parallax < 1\n",
- " AND bp_rp BETWEEN -0.75 AND 2 \n",
- " AND 1 = CONTAINS(POINT(gaia.ra, gaia.dec), \n",
- " POLYGON(135.306, 8.39862, 126.51, 13.4449, 163.017, 54.2424, 172.933, 46.4726, 135.306, 8.39862))\n",
- " AND 1 = CONTAINS(POINT(gaia.pmra, gaia.pmdec),\n",
- " POLYGON( -4.05037121,-14.75623261, -3.41981085,-14.72365546, -3.03521988,-14.44357135, -2.26847919,-13.7140236 , -2.61172203,-13.24797471, -2.73471401,-13.09054471, -3.19923146,-12.5942653 , -3.34082546,-12.47611926, -5.67489413,-11.16083338, -5.95159272,-11.10547884, -6.42394023,-11.05981295, -7.09631023,-11.95187806, -7.30641519,-12.24559977, -7.04016696,-12.88580702, -6.00347705,-13.75912098, -4.42442296,-14.74641176))\n",
- "\n"
- ]
- }
- ],
- "source": [
- "# Solution\n",
+ "\"\"\"\n",
"\n",
"columns = ', '.join(column_list)\n",
"\n",
"query7 = query7_base.format(columns=columns,\n",
" point_list=point_series['point_list'],\n",
" pm_point_list=point_series['pm_point_list'])\n",
- "print(query7)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 36,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "INFO: Query finished. [astroquery.utils.tap.core]\n"
- ]
- }
- ],
- "source": [
- "# Solution\n",
+ "print(query7)\n",
"\n",
- "job = Gaia.launch_job_async(query=query7)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 37,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "Table length=3725\n",
- "\n",
- "| source_id | ra | dec | pmra | pmdec | best_neighbour_multiplicity | number_of_mates | g_mean_psf_mag | i_mean_psf_mag |
\n",
- " | deg | deg | mas / yr | mas / yr | | | | mag |
\n",
- "| int64 | float64 | float64 | float64 | float64 | int16 | int16 | float64 | float64 |
\n",
- "| 635860218726658176 | 138.5187065217173 | 19.09233926905897 | -5.941679495793577 | -11.346409129876392 | 1 | 0 | 17.8978004455566 | 17.5174007415771 |
\n",
- "| 635674126383965568 | 138.8428741026386 | 19.031798198627634 | -3.8970011609340207 | -12.702779525389634 | 1 | 0 | 19.2873001098633 | 17.6781005859375 |
\n",
- "| 635535454774983040 | 137.8377518255436 | 18.864006786112604 | -4.335040664412791 | -14.492308604905652 | 1 | 0 | 16.9237995147705 | 16.478099822998 |
\n",
- "| 635497276810313600 | 138.0445160213759 | 19.00947118796605 | -7.1729306406216615 | -12.291499169815987 | 1 | 0 | 19.9242000579834 | 18.3339996337891 |
\n",
- "| 635614168640132864 | 139.59219748145836 | 18.807955539071433 | -3.309602916796381 | -13.708904908478631 | 1 | 0 | 16.1515998840332 | 14.6662998199463 |
\n",
- "| 635598607974369792 | 139.20920023089508 | 18.624132868942702 | -6.124445176881091 | -12.833824027100611 | 1 | 0 | 16.5223999023438 | 16.1375007629395 |
\n",
- "| 635737661835496576 | 139.93327552473934 | 19.167962454651423 | -7.119403303682826 | -12.687947497633793 | 1 | 0 | 14.5032997131348 | 13.9849004745483 |
\n",
- "| 635850945892748672 | 139.86542888472115 | 20.011312663154804 | -3.786655365804428 | -14.28415600718206 | 1 | 0 | 16.5174999237061 | 16.0450000762939 |
\n",
- "| 635600532119713664 | 139.22869949616816 | 18.685939084485494 | -3.9742788217925122 | -12.342426623384245 | 1 | 0 | 20.4505996704102 | 19.5177001953125 |
\n",
- "| ... | ... | ... | ... | ... | ... | ... | ... | ... |
\n",
- "| 612241781249124608 | 134.3755835065194 | 18.129179169751275 | -2.831807894848964 | -13.902118573613597 | 1 | 0 | 20.2343997955322 | 18.6518001556396 |
\n",
- "| 612332147361443072 | 134.14584721363653 | 18.45685585044513 | -6.234287981021865 | -11.500464195695072 | 1 | 0 | 21.3848991394043 | 20.3076000213623 |
\n",
- "| 612426744016802432 | 134.68522805061076 | 18.77090626983678 | -3.7691372464459554 | -12.889167493118862 | 1 | 0 | 17.8281002044678 | 17.4281005859375 |
\n",
- "| 612331739340341760 | 134.12176196902254 | 18.42768872157865 | -3.9894012386388735 | -12.60504410507441 | 1 | 0 | 21.8656997680664 | 19.5223007202148 |
\n",
- "| 612282738058264960 | 134.0445768189235 | 18.11915820167003 | -2.5972485319419127 | -13.651740929272187 | 1 | 0 | 22.5151996612549 | 19.9743995666504 |
\n",
- "| 612386332668697600 | 135.45701048323093 | 18.63266345155342 | -5.07684899854408 | -12.436641304786672 | 1 | 0 | 19.3792991638184 | 17.9923000335693 |
\n",
- "| 612296172717818624 | 133.80060286960668 | 18.08186533343457 | -6.112792578821885 | -12.50750861370402 | 1 | 0 | 17.4944000244141 | 16.926700592041 |
\n",
- "| 612250375480101760 | 134.64754712466774 | 18.122419425065015 | -2.8969262278467127 | -14.061676353845487 | 1 | 0 | 15.3330001831055 | 14.6280002593994 |
\n",
- "| 612394926899159168 | 135.51997060013844 | 18.817675531233004 | -3.9968965218753763 | -13.526821099431533 | 1 | 0 | 16.4414005279541 | 15.8212003707886 |
\n",
- "| 612256418500423168 | 134.90752972739924 | 18.280596648172743 | -6.109836304219565 | -12.145212331165776 | 1 | 0 | 20.8715991973877 | 19.9612007141113 |
\n",
- "
"
- ],
- "text/plain": [
- "\n",
- " source_id ra ... g_mean_psf_mag i_mean_psf_mag \n",
- " deg ... mag \n",
- " int64 float64 ... float64 float64 \n",
- "------------------ ------------------ ... ---------------- ----------------\n",
- "635860218726658176 138.5187065217173 ... 17.8978004455566 17.5174007415771\n",
- "635674126383965568 138.8428741026386 ... 19.2873001098633 17.6781005859375\n",
- "635535454774983040 137.8377518255436 ... 16.9237995147705 16.478099822998\n",
- "635497276810313600 138.0445160213759 ... 19.9242000579834 18.3339996337891\n",
- "635614168640132864 139.59219748145836 ... 16.1515998840332 14.6662998199463\n",
- "635598607974369792 139.20920023089508 ... 16.5223999023438 16.1375007629395\n",
- "635737661835496576 139.93327552473934 ... 14.5032997131348 13.9849004745483\n",
- "635850945892748672 139.86542888472115 ... 16.5174999237061 16.0450000762939\n",
- "635600532119713664 139.22869949616816 ... 20.4505996704102 19.5177001953125\n",
- " ... ... ... ... ...\n",
- "612241781249124608 134.3755835065194 ... 20.2343997955322 18.6518001556396\n",
- "612332147361443072 134.14584721363653 ... 21.3848991394043 20.3076000213623\n",
- "612426744016802432 134.68522805061076 ... 17.8281002044678 17.4281005859375\n",
- "612331739340341760 134.12176196902254 ... 21.8656997680664 19.5223007202148\n",
- "612282738058264960 134.0445768189235 ... 22.5151996612549 19.9743995666504\n",
- "612386332668697600 135.45701048323093 ... 19.3792991638184 17.9923000335693\n",
- "612296172717818624 133.80060286960668 ... 17.4944000244141 16.926700592041\n",
- "612250375480101760 134.64754712466774 ... 15.3330001831055 14.6280002593994\n",
- "612394926899159168 135.51997060013844 ... 16.4414005279541 15.8212003707886\n",
- "612256418500423168 134.90752972739924 ... 20.8715991973877 19.9612007141113"
- ]
- },
- "execution_count": 37,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Solution\n",
"\n",
+ "job = Gaia.launch_job_async(query=query7)\n",
"results = job.get_results()\n",
"results"
]
diff --git a/soln/06_photo.ipynb b/soln/06_photo.ipynb
index 8694817..4f65435 100644
--- a/soln/06_photo.ipynb
+++ b/soln/06_photo.ipynb
@@ -10,23 +10,21 @@
"exercises: 0\n",
"questions:\n",
"\n",
- "- \"How do we use Matplotlib to select a polygon and Pandas to merge data from multiple tables?\"\n",
+ "- \"How do we use Matplotlib to define a polygon and select points that fall inside it?\"\n",
"\n",
"objectives:\n",
"\n",
- "- \"Use Matplotlib to specify a polygon and determine which points fall inside it.\"\n",
+ "- \"Use isochrone data to specify a polygon and determine which points fall inside it.\"\n",
"\n",
- "- \"Use Pandas to merge data from multiple `DataFrames`, much like a database `JOIN` operation.\"\n",
+ "- \"Use Matplotlib features to customize the appearance of figures.\"\n",
"\n",
"keypoints:\n",
"\n",
"- \"Matplotlib provides operations for working with points, polygons, and other geometric entities, so it's not just for making figures.\"\n",
"\n",
- "- \"If you want to perform something like a database `JOIN` operation with data that is in a Pandas `DataFrame`, you can use the `join` or `merge` function. In many cases, `merge` is easier to use because the arguments are more like SQL.\"\n",
- "\n",
"- \"Use Matplotlib options to control the size and aspect ratio of figures to make them easier to interpret.\"\n",
"\n",
- "- \"Be sure to record every element of the data analysis pipeline that would be needed to replicate the results.\"\n",
+ "- \"Record every element of the data analysis pipeline that would be needed to replicate the results.\"\n",
"\n",
"---\n",
"\n",
diff --git a/soln/07_plot.ipynb b/soln/07_plot.ipynb
index 091fcda..e31c0af 100644
--- a/soln/07_plot.ipynb
+++ b/soln/07_plot.ipynb
@@ -22,9 +22,9 @@
"\n",
"keypoints:\n",
"\n",
- "- \"The most effective figures focus on telling a single story clearly and compellingly.\"\n",
+ "- \"The most effective figures focus on telling a single story clearly.\"\n",
"\n",
- "- \"Consider using annotations to guide the readers attention to the most important elements of a figure.\"\n",
+ "- \"Consider using annotations to guide the reader's attention to the most important elements of a figure.\"\n",
"\n",
"- \"The default Matplotlib style generates good quality figures, but there are several ways you can override the defaults.\"\n",
"\n",
@@ -1265,7 +1265,7 @@
"\n",
"* The most effective figures focus on telling a single story clearly and compellingly.\n",
"\n",
- "* Consider using annotations to guide the readers attention to the most important elements of a figure.\n",
+ "* Consider using annotations to guide the reader's attention to the most important elements of a figure.\n",
"\n",
"* The default Matplotlib style generates good quality figures, but there are several ways you can override the defaults.\n",
"\n",