|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "id": "dc689fc6", |
| 5 | + "id": "c71a56b9", |
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", |
|
18 | 18 | }, |
19 | 19 | { |
20 | 20 | "cell_type": "markdown", |
21 | | - "id": "1207070b", |
| 21 | + "id": "8993ab53", |
22 | 22 | "metadata": {}, |
23 | 23 | "source": [ |
24 | 24 | "### Learning Objectives\n", |
|
33 | 33 | { |
34 | 34 | "cell_type": "code", |
35 | 35 | "execution_count": null, |
36 | | - "id": "da9d7acd", |
| 36 | + "id": "52987dfb", |
37 | 37 | "metadata": {}, |
38 | 38 | "outputs": [], |
39 | 39 | "source": [ |
|
44 | 44 | }, |
45 | 45 | { |
46 | 46 | "cell_type": "markdown", |
47 | | - "id": "35f86ab0", |
| 47 | + "id": "e670521d", |
48 | 48 | "metadata": {}, |
49 | 49 | "source": [ |
50 | 50 | "### 1. Import Common Python Libraries\n", |
|
55 | 55 | { |
56 | 56 | "cell_type": "code", |
57 | 57 | "execution_count": null, |
58 | | - "id": "61277fb2", |
| 58 | + "id": "806acd1c", |
59 | 59 | "metadata": {}, |
60 | 60 | "outputs": [], |
61 | 61 | "source": [ |
|
68 | 68 | }, |
69 | 69 | { |
70 | 70 | "cell_type": "markdown", |
71 | | - "id": "e1878a99", |
| 71 | + "id": "792daffb", |
72 | 72 | "metadata": {}, |
73 | 73 | "source": [ |
74 | 74 | "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 | 77 | { |
78 | 78 | "cell_type": "code", |
79 | 79 | "execution_count": null, |
80 | | - "id": "c378f1a8", |
| 80 | + "id": "e16ddac5", |
81 | 81 | "metadata": {}, |
82 | 82 | "outputs": [], |
83 | 83 | "source": [ |
|
87 | 87 | "# from rubin_jupyter_utils.lab.notebook import get_catalog, retrieve_query\n", |
88 | 88 | "from rubin_jupyter_utils.lab.notebook import get_tap_service\n", |
89 | 89 | "\n", |
90 | | - "# Deprecated\n", |
91 | | - "# service = get_catalog()\n", |
92 | 90 | "service = get_tap_service()" |
93 | 91 | ] |
94 | 92 | }, |
95 | 93 | { |
96 | 94 | "cell_type": "markdown", |
97 | | - "id": "1f002e76", |
| 95 | + "id": "28405ef9", |
98 | 96 | "metadata": {}, |
99 | 97 | "source": [ |
100 | 98 | "### 2. Loading tables with TAP\n", |
|
105 | 103 | { |
106 | 104 | "cell_type": "code", |
107 | 105 | "execution_count": null, |
108 | | - "id": "a27bdbaf", |
| 106 | + "id": "166b0fa2", |
109 | 107 | "metadata": {}, |
110 | 108 | "outputs": [], |
111 | 109 | "source": [ |
|
117 | 115 | }, |
118 | 116 | { |
119 | 117 | "cell_type": "markdown", |
120 | | - "id": "9f7b8c23", |
| 118 | + "id": "0824f847", |
121 | 119 | "metadata": {}, |
122 | 120 | "source": [ |
123 | 121 | "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", |
|
128 | 126 | { |
129 | 127 | "cell_type": "code", |
130 | 128 | "execution_count": null, |
131 | | - "id": "d85fda84", |
| 129 | + "id": "0601ec4b", |
132 | 130 | "metadata": {}, |
133 | 131 | "outputs": [], |
134 | 132 | "source": [ |
|
146 | 144 | { |
147 | 145 | "cell_type": "code", |
148 | 146 | "execution_count": null, |
149 | | - "id": "bd4fdf31", |
| 147 | + "id": "d9fdaa83", |
150 | 148 | "metadata": {}, |
151 | 149 | "outputs": [], |
152 | 150 | "source": [ |
|
161 | 159 | }, |
162 | 160 | { |
163 | 161 | "cell_type": "markdown", |
164 | | - "id": "562bd55f", |
| 162 | + "id": "b3b53d14", |
165 | 163 | "metadata": {}, |
166 | 164 | "source": [ |
167 | 165 | "### 3. Extract a table of joined results from two tables, using a single query within ADQL\n", |
|
176 | 174 | { |
177 | 175 | "cell_type": "code", |
178 | 176 | "execution_count": null, |
179 | | - "id": "f0925d52", |
| 177 | + "id": "fd9a466e", |
180 | 178 | "metadata": {}, |
181 | 179 | "outputs": [], |
182 | 180 | "source": [ |
|
202 | 200 | { |
203 | 201 | "cell_type": "code", |
204 | 202 | "execution_count": null, |
205 | | - "id": "82f8b729", |
| 203 | + "id": "7a6f6dc4", |
206 | 204 | "metadata": {}, |
207 | 205 | "outputs": [], |
208 | 206 | "source": [ |
|
213 | 211 | }, |
214 | 212 | { |
215 | 213 | "cell_type": "markdown", |
216 | | - "id": "6390f5a2", |
| 214 | + "id": "24d3f0a9", |
217 | 215 | "metadata": {}, |
218 | 216 | "source": [ |
219 | 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." |
|
222 | 220 | { |
223 | 221 | "cell_type": "code", |
224 | 222 | "execution_count": null, |
225 | | - "id": "d92356f6", |
| 223 | + "id": "ae42fe8d", |
226 | 224 | "metadata": {}, |
227 | 225 | "outputs": [], |
228 | 226 | "source": [ |
|
233 | 231 | }, |
234 | 232 | { |
235 | 233 | "cell_type": "markdown", |
236 | | - "id": "66a2ba15", |
| 234 | + "id": "4956a0b9", |
237 | 235 | "metadata": {}, |
238 | 236 | "source": [ |
239 | 237 | "### 4. Compare table values by plotting" |
|
242 | 240 | { |
243 | 241 | "cell_type": "code", |
244 | 242 | "execution_count": null, |
245 | | - "id": "d6672057", |
| 243 | + "id": "0810af58", |
246 | 244 | "metadata": {}, |
247 | 245 | "outputs": [], |
248 | 246 | "source": [ |
|
276 | 274 | }, |
277 | 275 | { |
278 | 276 | "cell_type": "markdown", |
279 | | - "id": "b4a7f31d", |
| 277 | + "id": "897cd675", |
280 | 278 | "metadata": {}, |
281 | 279 | "source": [ |
282 | 280 | "#### Compare the measurements from the Object table to the \"true\" values for some objects.\n", |
|
289 | 287 | { |
290 | 288 | "cell_type": "code", |
291 | 289 | "execution_count": null, |
292 | | - "id": "e88af181", |
| 290 | + "id": "982f0a47", |
293 | 291 | "metadata": {}, |
294 | 292 | "outputs": [], |
295 | 293 | "source": [ |
|
299 | 297 | }, |
300 | 298 | { |
301 | 299 | "cell_type": "markdown", |
302 | | - "id": "b56ca5d2", |
| 300 | + "id": "171e794b", |
303 | 301 | "metadata": {}, |
304 | 302 | "source": [ |
305 | 303 | "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." |
|
308 | 306 | { |
309 | 307 | "cell_type": "code", |
310 | 308 | "execution_count": null, |
311 | | - "id": "f3ffe9f5", |
| 309 | + "id": "992064da", |
312 | 310 | "metadata": {}, |
313 | 311 | "outputs": [], |
314 | 312 | "source": [ |
315 | 313 | "fig, ax = plt.subplots(1, 2, figsize=(15, 8))\n", |
316 | 314 | "\n", |
317 | 315 | "plt.sca(ax[0]) # set the first axis as current\n", |
318 | | - "# plt.rcParams.update({'figure.figsize' : (9, 11)})\n", |
319 | 316 | "\n", |
320 | 317 | "plt.plot(truth_plus_meas['mag_g_cModel'][gx] - truth_plus_meas['mag_i_cModel'][gx],\n", |
321 | 318 | " truth_plus_meas['mag_g_cModel'][gx], 'k.', alpha=0.2, label='galaxies')\n", |
|
348 | 345 | }, |
349 | 346 | { |
350 | 347 | "cell_type": "markdown", |
351 | | - "id": "d83d90b0", |
| 348 | + "id": "281562f5", |
352 | 349 | "metadata": {}, |
353 | 350 | "source": [ |
354 | 351 | "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", |
|
359 | 356 | { |
360 | 357 | "cell_type": "code", |
361 | 358 | "execution_count": null, |
362 | | - "id": "b0bda66b", |
| 359 | + "id": "ee992151", |
363 | 360 | "metadata": {}, |
364 | 361 | "outputs": [], |
365 | 362 | "source": [ |
|
382 | 379 | }, |
383 | 380 | { |
384 | 381 | "cell_type": "markdown", |
385 | | - "id": "aa39cc9c", |
| 382 | + "id": "d08b6e1f", |
386 | 383 | "metadata": {}, |
387 | 384 | "source": [ |
388 | 385 | "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", |
|
393 | 390 | { |
394 | 391 | "cell_type": "code", |
395 | 392 | "execution_count": null, |
396 | | - "id": "5fb08ec4", |
| 393 | + "id": "20bf58e3", |
397 | 394 | "metadata": {}, |
398 | 395 | "outputs": [], |
399 | 396 | "source": [] |
|
0 commit comments