Skip to content

Commit

Permalink
test jupyterlite
Browse files Browse the repository at this point in the history
  • Loading branch information
zonca committed Jul 24, 2024
1 parent 90637d3 commit 9f5ea54
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
5 changes: 5 additions & 0 deletions jupyterlite/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
jupyter lite build --config=jupyter_lite_config.json --contents visualize_map.ipynb

serve:
jupyter lite serve --config=jupyter_lite_config.json --contents visualize_map.ipynb
7 changes: 7 additions & 0 deletions jupyterlite/jupyter_lite_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"PipliteAddon": {
"piplite_urls": [
"https://healpy.github.io/pyhealpy/dist/healpy-0.1.0-py3-none-any.whl"
]
}
}
103 changes: 103 additions & 0 deletions jupyterlite/visualize_map.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{
"metadata": {
"kernelspec": {
"name": "python",
"display_name": "Python (Pyodide)",
"language": "python"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8"
}
},
"nbformat_minor": 4,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"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",
"metadata": {}
},
{
"cell_type": "code",
"source": "%pip install matplotlib https://healpy.github.io/pyhealpy/dist/healpy-0.1.0-py3-none-any.whl",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "import healpy as hp",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "# Map loaded in the environment",
"metadata": {}
},
{
"cell_type": "code",
"source": "%ls",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "from glob import glob\nmap_filename = glob(\"*.fits\")[0]",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "print(map_filename)",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"source": "m = hp.read_map(map_filename)",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "## Mollview projection\n\n",
"metadata": {}
},
{
"cell_type": "code",
"source": "hp.projview(m, coord=[\"G\"], projection_type=\"mollweide\");",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
}
]
}

0 comments on commit 9f5ea54

Please sign in to comment.