Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweeks on the examples #44

Merged
merged 10 commits into from
Jan 6, 2023
Merged
147 changes: 147 additions & 0 deletions examples/10_Advanced-GUI.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Advanced GUI\n",
"\n",
"Demonstration of the GUIs that can be produced by mixing ipyaladin with other widgets."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ipyaladin import Aladin\n",
"import ipywidgets as widgets"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"aladin = Aladin(target=\"orion\", fov=2)\n",
"\n",
"survey_selector = widgets.ToggleButtons(\n",
" options=[\"P/DSS2/color\", \"P/2MASS/color\", \"P/DSS2/red\"],\n",
" description=\"Image:\",\n",
" disabled=False,\n",
" tooltips=[\"DSS2 color\", \"2MASS color\", \"DSS2 red\"],\n",
")\n",
"\n",
"\n",
"def on_survey_value_change(change):\n",
" aladin.survey = change[\"new\"]\n",
"\n",
"\n",
"survey_selector.observe(on_survey_value_change, names=\"value\")\n",
"\n",
"\n",
"survey_overlay_selector = widgets.ToggleButtons(\n",
" options=[\n",
" \"P/DSS2/color\",\n",
" \"P/2MASS/color\",\n",
" \"P/DSS2/red\",\n",
" \"P/XMM/PN/color\",\n",
" \"P/GLIMPSE360\",\n",
" ],\n",
" description=\"Overlay:\",\n",
" disabled=False,\n",
" tooltips=[\n",
" \"DSS2 color\",\n",
" \"2MASS color\",\n",
" \"DSS2 red\",\n",
" \"P/XMM/PN/color\",\n",
" \"P/GLIMPSE360\",\n",
" ],\n",
")\n",
"\n",
"\n",
"def on_survey_overlay_value_change(change):\n",
" aladin.overlay_survey = change[\"new\"]\n",
" aladin.overlay_survey_opacity = aladin.overlay_survey_opacity + 0.00000001\n",
"\n",
"\n",
"survey_overlay_selector.observe(on_survey_overlay_value_change, names=\"value\")\n",
"\n",
"opacity_slider = widgets.FloatSlider(\n",
" value=0.0,\n",
" min=0.0,\n",
" max=1.0,\n",
" step=0.01,\n",
" description=\"Opacity:\",\n",
" disabled=False,\n",
" continuous_update=True,\n",
" orientation=\"horizontal\",\n",
" readout=False,\n",
" readout_format=\".1f\",\n",
")\n",
"\n",
"\n",
"def on_surveyoverlay_opacity_value_change(change):\n",
" aladin.overlay_survey_opacity = change[\"new\"]\n",
"\n",
"\n",
"opacity_slider.observe(on_surveyoverlay_opacity_value_change, names=\"value\")\n",
"\n",
"\n",
"zoom_slider = widgets.FloatSlider(\n",
" value=180 / aladin.fov,\n",
" min=1,\n",
" max=400,\n",
" step=1,\n",
" description=\"Zoom:\",\n",
" disabled=False,\n",
" continuous_update=True,\n",
" orientation=\"horizontal\",\n",
" readout=False,\n",
" readout_format=\".1f\",\n",
")\n",
"\n",
"\n",
"def on_zoom_slider_value_change(change):\n",
" aladin.fov = 180 / change[\"new\"]\n",
"\n",
"\n",
"zoom_slider.observe(on_zoom_slider_value_change, names=\"value\")\n",
"\n",
"\n",
"widgets.VBox(\n",
" [aladin, survey_selector, survey_overlay_selector, opacity_slider, zoom_slider]\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12 (main, Apr 5 2022, 06:56:58) \n[GCC 7.5.0]"
},
"vscode": {
"interpreter": {
"hash": "85bb43f988bdbdc027a50b6d744a62eda8a76617af1f4f9b115d38242716dbac"
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
35 changes: 23 additions & 12 deletions examples/1_Getting_Started.ipynb
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"outputs": [],
"source": [
"import ipyaladin as ipyal"
"# Simple Ipyaladin view\n",
"\n",
"Displays an interactive sky view of the [DECam Plane Survey](http://decaps.skymaps.info/)."
]
},
{
Expand All @@ -15,24 +16,29 @@
"metadata": {},
"outputs": [],
"source": [
"aladin= ipyal.Aladin(survey=\"http://alasky.cds.unistra.fr/DECaPS/DR1/color/\", show_coo_grid=True, target='galactic center', coo_frame=\"galactic\", fov=40)\n",
"aladin"
"from ipyaladin import Aladin"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
"aladin = Aladin(\n",
" survey=\"http://alasky.cds.unistra.fr/DECaPS/DR1/color/\",\n",
" show_coo_grid=True,\n",
" target=\"galactic center\",\n",
" coo_frame=\"galactic\",\n",
" fov=40,\n",
")\n",
"aladin"
]
}
],
"metadata": {
"interpreter": {
"hash": "45dd698bee34ebaf1826d177cff36cc78249d9268b9520f847bda1c0e5105f7f"
},
"kernelspec": {
"display_name": "Python 3.9.15 ('myenv3')",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -46,7 +52,12 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.15"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
"hash": "85bb43f988bdbdc027a50b6d744a62eda8a76617af1f4f9b115d38242716dbac"
}
}
},
"nbformat": 4,
Expand Down
112 changes: 65 additions & 47 deletions examples/2_Base_Commands.ipynb
Original file line number Diff line number Diff line change
@@ -1,101 +1,114 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Aladin commands"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from ipyaladin import Aladin"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0.2.0'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import ipyaladin as ipyal\n",
"ipyal.__version__"
"A list of all available commands can be displayed as such."
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d74adf481fe14310b1f719dbac3bcde0",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Aladin(fov=20.0, options=['allow_full_zoomout', 'coo_frame', 'fov', 'full_screen', 'log', 'overlay_survey', 'o…"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"aladin= ipyal.Aladin(fov=20, reticle_size= 64, reticle_color= '#ff89ff')\n",
"print(dir(Aladin))"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"A few of them are illustrated in the next cells. Let's first, create the widget with a few initial parameters:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"aladin = Aladin(fov=20, reticle_size=64, reticle_color=\"#ff89ff\")\n",
"aladin"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"They can also be modified in the next cells with an interactive effect on the generated view."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": null,
"metadata": {
"collapsed": true
"tags": []
},
"outputs": [],
"source": [
"aladin.target= 'sgr a*'"
"aladin.target = \"sgr a*\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"tags": []
},
"outputs": [],
"source": [
"aladin.fov= 2"
"aladin.fov = 2"
]
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": null,
"metadata": {
"collapsed": true
"tags": []
},
"outputs": [],
"source": [
"aladin.overlay_survey= 'P/allWISE/color'\n",
"aladin.overlay_survey = \"P/allWISE/color\"\n",
"aladin.overlay_survey_opacity = 0.5"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"tags": []
},
"outputs": [],
"source": [
"aladin.coo_frame= 'galactic'"
"aladin.coo_frame = \"galactic\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -109,9 +122,14 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.8"
"version": "3.8.10"
},
"vscode": {
"interpreter": {
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Loading