|
177 | 177 | "# Define a reference position on the sky and a radius in arcseconds for a cone search\n", |
178 | 178 | "c1 = SkyCoord(ra=59.7955707*u.degree, dec=-29.91176471*u.degree, frame='icrs')\n", |
179 | 179 | "#radius = 15.882353 * u.arcmin\n", |
180 | | - "radius = 6 * u.arcmin" |
| 180 | + "radius = 0.1 * u.deg" |
181 | 181 | ] |
182 | 182 | }, |
183 | 183 | { |
|
186 | 186 | "metadata": {}, |
187 | 187 | "outputs": [], |
188 | 188 | "source": [ |
189 | | - "query = \"SELECT obj.ra, obj.dec, obj.objectId, obj.mag_g, obj.mag_r, \" \\\n", |
190 | | - " \"obj.mag_i, obj.mag_g_cModel, obj.mag_r_cModel, obj.mag_i_cModel,\" \\\n", |
191 | | - " \"obj.psFlux_g, obj.psFlux_r, obj.psFlux_i, obj.cModelFlux_g, \" \\\n", |
192 | | - " \"obj.cModelFlux_r, obj.cModelFlux_i, obj.tract, obj.patch, \" \\\n", |
193 | | - " \"obj.extendedness, obj.good, obj.clean, \" \\\n", |
194 | | - " \"truth.mag_r as truth_mag_r, truth.match_objectId, \"\\\n", |
195 | | - " \"truth.flux_g, truth.flux_r, truth.flux_i, truth.truth_type, \" \\\n", |
196 | | - " \"truth.match_sep, truth.is_variable \" \\\n", |
| 189 | + "query = \"SELECT obj.ra, obj.dec, obj.objectId, \"\\\n", |
| 190 | + " \"obj.mag_g_cModel, obj.mag_r_cModel, obj.mag_i_cModel, \"\\\n", |
| 191 | + " \"truth_type, truth.match_objectId \" \\\n", |
197 | 192 | " \"FROM dp01_dc2_catalogs.object as obj \" \\\n", |
198 | 193 | " \"JOIN dp01_dc2_catalogs.truth_match as truth \" \\\n", |
199 | 194 | " \"ON truth.match_objectId = obj.objectId \" \\\n", |
|
205 | 200 | "# print(query)" |
206 | 201 | ] |
207 | 202 | }, |
| 203 | + { |
| 204 | + "cell_type": "code", |
| 205 | + "execution_count": null, |
| 206 | + "metadata": {}, |
| 207 | + "outputs": [], |
| 208 | + "source": [ |
| 209 | + " # \"obj.psFlux_g, obj.psFlux_r, obj.psFlux_i, obj.cModelFlux_g, \" \\\n", |
| 210 | + " # \"truth.flux_g, truth.flux_r, truth.flux_i, truth.truth_type, \" \\\n", |
| 211 | + " # \"obj.mag_g, obj.mag_r, obj.mag_i, obj.mag_g_cModel, obj.mag_r_cModel, obj.mag_i_cModel,\" \\" |
| 212 | + ] |
| 213 | + }, |
208 | 214 | { |
209 | 215 | "cell_type": "code", |
210 | 216 | "execution_count": null, |
|
214 | 220 | "%%time\n", |
215 | 221 | "# Execute the query and convert the results to a pandas dataframe\n", |
216 | 222 | "data = service.search(query).to_table().to_pandas() \n", |
217 | | - "#assert len(data) == 10284 # 102096" |
| 223 | + "# assert len(data) == 14589 # 10284 # 102096" |
| 224 | + ] |
| 225 | + }, |
| 226 | + { |
| 227 | + "cell_type": "code", |
| 228 | + "execution_count": null, |
| 229 | + "metadata": {}, |
| 230 | + "outputs": [], |
| 231 | + "source": [ |
| 232 | + "len(data)" |
218 | 233 | ] |
219 | 234 | }, |
220 | 235 | { |
|
346 | 361 | "# Slice the data and set some moore options\n", |
347 | 362 | "skyplot = hv.Scatter(data[[\"ra\", \"dec\"]]).opts(\n", |
348 | 363 | " title=\"Skyplot\", toolbar='above', tools = ['hover'], \n", |
349 | | - " height=350, width=350) \n", |
| 364 | + " height=350, width=350, alpha=0.2, size=2) \n", |
350 | 365 | "\n", |
351 | 366 | "# Construct a layout using the `+` operator\n", |
352 | 367 | "skyplots = skyplot + \\\n", |
353 | | - " skyplot[59.67:60.07, -30.71:-29.78].opts(\n", |
| 368 | + " skyplot[59.75:60.07, -30.71:-29.95].opts(\n", |
354 | 369 | " title=\"Skyplot region\", tools=[]) + \\\n", |
355 | 370 | " ra_distribution.options(height=350, width=350)" |
356 | 371 | ] |
|
385 | 400 | "outputs": [], |
386 | 401 | "source": [ |
387 | 402 | "# Bokeh specific customizations as a python dictionary \n", |
388 | | - "plot_style_bkh = dict(alpha=0.4, color='darkmagenta', \n", |
389 | | - " marker='triangle', size=3,\n", |
| 403 | + "plot_style_bkh = dict(alpha=0.2, color='darkmagenta', \n", |
| 404 | + " marker='triangle', size=2,\n", |
390 | 405 | " xticks=5, yticks=5,\n", |
391 | 406 | " height=400, width=400, \n", |
392 | 407 | " toolbar='above')\n", |
393 | 408 | "\n", |
394 | 409 | "# Matplotlib specific customizations\n", |
395 | 410 | "plot_style_mpl = dict(alpha=0.2, color='c', marker='s', \n", |
396 | | - " fig_size = 200, s=3, \n", |
| 411 | + " fig_size = 200, s=2, \n", |
397 | 412 | " fontsize=14, xticks=8, yticks=8)" |
398 | 413 | ] |
399 | 414 | }, |
|
498 | 513 | "outputs": [], |
499 | 514 | "source": [ |
500 | 515 | "%%opts Scatter [tools=['hover'], toolbar='above',height=400, width=400](color='grey')\n", |
501 | | - "hv.Scatter(data)" |
| 516 | + "hv.Scatter(data).opts(alpha=0.2, size=1)" |
502 | 517 | ] |
503 | 518 | }, |
504 | 519 | { |
|
535 | 550 | "metadata": {}, |
536 | 551 | "outputs": [], |
537 | 552 | "source": [ |
538 | | - "hv.Scatter(data).opts(tools=[raDecHover], **plot_style_bkh)" |
| 553 | + "hv.Scatter(data).opts(tools=[raDecHover], \n", |
| 554 | + " **plot_style_bkh)" |
539 | 555 | ] |
540 | 556 | }, |
541 | 557 | { |
|
640 | 656 | "stars = CDSView(source=source,\n", |
641 | 657 | " filters=[GroupFilter(column_name='truth_type', group=\"star\")])\n", |
642 | 658 | "\n", |
643 | | - "left = figure(tools=tools_left, plot_width=400, plot_height=400,\n", |
644 | | - " output_backend=\"webgl\",\n", |
| 659 | + "left = figure(tools=tools_left, \n", |
| 660 | + " plot_width=400, plot_height=400,\n", |
645 | 661 | " title='Spatial: Centered on (RA, Dec) = (%.2f, %.2f)' %\n", |
646 | 662 | " (c1.ra.value, c1.dec.value))\n", |
647 | 663 | "left.circle('x0', 'y0', hover_color='firebrick', \n", |
648 | | - " source=source, view=stars, # select only stars\n", |
649 | | - " selection_fill_color='steelblue',\n", |
650 | | - " selection_line_color='steelblue',\n", |
651 | | - " nonselection_fill_color='silver',\n", |
652 | | - " nonselection_line_color='silver')\n", |
| 664 | + " size=2, alpha=0.5,\n", |
| 665 | + " source=source, \n", |
| 666 | + " view=stars # select only stars\n", |
| 667 | + " )\n", |
653 | 668 | "left.x_range = Range1d(0.15, -0.15)\n", |
654 | 669 | "left.y_range = Range1d(-0.15, 0.15)\n", |
655 | 670 | "left.xaxis.axis_label = 'Delta RA'\n", |
656 | 671 | "left.yaxis.axis_label = 'Delta DEC'\n", |
657 | 672 | "\n", |
658 | 673 | "# create another new plot and add a renderer\n", |
659 | 674 | "right = figure(tools=tools_right, plot_width=400, plot_height=400, \n", |
660 | | - " output_backend=\"webgl\",\n", |
661 | 675 | " title='CMD')\n", |
662 | 676 | "right.circle('x1', 'y1', hover_color='firebrick', \n", |
663 | | - " source=source, view=stars, # Select only stars\n", |
664 | | - " selection_fill_color='steelblue',\n", |
665 | | - " selection_line_color='steelblue',\n", |
666 | | - " nonselection_fill_color='silver',\n", |
667 | | - " nonselection_line_color='silver')\n", |
| 677 | + " size=2, alpha=0.5,\n", |
| 678 | + " source=source, \n", |
| 679 | + " view=stars # Select only stars\n", |
| 680 | + " )\n", |
668 | 681 | "right.x_range = Range1d(-1.5, 2.5)\n", |
669 | 682 | "right.y_range = Range1d(32., 16.)\n", |
670 | 683 | "right.xaxis.axis_label = 'g - r'\n", |
|
793 | 806 | " x_range=(-2.0, 3.0), y_range=(-2.0, 3.0),\n", |
794 | 807 | " **plot_options)\n", |
795 | 808 | "p.circle(x='gmr', y='rmi', source=source,\n", |
796 | | - " size=3, alpha=0.3,\n", |
| 809 | + " size=1, alpha=0.1,\n", |
797 | 810 | " hover_color='firebrick',\n", |
798 | 811 | " legend_field=\"truth_type\",\n", |
799 | 812 | " color=factor_cmap('truth_type', 'Category10_3',\n", |
|
0 commit comments