Skip to content

Commit abd0929

Browse files
committed
firefly-1483: reponse to feedback
1 parent bf9764b commit abd0929

15 files changed

+909
-1591
lines changed

examples/basic_3color.ipynb renamed to examples/demo-3color.ipynb

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,29 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 1,
66
"metadata": {},
77
"outputs": [],
88
"source": [
99
"from firefly_client import FireflyClient\n",
10-
"\n",
11-
"url='https://irsa.ipac.caltech.edu/irsaviewer'\n",
12-
"# url=http://127.0.0.1:8080/firefly # if you have firefly server running locally\n",
13-
"\n",
14-
"fc = FireflyClient.make_client(url)"
10+
"using_lab = False\n",
11+
"#url='https://irsa.ipac.caltech.edu/irsaviewer'\n",
12+
"url = 'http://127.0.0.1:8080/firefly'\n",
13+
"#FireflyClient._debug= True"
1514
]
1615
},
1716
{
1817
"cell_type": "code",
19-
"execution_count": null,
18+
"execution_count": 2,
19+
"metadata": {},
20+
"outputs": [],
21+
"source": [
22+
"fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)"
23+
]
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": 3,
2028
"metadata": {},
2129
"outputs": [],
2230
"source": [
@@ -64,39 +72,87 @@
6472
},
6573
{
6674
"cell_type": "code",
67-
"execution_count": null,
75+
"execution_count": 3,
6876
"metadata": {},
69-
"outputs": [],
77+
"outputs": [
78+
{
79+
"data": {
80+
"text/plain": [
81+
"{'success': True,\n",
82+
" 'rv_lst': ['88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.150000',\n",
83+
" '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,1.000000',\n",
84+
" '88,1.000000,88,99.000000,4.200000,2.000000,50,25,600,120,1,NaN,0.400000']}"
85+
]
86+
},
87+
"execution_count": 3,
88+
"metadata": {},
89+
"output_type": "execute_result"
90+
}
91+
],
7092
"source": [
7193
"# Set stretch using hue-preserving algorithm with scaling coefficients .15 for RED, 1.0 for GREEN, and .4 for BLUE.\n",
7294
"fc.set_stretch_hprgb(plot_id='wise_m101', asinh_q_value=4.2, scaling_k=[.15,1,.4])"
7395
]
7496
},
7597
{
7698
"cell_type": "code",
77-
"execution_count": null,
99+
"execution_count": 4,
78100
"metadata": {},
79-
"outputs": [],
101+
"outputs": [
102+
{
103+
"data": {
104+
"text/plain": [
105+
"{'success': True,\n",
106+
" 'rv_string': '88,1.000000,88,99.000000,NaN,2.000000,50,25,600,120,0,NaN,1.000000'}"
107+
]
108+
},
109+
"execution_count": 4,
110+
"metadata": {},
111+
"output_type": "execute_result"
112+
}
113+
],
80114
"source": [
81115
"# Set per-band stretch\n",
82116
"fc.set_stretch(plot_id='wise_m101', stype='ztype', algorithm='asinh', band='ALL')"
83117
]
84118
},
85119
{
86120
"cell_type": "code",
87-
"execution_count": null,
121+
"execution_count": 5,
88122
"metadata": {},
89-
"outputs": [],
123+
"outputs": [
124+
{
125+
"data": {
126+
"text/plain": [
127+
"{'success': True}"
128+
]
129+
},
130+
"execution_count": 5,
131+
"metadata": {},
132+
"output_type": "execute_result"
133+
}
134+
],
90135
"source": [
91136
"# Set contrast and bias for each band\n",
92137
"fc.set_rgb_colors(plot_id='wise_m101', bias=[0.4, 0.6, 0.5], contrast=[1.5, 1, 2]) "
93138
]
94139
},
95140
{
96141
"cell_type": "code",
97-
"execution_count": null,
142+
"execution_count": 6,
98143
"metadata": {},
99-
"outputs": [],
144+
"outputs": [
145+
{
146+
"data": {
147+
"text/plain": [
148+
"{'success': True}"
149+
]
150+
},
151+
"execution_count": 6,
152+
"metadata": {},
153+
"output_type": "execute_result"
154+
}
155+
],
100156
"source": [
101157
"# Set to use red and blue band only, with default bias and contrast\n",
102158
"fc.set_rgb_colors(plot_id='wise_m101', use_green=False) "

examples/demo-HiPS.ipynb

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"This notebook demonstrates basic usage of the firefly_client API.\n",
8+
"\n",
9+
"Note that it may be necessary to wait for some cells (like those displaying an image) to complete before executing later cells."
10+
]
11+
},
12+
{
13+
"cell_type": "markdown",
14+
"metadata": {},
15+
"source": [
16+
"## Setup"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"Imports for firefly_client"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": null,
29+
"metadata": {},
30+
"outputs": [],
31+
"source": [
32+
"from firefly_client import FireflyClient\n",
33+
"using_lab = False\n",
34+
"url = 'http://127.0.0.1:8080/firefly'\n",
35+
"#FireflyClient._debug= True"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {},
41+
"source": [
42+
"Settings for a WISE image for M81 at a selected band in HiPS format:"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": null,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)\n"
52+
]
53+
},
54+
{
55+
"cell_type": "code",
56+
"execution_count": null,
57+
"metadata": {},
58+
"outputs": [],
59+
"source": [
60+
"target='148.892;69.0654;EQ_J2000'\n",
61+
"fov_deg=0.5\n",
62+
"size=0.2\n",
63+
"\n",
64+
"image_basic_req = {\n",
65+
" 'Service': 'WISE',\n",
66+
" 'Title': 'Wise',\n",
67+
" 'SurveyKey': '3a',\n",
68+
" 'SurveyKeyBand': '2'\n",
69+
"}\n",
70+
"\n",
71+
"hips_basic_req = {\n",
72+
" 'title': 'A HiPS - 0.2',\n",
73+
" 'hipsRootUrl': 'http://alasky.u-strasbg.fr/AllWISE/RGB-W4-W2-W1'\n",
74+
"}"
75+
]
76+
},
77+
{
78+
"cell_type": "markdown",
79+
"metadata": {},
80+
"source": [
81+
"In this example we use irsaviewer as firefly server (slate.html is the default template used)"
82+
]
83+
},
84+
{
85+
"cell_type": "markdown",
86+
"metadata": {},
87+
"source": [
88+
"## Show HiPS "
89+
]
90+
},
91+
{
92+
"cell_type": "markdown",
93+
"metadata": {},
94+
"source": [
95+
"A HiPS is displayed based on HiPS url"
96+
]
97+
},
98+
{
99+
"cell_type": "code",
100+
"execution_count": null,
101+
"metadata": {},
102+
"outputs": [],
103+
"source": [
104+
"viewer_id = 'hipsDIV1'\n",
105+
"r = fc.add_cell(0, 0, 4, 2, 'images', viewer_id)\n",
106+
"if r['success']:\n",
107+
" hips_url = 'http://alasky.u-strasbg.fr/DSS/DSSColor';\n",
108+
" status = fc.show_hips(viewer_id=viewer_id, plot_id='aHipsID1-1', hips_root_url = hips_url, \n",
109+
" Title='HiPS-DSS', WorldPt=target)"
110+
]
111+
},
112+
{
113+
"cell_type": "markdown",
114+
"metadata": {},
115+
"source": [
116+
"Change color attributes in this image:"
117+
]
118+
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": null,
122+
"metadata": {},
123+
"outputs": [],
124+
"source": [
125+
"fc.set_color('aHipsID1-1', colormap_id=6, bias=0.6, contrast=1.5)"
126+
]
127+
},
128+
{
129+
"cell_type": "markdown",
130+
"metadata": {},
131+
"source": [
132+
"Two more HiPS in the same viewer"
133+
]
134+
},
135+
{
136+
"cell_type": "code",
137+
"execution_count": null,
138+
"metadata": {},
139+
"outputs": [],
140+
"source": [
141+
"\n",
142+
"hips_url = 'http://alasky.u-strasbg.fr/DSS/DSS2Merged';\n",
143+
"status = fc.show_hips(plot_id='aHipsID1-2', hips_root_url = hips_url, \n",
144+
" Title='HiPS-DSS2', WorldPt=target)"
145+
]
146+
},
147+
{
148+
"cell_type": "code",
149+
"execution_count": null,
150+
"metadata": {},
151+
"outputs": [],
152+
"source": [
153+
"hips_url = 'http://alasky.u-strasbg.fr/AllWISE/RGB-W4-W2-W1'\n",
154+
"status = fc.show_hips(plot_id='aHipsID2', hips_root_url=hips_url)"
155+
]
156+
}
157+
],
158+
"metadata": {
159+
"anaconda-cloud": {},
160+
"kernelspec": {
161+
"display_name": "Python 3 (ipykernel)",
162+
"language": "python",
163+
"name": "python3"
164+
},
165+
"language_info": {
166+
"codemirror_mode": {
167+
"name": "ipython",
168+
"version": 3
169+
},
170+
"file_extension": ".py",
171+
"mimetype": "text/x-python",
172+
"name": "python",
173+
"nbconvert_exporter": "python",
174+
"pygments_lexer": "ipython3",
175+
"version": "3.10.12"
176+
}
177+
},
178+
"nbformat": 4,
179+
"nbformat_minor": 4
180+
}

examples/jl-lab-extension-demo-explicit2.ipynb renamed to examples/demo-advanced-all.ipynb

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
"## Setup"
1818
]
1919
},
20+
{
21+
"cell_type": "code",
22+
"execution_count": null,
23+
"metadata": {},
24+
"outputs": [],
25+
"source": [
26+
"from firefly_client import FireflyClient\n",
27+
"import astropy.utils.data\n",
28+
"using_lab = True\n",
29+
"url = 'http://127.0.0.1:8080/firefly'\n",
30+
"#FireflyClient._debug= True"
31+
]
32+
},
2033
{
2134
"cell_type": "markdown",
2235
"metadata": {},
@@ -37,12 +50,8 @@
3750
"metadata": {},
3851
"outputs": [],
3952
"source": [
40-
"from __future__ import print_function, division, absolute_import\n",
41-
"from firefly_client import FireflyClient\n",
42-
"import astropy.utils.data\n",
43-
"#FireflyClient._debug= True\n",
44-
"fc = FireflyClient.make_lab_client()\n",
45-
"fc.change_triview_layout( FireflyClient.BIVIEW_T_ICC)"
53+
"fc = FireflyClient.make_lab_client() if using_lab else FireflyClient.make_client(url)\n",
54+
"fc.change_triview_layout( FireflyClient.BIVIEW_T_IChCov)"
4655
]
4756
},
4857
{
@@ -314,7 +323,7 @@
314323
"metadata": {},
315324
"outputs": [],
316325
"source": [
317-
"fc.change_triview_layout( FireflyClient.BIVIEW_ICC_T)"
326+
"fc.change_triview_layout( FireflyClient.BIVIEW_IChCov_T)"
318327
]
319328
},
320329
{

0 commit comments

Comments
 (0)