|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "id": "c71a56b9", |
| 5 | + "id": "e9a2fea9", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | 8 | "<img align=\"left\" src = https://project.lsst.org/sites/default/files/Rubin-O-Logo_0.png width=250 style=\"padding: 10px\"> \n", |
9 | 9 | "<br>\n", |
10 | 10 | "<b>Comparing Object and Truth Tables</b> <br>\n", |
11 | | - "Last verified to run on 2021-07-29 with LSST Science Pipelines release w_2021_25 <br>\n", |
| 11 | + "Last verified to run on 2021-08-16 with LSST Science Pipelines release w_2021_33 <br>\n", |
12 | 12 | "Contact author: Jeff Carlin <br>\n", |
13 | 13 | "Target audience: All DP0 delegates. <br>\n", |
14 | 14 | "Container Size: medium <br>\n", |
|
18 | 18 | }, |
19 | 19 | { |
20 | 20 | "cell_type": "markdown", |
21 | | - "id": "8993ab53", |
| 21 | + "id": "6222d63c", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "**Credit:** This tutorial was developed by Jeff Carlin in the context of the DP0. Please consider acknowledging Jeff Carlin in any publications or software releases that make use of this notebook's contents." |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "id": "1b181bce", |
22 | 30 | "metadata": {}, |
23 | 31 | "source": [ |
24 | 32 | "### Learning Objectives\n", |
|
33 | 41 | { |
34 | 42 | "cell_type": "code", |
35 | 43 | "execution_count": null, |
36 | | - "id": "52987dfb", |
| 44 | + "id": "db0c9660", |
37 | 45 | "metadata": {}, |
38 | 46 | "outputs": [], |
39 | 47 | "source": [ |
|
44 | 52 | }, |
45 | 53 | { |
46 | 54 | "cell_type": "markdown", |
47 | | - "id": "e670521d", |
| 55 | + "id": "3a74653c", |
48 | 56 | "metadata": {}, |
49 | 57 | "source": [ |
50 | 58 | "### 1. Import Common Python Libraries\n", |
|
55 | 63 | { |
56 | 64 | "cell_type": "code", |
57 | 65 | "execution_count": null, |
58 | | - "id": "806acd1c", |
| 66 | + "id": "a75a320a", |
59 | 67 | "metadata": {}, |
60 | 68 | "outputs": [], |
61 | 69 | "source": [ |
|
68 | 76 | }, |
69 | 77 | { |
70 | 78 | "cell_type": "markdown", |
71 | | - "id": "792daffb", |
| 79 | + "id": "379c34ed", |
72 | 80 | "metadata": {}, |
73 | 81 | "source": [ |
74 | 82 | "To access tables, we will use the TAP service in a similar manner to what we showed in the [Intro to DP0 notebook](https://github.com/rubin-dp0/tutorial-notebooks/blob/main/01_Intro_to_DP0_Notebooks.ipynb), and explored further in the [TAP tutorial notebook](https://github.com/rubin-dp0/tutorial-notebooks/blob/main/02_Intermediate_TAP_Query.ipynb). See those notebooks for more details." |
|
77 | 85 | { |
78 | 86 | "cell_type": "code", |
79 | 87 | "execution_count": null, |
80 | | - "id": "e16ddac5", |
| 88 | + "id": "5803048d", |
81 | 89 | "metadata": {}, |
82 | 90 | "outputs": [], |
83 | 91 | "source": [ |
|
92 | 100 | }, |
93 | 101 | { |
94 | 102 | "cell_type": "markdown", |
95 | | - "id": "28405ef9", |
| 103 | + "id": "e6cc2670", |
96 | 104 | "metadata": {}, |
97 | 105 | "source": [ |
98 | 106 | "### 2. Loading tables with TAP\n", |
|
103 | 111 | { |
104 | 112 | "cell_type": "code", |
105 | 113 | "execution_count": null, |
106 | | - "id": "166b0fa2", |
| 114 | + "id": "bc7d10ed", |
107 | 115 | "metadata": {}, |
108 | 116 | "outputs": [], |
109 | 117 | "source": [ |
|
115 | 123 | }, |
116 | 124 | { |
117 | 125 | "cell_type": "markdown", |
118 | | - "id": "0824f847", |
| 126 | + "id": "ca9b3dc9", |
119 | 127 | "metadata": {}, |
120 | 128 | "source": [ |
121 | 129 | "For our analysis, let's choose the Object table, `dp01_dc2_catalogs.object`, and then we will compare the measurements from this table to the \"truth\" values from `dp01_dc2_catalogs.truth_match`.\n", |
|
126 | 134 | { |
127 | 135 | "cell_type": "code", |
128 | 136 | "execution_count": null, |
129 | | - "id": "0601ec4b", |
| 137 | + "id": "63c516fd", |
130 | 138 | "metadata": {}, |
131 | 139 | "outputs": [], |
132 | 140 | "source": [ |
|
144 | 152 | { |
145 | 153 | "cell_type": "code", |
146 | 154 | "execution_count": null, |
147 | | - "id": "d9fdaa83", |
| 155 | + "id": "31d870ea", |
148 | 156 | "metadata": {}, |
149 | 157 | "outputs": [], |
150 | 158 | "source": [ |
|
159 | 167 | }, |
160 | 168 | { |
161 | 169 | "cell_type": "markdown", |
162 | | - "id": "b3b53d14", |
| 170 | + "id": "943a1e80", |
163 | 171 | "metadata": {}, |
164 | 172 | "source": [ |
165 | 173 | "### 3. Extract a table of joined results from two tables, using a single query within ADQL\n", |
|
174 | 182 | { |
175 | 183 | "cell_type": "code", |
176 | 184 | "execution_count": null, |
177 | | - "id": "fd9a466e", |
| 185 | + "id": "441468a1", |
178 | 186 | "metadata": {}, |
179 | 187 | "outputs": [], |
180 | 188 | "source": [ |
|
200 | 208 | { |
201 | 209 | "cell_type": "code", |
202 | 210 | "execution_count": null, |
203 | | - "id": "7a6f6dc4", |
| 211 | + "id": "679e8229", |
204 | 212 | "metadata": {}, |
205 | 213 | "outputs": [], |
206 | 214 | "source": [ |
|
211 | 219 | }, |
212 | 220 | { |
213 | 221 | "cell_type": "markdown", |
214 | | - "id": "24d3f0a9", |
| 222 | + "id": "9588f0b2", |
215 | 223 | "metadata": {}, |
216 | 224 | "source": [ |
217 | | - "Notice the \"%%time\" cell magic we used. This was included to highlight that selecting more than 14000 objects from two tables and joining them takes less than 2 seconds (typically). Doing two separate queries, then joining them using `pandas`, typically takes more than a full minute." |
| 225 | + "Notice the `%%time` [cell magic](https://ipython.readthedocs.io/en/stable/interactive/magics.html) we used. This was included to highlight that selecting more than 14000 objects from two tables and joining them takes less than 2 seconds (typically). Doing two separate queries, then joining them using `pandas`, typically takes more than a full minute." |
218 | 226 | ] |
219 | 227 | }, |
220 | 228 | { |
221 | 229 | "cell_type": "code", |
222 | 230 | "execution_count": null, |
223 | | - "id": "ae42fe8d", |
| 231 | + "id": "f9775666", |
224 | 232 | "metadata": {}, |
225 | 233 | "outputs": [], |
226 | 234 | "source": [ |
|
231 | 239 | }, |
232 | 240 | { |
233 | 241 | "cell_type": "markdown", |
234 | | - "id": "4956a0b9", |
| 242 | + "id": "9ac08554", |
235 | 243 | "metadata": {}, |
236 | 244 | "source": [ |
237 | 245 | "### 4. Compare table values by plotting" |
|
240 | 248 | { |
241 | 249 | "cell_type": "code", |
242 | 250 | "execution_count": null, |
243 | | - "id": "0810af58", |
| 251 | + "id": "1806b66c", |
244 | 252 | "metadata": {}, |
245 | 253 | "outputs": [], |
246 | 254 | "source": [ |
|
274 | 282 | }, |
275 | 283 | { |
276 | 284 | "cell_type": "markdown", |
277 | | - "id": "897cd675", |
| 285 | + "id": "b15743bb", |
278 | 286 | "metadata": {}, |
279 | 287 | "source": [ |
280 | 288 | "#### Compare the measurements from the Object table to the \"true\" values for some objects.\n", |
|
287 | 295 | { |
288 | 296 | "cell_type": "code", |
289 | 297 | "execution_count": null, |
290 | | - "id": "982f0a47", |
| 298 | + "id": "401ba83e", |
291 | 299 | "metadata": {}, |
292 | 300 | "outputs": [], |
293 | 301 | "source": [ |
|
297 | 305 | }, |
298 | 306 | { |
299 | 307 | "cell_type": "markdown", |
300 | | - "id": "171e794b", |
| 308 | + "id": "fd57ca6a", |
301 | 309 | "metadata": {}, |
302 | 310 | "source": [ |
303 | 311 | "Just to confirm that things look like we expect, let's plot a color-magnitude (g vs. g-i) and color-color (r-i vs. g-r) diagram." |
|
306 | 314 | { |
307 | 315 | "cell_type": "code", |
308 | 316 | "execution_count": null, |
309 | | - "id": "992064da", |
| 317 | + "id": "884763ad", |
310 | 318 | "metadata": {}, |
311 | 319 | "outputs": [], |
312 | 320 | "source": [ |
|
345 | 353 | }, |
346 | 354 | { |
347 | 355 | "cell_type": "markdown", |
348 | | - "id": "281562f5", |
| 356 | + "id": "682c5d15", |
349 | 357 | "metadata": {}, |
350 | 358 | "source": [ |
351 | 359 | "Looks pretty normal - the stellar locus in color-color space is right where one expects it to be, and the galaxies dominate at the faint end of the CMD. \n", |
|
356 | 364 | { |
357 | 365 | "cell_type": "code", |
358 | 366 | "execution_count": null, |
359 | | - "id": "ee992151", |
| 367 | + "id": "87318bec", |
360 | 368 | "metadata": {}, |
361 | 369 | "outputs": [], |
362 | 370 | "source": [ |
|
379 | 387 | }, |
380 | 388 | { |
381 | 389 | "cell_type": "markdown", |
382 | | - "id": "d08b6e1f", |
| 390 | + "id": "667acf5a", |
383 | 391 | "metadata": {}, |
384 | 392 | "source": [ |
385 | 393 | "Well, that looks good -- the ratio of measured to true fluxes is centered on 1.0. It seems like the fluxes are recovered pretty well, on average.\n", |
|
390 | 398 | { |
391 | 399 | "cell_type": "code", |
392 | 400 | "execution_count": null, |
393 | | - "id": "20bf58e3", |
| 401 | + "id": "e3b35b1d", |
394 | 402 | "metadata": {}, |
395 | 403 | "outputs": [], |
396 | 404 | "source": [] |
|
0 commit comments