Skip to content

Commit 9f5ea54

Browse files
committed
test jupyterlite
1 parent 90637d3 commit 9f5ea54

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

jupyterlite/Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build:
2+
jupyter lite build --config=jupyter_lite_config.json --contents visualize_map.ipynb
3+
4+
serve:
5+
jupyter lite serve --config=jupyter_lite_config.json --contents visualize_map.ipynb

jupyterlite/jupyter_lite_config.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"PipliteAddon": {
3+
"piplite_urls": [
4+
"https://healpy.github.io/pyhealpy/dist/healpy-0.1.0-py3-none-any.whl"
5+
]
6+
}
7+
}

jupyterlite/visualize_map.ipynb

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"metadata": {
3+
"kernelspec": {
4+
"name": "python",
5+
"display_name": "Python (Pyodide)",
6+
"language": "python"
7+
},
8+
"language_info": {
9+
"codemirror_mode": {
10+
"name": "python",
11+
"version": 3
12+
},
13+
"file_extension": ".py",
14+
"mimetype": "text/x-python",
15+
"name": "python",
16+
"nbconvert_exporter": "python",
17+
"pygments_lexer": "ipython3",
18+
"version": "3.8"
19+
}
20+
},
21+
"nbformat_minor": 4,
22+
"nbformat": 4,
23+
"cells": [
24+
{
25+
"cell_type": "markdown",
26+
"source": "# Visualize data in the browser with JupyterLite\n\n## Temporary fix to install healpy\n\nWill should be able to bundle this with JupyterLite",
27+
"metadata": {}
28+
},
29+
{
30+
"cell_type": "code",
31+
"source": "%pip install matplotlib https://healpy.github.io/pyhealpy/dist/healpy-0.1.0-py3-none-any.whl",
32+
"metadata": {
33+
"trusted": true
34+
},
35+
"outputs": [],
36+
"execution_count": null
37+
},
38+
{
39+
"cell_type": "code",
40+
"source": "import healpy as hp",
41+
"metadata": {
42+
"trusted": true
43+
},
44+
"outputs": [],
45+
"execution_count": null
46+
},
47+
{
48+
"cell_type": "markdown",
49+
"source": "# Map loaded in the environment",
50+
"metadata": {}
51+
},
52+
{
53+
"cell_type": "code",
54+
"source": "%ls",
55+
"metadata": {
56+
"trusted": true
57+
},
58+
"outputs": [],
59+
"execution_count": null
60+
},
61+
{
62+
"cell_type": "code",
63+
"source": "from glob import glob\nmap_filename = glob(\"*.fits\")[0]",
64+
"metadata": {
65+
"trusted": true
66+
},
67+
"outputs": [],
68+
"execution_count": null
69+
},
70+
{
71+
"cell_type": "code",
72+
"source": "print(map_filename)",
73+
"metadata": {
74+
"trusted": true
75+
},
76+
"outputs": [],
77+
"execution_count": null
78+
},
79+
{
80+
"cell_type": "code",
81+
"source": "m = hp.read_map(map_filename)",
82+
"metadata": {
83+
"trusted": true
84+
},
85+
"outputs": [],
86+
"execution_count": null
87+
},
88+
{
89+
"cell_type": "markdown",
90+
"source": "## Mollview projection\n\n",
91+
"metadata": {}
92+
},
93+
{
94+
"cell_type": "code",
95+
"source": "hp.projview(m, coord=[\"G\"], projection_type=\"mollweide\");",
96+
"metadata": {
97+
"trusted": true
98+
},
99+
"outputs": [],
100+
"execution_count": null
101+
}
102+
]
103+
}

0 commit comments

Comments
 (0)