Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 7362544

Browse files
author
Leanne Guy
committed
Removed columns from Qserv query that are not using in NB; modified several options
1 parent 8726e05 commit 7362544

1 file changed

Lines changed: 44 additions & 31 deletions

File tree

08b_Interactive_Catalog_Visualization.ipynb

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
"# Define a reference position on the sky and a radius in arcseconds for a cone search\n",
178178
"c1 = SkyCoord(ra=59.7955707*u.degree, dec=-29.91176471*u.degree, frame='icrs')\n",
179179
"#radius = 15.882353 * u.arcmin\n",
180-
"radius = 6 * u.arcmin"
180+
"radius = 0.1 * u.deg"
181181
]
182182
},
183183
{
@@ -186,14 +186,9 @@
186186
"metadata": {},
187187
"outputs": [],
188188
"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",
197192
" \"FROM dp01_dc2_catalogs.object as obj \" \\\n",
198193
" \"JOIN dp01_dc2_catalogs.truth_match as truth \" \\\n",
199194
" \"ON truth.match_objectId = obj.objectId \" \\\n",
@@ -205,6 +200,17 @@
205200
"# print(query)"
206201
]
207202
},
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+
},
208214
{
209215
"cell_type": "code",
210216
"execution_count": null,
@@ -214,7 +220,16 @@
214220
"%%time\n",
215221
"# Execute the query and convert the results to a pandas dataframe\n",
216222
"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)"
218233
]
219234
},
220235
{
@@ -346,11 +361,11 @@
346361
"# Slice the data and set some moore options\n",
347362
"skyplot = hv.Scatter(data[[\"ra\", \"dec\"]]).opts(\n",
348363
" title=\"Skyplot\", toolbar='above', tools = ['hover'], \n",
349-
" height=350, width=350) \n",
364+
" height=350, width=350, alpha=0.2, size=2) \n",
350365
"\n",
351366
"# Construct a layout using the `+` operator\n",
352367
"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",
354369
" title=\"Skyplot region\", tools=[]) + \\\n",
355370
" ra_distribution.options(height=350, width=350)"
356371
]
@@ -385,15 +400,15 @@
385400
"outputs": [],
386401
"source": [
387402
"# 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",
390405
" xticks=5, yticks=5,\n",
391406
" height=400, width=400, \n",
392407
" toolbar='above')\n",
393408
"\n",
394409
"# Matplotlib specific customizations\n",
395410
"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",
397412
" fontsize=14, xticks=8, yticks=8)"
398413
]
399414
},
@@ -498,7 +513,7 @@
498513
"outputs": [],
499514
"source": [
500515
"%%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)"
502517
]
503518
},
504519
{
@@ -535,7 +550,8 @@
535550
"metadata": {},
536551
"outputs": [],
537552
"source": [
538-
"hv.Scatter(data).opts(tools=[raDecHover], **plot_style_bkh)"
553+
"hv.Scatter(data).opts(tools=[raDecHover], \n",
554+
" **plot_style_bkh)"
539555
]
540556
},
541557
{
@@ -640,31 +656,28 @@
640656
"stars = CDSView(source=source,\n",
641657
" filters=[GroupFilter(column_name='truth_type', group=\"star\")])\n",
642658
"\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",
645661
" title='Spatial: Centered on (RA, Dec) = (%.2f, %.2f)' %\n",
646662
" (c1.ra.value, c1.dec.value))\n",
647663
"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",
653668
"left.x_range = Range1d(0.15, -0.15)\n",
654669
"left.y_range = Range1d(-0.15, 0.15)\n",
655670
"left.xaxis.axis_label = 'Delta RA'\n",
656671
"left.yaxis.axis_label = 'Delta DEC'\n",
657672
"\n",
658673
"# create another new plot and add a renderer\n",
659674
"right = figure(tools=tools_right, plot_width=400, plot_height=400, \n",
660-
" output_backend=\"webgl\",\n",
661675
" title='CMD')\n",
662676
"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",
668681
"right.x_range = Range1d(-1.5, 2.5)\n",
669682
"right.y_range = Range1d(32., 16.)\n",
670683
"right.xaxis.axis_label = 'g - r'\n",
@@ -793,7 +806,7 @@
793806
" x_range=(-2.0, 3.0), y_range=(-2.0, 3.0),\n",
794807
" **plot_options)\n",
795808
"p.circle(x='gmr', y='rmi', source=source,\n",
796-
" size=3, alpha=0.3,\n",
809+
" size=1, alpha=0.1,\n",
797810
" hover_color='firebrick',\n",
798811
" legend_field=\"truth_type\",\n",
799812
" color=factor_cmap('truth_type', 'Category10_3',\n",

0 commit comments

Comments
 (0)