|
31 | 31 | "id": "ae760c59-bf94-45b3-9f8e-b4551b22e193", |
32 | 32 | "metadata": {}, |
33 | 33 | "source": [ |
34 | | - "**Learning objective:** An overview of candidate transient (Ia Supernovae) identification in DP1.\n", |
| 34 | + "**Learning objective:** Generate many image cutouts using the Rubin image cutout service.\n", |
35 | 35 | "\n", |
36 | 36 | "**LSST data products:** `DiaObject`, `Visit`, `visit_image`, `template_coadd`, `difference_image`\n", |
37 | 37 | "\n", |
38 | 38 | "**Packages:** `matplotlib`, `numpy`, `lsst.rsp`,`lsst.afw`, `lsst.geom`, `lsst.resources`, `lsst.utils.plotting`, `pyvo.dal.adhoc`, `reproject`\n", |
39 | 39 | "\n", |
40 | 40 | "**Credit:**\n", |
41 | | - "Originally developed by the Rubin Community Science team with feedback from Eric Bellm. This notebook also utilizes a transient detection from LSSTComCam first identified by Dan Taranu.\n", |
| 41 | + "Originally developed by the Rubin Community Science team with feedback from Gregory Dubois-Feldman. This notebook also utilizes a transient detection from LSSTComCam first identified by Dan Taranu.\n", |
42 | 42 | "Please consider acknowledging them if this notebook is used for the preparation of journal articles, software releases, or other notebooks.\n", |
43 | 43 | "\n", |
44 | 44 | "**Get Support:**\n", |
|
95 | 95 | "source": [ |
96 | 96 | "import matplotlib.pyplot as plt\n", |
97 | 97 | "import math\n", |
98 | | - "\n", |
99 | 98 | "import numpy as np\n", |
100 | | - "from astropy import units as u\n", |
101 | 99 | "\n", |
102 | 100 | "from lsst.rsp import get_tap_service\n", |
103 | 101 | "from lsst.rsp.service import get_siav2_service\n", |
104 | 102 | "from lsst.rsp.utils import get_pyvo_auth\n", |
105 | 103 | "\n", |
106 | | - "from lsst.utils.plotting import (get_multiband_plot_colors,\n", |
107 | | - " get_multiband_plot_symbols)\n", |
108 | 104 | "\n", |
109 | 105 | "import lsst.afw.display as afwDisplay\n", |
110 | 106 | "from lsst.afw.image import ImageF\n", |
111 | 107 | "from lsst.afw.fits import MemFileManager\n", |
112 | | - "import lsst.geom as geom\n", |
113 | | - "import lsst.resources\n", |
114 | 108 | "\n", |
115 | 109 | "from pyvo.dal.adhoc import DatalinkResults, SodaQuery\n", |
116 | 110 | "\n", |
| 111 | + "from astropy import units as u\n", |
117 | 112 | "from astropy.wcs import WCS\n", |
118 | 113 | "from astropy.io import fits\n", |
119 | 114 | "import io\n", |
|
173 | 168 | "assert sia_service is not None" |
174 | 169 | ] |
175 | 170 | }, |
176 | | - { |
177 | | - "cell_type": "markdown", |
178 | | - "id": "9b02d9d2-23ce-48c4-8265-460604817467", |
179 | | - "metadata": {}, |
180 | | - "source": [ |
181 | | - "Define filter names, plot markers, linestyles, and colors for plotting" |
182 | | - ] |
183 | | - }, |
184 | | - { |
185 | | - "cell_type": "code", |
186 | | - "execution_count": null, |
187 | | - "id": "c5f87c79-8798-4306-bb82-495edb1463b2", |
188 | | - "metadata": {}, |
189 | | - "outputs": [], |
190 | | - "source": [ |
191 | | - "filter_names = ['u', 'g', 'r', 'i', 'z', 'y']\n", |
192 | | - "filter_colors = get_multiband_plot_colors()\n", |
193 | | - "filter_symbols = get_multiband_plot_symbols()" |
194 | | - ] |
195 | | - }, |
196 | 171 | { |
197 | 172 | "cell_type": "markdown", |
198 | 173 | "id": "cc51bd61-5bea-47d8-b67b-30ff46f6e180", |
|
334 | 309 | "metadata": {}, |
335 | 310 | "outputs": [], |
336 | 311 | "source": [ |
337 | | - "def get_cutout(dl_result, spherePoint, session, fov):\n", |
| 312 | + "def get_cutout(dl_result, ra, dec, session, fov):\n", |
338 | 313 | " sq = SodaQuery.from_resource(dl_result,\n", |
339 | 314 | " dl_result.get_adhocservice_by_id(\"cutout-sync\"),\n", |
340 | 315 | " session=session)\n", |
341 | | - " sphereRadius = fov * u.deg\n", |
342 | | - " sq.circle = (spherePoint.getRa().asDegrees() * u.deg,\n", |
343 | | - " spherePoint.getDec().asDegrees() * u.deg,\n", |
344 | | - " sphereRadius)\n", |
345 | | - " # can remove spherepoint stuff using:\n", |
346 | | - " #sq.circle = (cutout_ra, cutout_dec, Radius)\n", |
| 316 | + "\n", |
| 317 | + " sq.circle = (ra * u.deg, dec * u.deg, fov * u.deg)\n", |
347 | 318 | "\n", |
348 | 319 | " cutout_bytes = sq.execute_stream().read()\n", |
349 | 320 | " sq.raise_if_error()\n", |
|
353 | 324 | " return ImageF(mem), hdul" |
354 | 325 | ] |
355 | 326 | }, |
| 327 | + { |
| 328 | + "cell_type": "markdown", |
| 329 | + "id": "3d998864-d33a-449d-a28a-42e94607f901", |
| 330 | + "metadata": {}, |
| 331 | + "source": [ |
| 332 | + "#### 1.2.4. subplots\n", |
| 333 | + "Define a function to organize the display with matplotlib of many cutouts." |
| 334 | + ] |
| 335 | + }, |
356 | 336 | { |
357 | 337 | "cell_type": "code", |
358 | 338 | "execution_count": null, |
|
403 | 383 | "metadata": {}, |
404 | 384 | "outputs": [], |
405 | 385 | "source": [ |
406 | | - "#SNcandID = 611255759837069401\n", |
407 | 386 | "ra = 53.124767650110215\n", |
408 | | - "dec = -27.739814591611168\n", |
409 | | - "spherePoint = lsst.geom.SpherePoint(ra*geom.degrees, dec*geom.degrees)" |
| 387 | + "dec = -27.739814591611168" |
410 | 388 | ] |
411 | 389 | }, |
412 | 390 | { |
|
484 | 462 | "tx = np.where((lvl2_table['dataproduct_subtype'] == 'lsst.visit_image')\n", |
485 | 463 | " & (lvl2_table['lsst_band'] == 'r'))[0]\n", |
486 | 464 | "scitab = lvl2_table[tx]\n", |
487 | | - "scitab.sort('t_max')\n", |
488 | | - "print(scitab['t_max'])" |
| 465 | + "scitab.sort('t_max')" |
489 | 466 | ] |
490 | 467 | }, |
491 | 468 | { |
|
579 | 556 | "outputs": [], |
580 | 557 | "source": [ |
581 | 558 | "fov = 0.002\n", |
582 | | - "sci, scihdul = get_cutout(dl_result_sci, spherePoint, get_pyvo_auth(), fov)\n", |
583 | | - "ref, refhdul = get_cutout(dl_result_ref, spherePoint, get_pyvo_auth(), fov)\n", |
584 | | - "diff, diffhdul = get_cutout(dl_result_diff, spherePoint, get_pyvo_auth(), fov)" |
| 559 | + "sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n", |
| 560 | + "ref, refhdul = get_cutout(dl_result_ref, ra, dec, get_pyvo_auth(), fov)\n", |
| 561 | + "diff, diffhdul = get_cutout(dl_result_diff, ra, dec, get_pyvo_auth(), fov)" |
585 | 562 | ] |
586 | 563 | }, |
587 | 564 | { |
|
752 | 729 | " dl_result_sci = DatalinkResults.from_result_url(scitab['access_url'][j],\n", |
753 | 730 | " session=get_pyvo_auth())\n", |
754 | 731 | "\n", |
755 | | - " sci, scihdul = get_cutout(dl_result_sci, spherePoint, get_pyvo_auth(), fov)\n", |
| 732 | + " sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n", |
756 | 733 | " sci_hdu = scihdul[1]\n", |
757 | 734 | " sci_header = scihdul[1].header\n", |
758 | 735 | " scidata = scihdul[1].data\n", |
|
804 | 781 | " dl_result_sci = DatalinkResults.from_result_url(scitab['access_url'][j],\n", |
805 | 782 | " session=get_pyvo_auth())\n", |
806 | 783 | "\n", |
807 | | - " sci, scihdul = get_cutout(dl_result_sci, spherePoint, get_pyvo_auth(), fov)\n", |
| 784 | + " sci, scihdul = get_cutout(dl_result_sci, ra, dec, get_pyvo_auth(), fov)\n", |
808 | 785 | " sci_hdu = scihdul[1]\n", |
809 | 786 | " sci_header = scihdul[1].header\n", |
810 | 787 | " scidata = scihdul[1].data\n", |
|
0 commit comments