Skip to content

Commit

Permalink
Firefly-1483: Merge PR #58 from FIREFLY-1483-triview
Browse files Browse the repository at this point in the history
Firefly-1483: improve support for triview
  • Loading branch information
robyww authored May 23, 2024
2 parents 4428b5c + 0b9ec49 commit 0305adb
Show file tree
Hide file tree
Showing 17 changed files with 1,033 additions and 652 deletions.
4 changes: 2 additions & 2 deletions examples/basic-demo-tableload.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -201,7 +201,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
90 changes: 73 additions & 17 deletions examples/basic_3color.ipynb → examples/demo-3color.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,29 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from firefly_client import FireflyClient\n",
"\n",
"url='https://irsa.ipac.caltech.edu/irsaviewer'\n",
"# url=http://127.0.0.1:8080/firefly # if you have firefly server running locally\n",
"\n",
"fc = FireflyClient.make_client(url)"
"using_lab = False\n",
"#url='https://irsa.ipac.caltech.edu/irsaviewer'\n",
"url = 'http://127.0.0.1:8080/firefly'\n",
"#FireflyClient._debug= True"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -64,39 +72,87 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'success': True,\n",
" 'rv_lst': ['88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.150000',\n",
" '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,1.000000',\n",
" '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.400000']}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Set stretch using hue-preserving algorithm with scaling coefficients .15 for RED, 1.0 for GREEN, and .4 for BLUE.\n",
"fc.set_stretch_hprgb(plot_id='wise_m101', asinh_q_value=4.2, scaling_k=[.15,1,.4])"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'success': True,\n",
" 'rv_string': '88,1.000000,88,99.000000,NaN,2.000000,50,25,600,120,0,NaN,1.000000'}"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Set per-band stretch\n",
"fc.set_stretch(plot_id='wise_m101', stype='ztype', algorithm='asinh', band='ALL')"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'success': True}"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Set contrast and bias for each band\n",
"fc.set_rgb_colors(plot_id='wise_m101', bias=[0.4, 0.6, 0.5], contrast=[1.5, 1, 2]) "
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"{'success': True}"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Set to use red and blue band only, with default bias and contrast\n",
"fc.set_rgb_colors(plot_id='wise_m101', use_green=False) "
Expand All @@ -112,7 +168,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -126,7 +182,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
173 changes: 173 additions & 0 deletions examples/demo-HiPS.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook demonstrates basic usage of the firefly_client API.\n",
"\n",
"Note that it may be necessary to wait for some cells (like those displaying an image) to complete before executing later cells."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Imports for firefly_client"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from firefly_client import FireflyClient\n",
"using_lab = False\n",
"url = 'http://127.0.0.1:8080/firefly'\n",
"#FireflyClient._debug= True"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Settings for a WISE image for M81 at a selected band in HiPS format:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"target='148.892;69.0654;EQ_J2000'\n",
"fov_deg=0.5\n",
"size=0.2\n",
"\n",
"image_basic_req = {\n",
" 'Service': 'WISE',\n",
" 'Title': 'Wise',\n",
" 'SurveyKey': '3a',\n",
" 'SurveyKeyBand': '2'\n",
"}\n",
"\n",
"hips_basic_req = {\n",
" 'title': 'A HiPS - 0.2',\n",
" 'hipsRootUrl': 'http://alasky.u-strasbg.fr/AllWISE/RGB-W4-W2-W1'\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Show HiPS "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A HiPS is displayed based on HiPS url"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"viewer_id = 'hipsDIV1'\n",
"r = fc.add_cell(0, 0, 4, 2, 'images', viewer_id)\n",
"if r['success']:\n",
" hips_url = 'http://alasky.u-strasbg.fr/DSS/DSSColor';\n",
" status = fc.show_hips(viewer_id=viewer_id, plot_id='aHipsID1-1', hips_root_url = hips_url, \n",
" Title='HiPS-DSS', WorldPt=target)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Change color attributes in this image:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"fc.set_color('aHipsID1-1', colormap_id=6, bias=0.6, contrast=1.5)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Two more HiPS in the same viewer"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"hips_url = 'http://alasky.u-strasbg.fr/DSS/DSS2Merged';\n",
"status = fc.show_hips(plot_id='aHipsID1-2', hips_root_url = hips_url, \n",
" Title='HiPS-DSS2', WorldPt=target)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hips_url = 'http://alasky.u-strasbg.fr/AllWISE/RGB-W4-W2-W1'\n",
"status = fc.show_hips(plot_id='aHipsID2', hips_root_url=hips_url)"
]
}
],
"metadata": {
"anaconda-cloud": {},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 0305adb

Please sign in to comment.