Spaces:
Sleeping
Sleeping
Commit
·
56d7445
0
Parent(s):
commit message
Browse files- .gitattributes +34 -0
- .gitignore +162 -0
- Dockerfile +14 -0
- README.md +40 -0
- examples/01_getting_started.py +42 -0
- examples/06_linked_widgets.py +57 -0
- examples/07_on_click_callback.py +93 -0
- pyproject.toml +5 -0
- requirements.txt +3 -0
- requirements_dev.txt +3 -0
- thumbnails/01_getting_started.png +0 -0
- thumbnails/06_linked_widgets.png +0 -0
- thumbnails/07_on_click_callback.png +0 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Byte-compiled / optimized / DLL files
|
2 |
+
__pycache__/
|
3 |
+
*.py[cod]
|
4 |
+
*$py.class
|
5 |
+
|
6 |
+
# C extensions
|
7 |
+
*.so
|
8 |
+
|
9 |
+
# Distribution / packaging
|
10 |
+
.Python
|
11 |
+
build/
|
12 |
+
develop-eggs/
|
13 |
+
dist/
|
14 |
+
downloads/
|
15 |
+
eggs/
|
16 |
+
.eggs/
|
17 |
+
lib/
|
18 |
+
lib64/
|
19 |
+
parts/
|
20 |
+
sdist/
|
21 |
+
var/
|
22 |
+
wheels/
|
23 |
+
share/python-wheels/
|
24 |
+
*.egg-info/
|
25 |
+
.installed.cfg
|
26 |
+
*.egg
|
27 |
+
MANIFEST
|
28 |
+
|
29 |
+
# PyInstaller
|
30 |
+
# Usually these files are written by a python script from a template
|
31 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
32 |
+
*.manifest
|
33 |
+
*.spec
|
34 |
+
|
35 |
+
# Installer logs
|
36 |
+
pip-log.txt
|
37 |
+
pip-delete-this-directory.txt
|
38 |
+
|
39 |
+
# Unit test / coverage reports
|
40 |
+
htmlcov/
|
41 |
+
.tox/
|
42 |
+
.nox/
|
43 |
+
.coverage
|
44 |
+
.coverage.*
|
45 |
+
.cache
|
46 |
+
nosetests.xml
|
47 |
+
coverage.xml
|
48 |
+
*.cover
|
49 |
+
*.py,cover
|
50 |
+
.hypothesis/
|
51 |
+
.pytest_cache/
|
52 |
+
cover/
|
53 |
+
|
54 |
+
# Translations
|
55 |
+
*.mo
|
56 |
+
*.pot
|
57 |
+
|
58 |
+
# Django stuff:
|
59 |
+
*.log
|
60 |
+
local_settings.py
|
61 |
+
db.sqlite3
|
62 |
+
db.sqlite3-journal
|
63 |
+
|
64 |
+
# Flask stuff:
|
65 |
+
instance/
|
66 |
+
.webassets-cache
|
67 |
+
|
68 |
+
# Scrapy stuff:
|
69 |
+
.scrapy
|
70 |
+
|
71 |
+
# Sphinx documentation
|
72 |
+
docs/_build/
|
73 |
+
|
74 |
+
# PyBuilder
|
75 |
+
.pybuilder/
|
76 |
+
target/
|
77 |
+
|
78 |
+
# Jupyter Notebook
|
79 |
+
.ipynb_checkpoints
|
80 |
+
|
81 |
+
# IPython
|
82 |
+
profile_default/
|
83 |
+
ipython_config.py
|
84 |
+
|
85 |
+
# pyenv
|
86 |
+
# For a library or package, you might want to ignore these files since the code is
|
87 |
+
# intended to run in multiple environments; otherwise, check them in:
|
88 |
+
# .python-version
|
89 |
+
|
90 |
+
# pipenv
|
91 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
92 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
93 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
94 |
+
# install all needed dependencies.
|
95 |
+
#Pipfile.lock
|
96 |
+
|
97 |
+
# poetry
|
98 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
99 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
100 |
+
# commonly ignored for libraries.
|
101 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
102 |
+
#poetry.lock
|
103 |
+
|
104 |
+
# pdm
|
105 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
106 |
+
#pdm.lock
|
107 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
108 |
+
# in version control.
|
109 |
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
110 |
+
.pdm.toml
|
111 |
+
.pdm-python
|
112 |
+
.pdm-build/
|
113 |
+
|
114 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
115 |
+
__pypackages__/
|
116 |
+
|
117 |
+
# Celery stuff
|
118 |
+
celerybeat-schedule
|
119 |
+
celerybeat.pid
|
120 |
+
|
121 |
+
# SageMath parsed files
|
122 |
+
*.sage.py
|
123 |
+
|
124 |
+
# Environments
|
125 |
+
.env
|
126 |
+
.venv
|
127 |
+
env/
|
128 |
+
venv/
|
129 |
+
ENV/
|
130 |
+
env.bak/
|
131 |
+
venv.bak/
|
132 |
+
|
133 |
+
# Spyder project settings
|
134 |
+
.spyderproject
|
135 |
+
.spyproject
|
136 |
+
|
137 |
+
# Rope project settings
|
138 |
+
.ropeproject
|
139 |
+
|
140 |
+
# mkdocs documentation
|
141 |
+
/site
|
142 |
+
|
143 |
+
# mypy
|
144 |
+
.mypy_cache/
|
145 |
+
.dmypy.json
|
146 |
+
dmypy.json
|
147 |
+
|
148 |
+
# Pyre type checker
|
149 |
+
.pyre/
|
150 |
+
|
151 |
+
# pytype static type analyzer
|
152 |
+
.pytype/
|
153 |
+
|
154 |
+
# Cython debug symbols
|
155 |
+
cython_debug/
|
156 |
+
|
157 |
+
# PyCharm
|
158 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
159 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
160 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
161 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
162 |
+
#.idea/
|
Dockerfile
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
|
2 |
+
|
3 |
+
WORKDIR /code
|
4 |
+
|
5 |
+
RUN mkdir /.cache
|
6 |
+
RUN chmod 777 /.cache
|
7 |
+
|
8 |
+
COPY ./requirements.txt /code/requirements.txt
|
9 |
+
RUN uv pip install -r /code/requirements.txt --system
|
10 |
+
|
11 |
+
COPY . .
|
12 |
+
|
13 |
+
ENTRYPOINT []
|
14 |
+
CMD ["panel", "serve", "/code/examples/*.py", "--address", "0.0.0.0", "--port", "7860", "--allow-websocket-origin", "*", "--static-dirs", "thumbnails=./thumbnails"]
|
README.md
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Aladin
|
3 |
+
emoji: 🛸
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: green
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
license: mit
|
9 |
+
---
|
10 |
+
|
11 |
+
This project demonstrates **how to enable interactive sky visualization** in Python data apps by
|
12 |
+
combining [ipyaladin](https://github.com/cds-astro/ipyaladin) and [Panel](https://panel.holoviz.org/index.html).
|
13 |
+
|
14 |
+
The [examples](examples) are resembling the examples at [ipyaladin/examples](https://github.com/cds-astro/ipyaladin/tree/master/examples).
|
15 |
+
|
16 |
+
Created by [awesome-panel](https://awesome-panel.org).
|
17 |
+
|
18 |
+
## Install
|
19 |
+
|
20 |
+
```bash
|
21 |
+
pip install -r requirements_dev.txt
|
22 |
+
```
|
23 |
+
|
24 |
+
## Serve
|
25 |
+
|
26 |
+
```bash
|
27 |
+
panel serve examples/*.py --dev --static-dirs thumbnails=./thumbnails
|
28 |
+
```
|
29 |
+
|
30 |
+
## Ruff
|
31 |
+
|
32 |
+
```bash
|
33 |
+
ruff format
|
34 |
+
ruff check --fix;
|
35 |
+
```
|
36 |
+
|
37 |
+
## Known Issues
|
38 |
+
|
39 |
+
- [CORS](https://github.com/cds-astro/ipyaladin/issues/118)
|
40 |
+
- [jslinking](https://github.com/bokeh/ipywidgets_bokeh/issues/39#issuecomment-2365192366)
|
examples/01_getting_started.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# See also https://github.com/cds-astro/ipyaladin/blob/master/examples/01_Getting_Started.ipynb
|
2 |
+
"""# 🛸 Getting Started
|
3 |
+
|
4 |
+
Displays an interactive sky view of the
|
5 |
+
[Mars Viking MDIM21 survey](https://alasky.u-strasbg.fr/Planets/Mars_Viking_MDIM21/).
|
6 |
+
|
7 |
+
Powered by \
|
8 |
+
[ipyaladin](https://github.com/cds-astro/ipyaladin) and \
|
9 |
+
[Panel](https://panel.holoviz.org/index.html).
|
10 |
+
|
11 |
+
Check out the [**App Gallery**](./)
|
12 |
+
"""
|
13 |
+
|
14 |
+
import panel as pn
|
15 |
+
from ipyaladin import Aladin
|
16 |
+
|
17 |
+
pn.extension("ipywidgets", sizing_mode="stretch_width")
|
18 |
+
|
19 |
+
aladin = Aladin(
|
20 |
+
target="159.2135528 -58.6241989",
|
21 |
+
survey="https://alasky.u-strasbg.fr/Planets/Mars_Viking_MDIM21",
|
22 |
+
fov=10,
|
23 |
+
height=800,
|
24 |
+
)
|
25 |
+
|
26 |
+
panel = pn.panel(aladin, height=800)
|
27 |
+
|
28 |
+
pn.template.FastListTemplate(
|
29 |
+
site="ipyaladin and Panel",
|
30 |
+
site_url="./",
|
31 |
+
title="01 Getting Started",
|
32 |
+
sidebar=[
|
33 |
+
pn.pane.PNG(
|
34 |
+
"https://avatars.githubusercontent.com/u/26145382?s=200&v=4",
|
35 |
+
link_url="https://cds.unistra.fr/",
|
36 |
+
),
|
37 |
+
__doc__,
|
38 |
+
],
|
39 |
+
main=[panel],
|
40 |
+
accent="#296bb5",
|
41 |
+
main_layout=None,
|
42 |
+
).servable()
|
examples/06_linked_widgets.py
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""# 🛸 Linked Widgets
|
2 |
+
|
3 |
+
Displays 3 linked `Aladin` widgets. Try zoming or panning.
|
4 |
+
|
5 |
+
Powered by \
|
6 |
+
[ipyaladin](https://github.com/cds-astro/ipyaladin) and \
|
7 |
+
[Panel](https://panel.holoviz.org/index.html).
|
8 |
+
|
9 |
+
Check out the [**App Gallery**](./)
|
10 |
+
"""
|
11 |
+
|
12 |
+
import panel as pn
|
13 |
+
from ipyaladin import Aladin
|
14 |
+
from ipywidgets import Box, Layout, widgets
|
15 |
+
|
16 |
+
pn.extension("ipywidgets", sizing_mode="stretch_width")
|
17 |
+
|
18 |
+
cosmetic_options = {"show_projection_control": False, "show_fullscreen_control": False}
|
19 |
+
|
20 |
+
a = Aladin(layout=Layout(width="100%"), target="M 81", fov=0.3, **cosmetic_options)
|
21 |
+
b = Aladin(layout=Layout(width="100%"), survey="P/DSS2/red", **cosmetic_options)
|
22 |
+
c = Aladin(layout=Layout(width="100%"), survey="P/2MASS/color", **cosmetic_options)
|
23 |
+
|
24 |
+
# synchronize target between 3 widgets
|
25 |
+
widgets.jslink((a, "_target"), (b, "_target"))
|
26 |
+
widgets.jslink((b, "_target"), (c, "_target"))
|
27 |
+
|
28 |
+
# synchronize FoV (zoom level) between 3 widgets
|
29 |
+
widgets.jslink((a, "_fov"), (b, "_fov"))
|
30 |
+
widgets.jslink((b, "_fov"), (c, "_fov"))
|
31 |
+
|
32 |
+
items = [a, b, c]
|
33 |
+
|
34 |
+
box_layout = Layout(
|
35 |
+
display="flex",
|
36 |
+
flex_flow="column",
|
37 |
+
align_items="stretch",
|
38 |
+
border="solid",
|
39 |
+
width="100%",
|
40 |
+
)
|
41 |
+
box = Box(children=items, layout=box_layout)
|
42 |
+
|
43 |
+
pn.template.FastListTemplate(
|
44 |
+
site="ipyaladin and Panel",
|
45 |
+
site_url="./",
|
46 |
+
title="Linked Widgets",
|
47 |
+
sidebar=[
|
48 |
+
pn.pane.PNG(
|
49 |
+
"https://avatars.githubusercontent.com/u/26145382?s=200&v=4",
|
50 |
+
link_url="https://cds.unistra.fr/",
|
51 |
+
),
|
52 |
+
__doc__,
|
53 |
+
],
|
54 |
+
main=[box],
|
55 |
+
accent="#296bb5",
|
56 |
+
main_layout=None,
|
57 |
+
).servable()
|
examples/07_on_click_callback.py
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""# 🛸 On Click Callback
|
2 |
+
|
3 |
+
Once all cells are executed, click anywhere to get the closest star name. Be patient and the associated photometric points appear after a few seconds.
|
4 |
+
|
5 |
+
Powered by \
|
6 |
+
[ipyaladin](https://github.com/cds-astro/ipyaladin) and \
|
7 |
+
[Panel](https://panel.holoviz.org/index.html).
|
8 |
+
|
9 |
+
Check out the [**App Gallery**](./)
|
10 |
+
"""
|
11 |
+
|
12 |
+
import panel as pn
|
13 |
+
import requests
|
14 |
+
from ipyaladin import Aladin
|
15 |
+
from ipywidgets import Layout
|
16 |
+
|
17 |
+
pn.extension("ipywidgets", sizing_mode="stretch_width")
|
18 |
+
|
19 |
+
LoadingIndicator = "Loading..."
|
20 |
+
|
21 |
+
aladin = Aladin(
|
22 |
+
layout=Layout(width="100%"),
|
23 |
+
height=800,
|
24 |
+
target="M 36",
|
25 |
+
fov=0.3,
|
26 |
+
show_fullscreen_control=False,
|
27 |
+
)
|
28 |
+
info = pn.pane.HTML("<h2>Click the widget</h2>")
|
29 |
+
image = pn.pane.PNG(embed=True, sizing_mode="fixed")
|
30 |
+
box = pn.Column(aladin, info, image)
|
31 |
+
|
32 |
+
|
33 |
+
def process_result(data: dict) -> None:
|
34 |
+
"""Process the result of a click event on the Aladin widget.
|
35 |
+
|
36 |
+
Parameters
|
37 |
+
----------
|
38 |
+
data : dict
|
39 |
+
The data returned by the click event.
|
40 |
+
"""
|
41 |
+
box.loading = True
|
42 |
+
|
43 |
+
info.value = ""
|
44 |
+
ra = data["ra"]
|
45 |
+
dec = data["dec"]
|
46 |
+
query = (
|
47 |
+
f"SELECT TOP 1 main_id, ra, dec, DISTANCE(POINT('ICRS', {ra}, {dec}), "
|
48 |
+
f"POINT('ICRS', ra, dec)) as d FROM basic "
|
49 |
+
f"WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', {ra}, {dec}, {aladin.fov.deg / 10}))=1 "
|
50 |
+
"ORDER BY d ASC"
|
51 |
+
)
|
52 |
+
|
53 |
+
r = requests.get(
|
54 |
+
"http://simbad.u-strasbg.fr/simbad/sim-tap/sync",
|
55 |
+
params={
|
56 |
+
"query": query,
|
57 |
+
"request": "doQuery",
|
58 |
+
"lang": "adql",
|
59 |
+
"format": "json",
|
60 |
+
"phase": "run",
|
61 |
+
},
|
62 |
+
)
|
63 |
+
obj_name = ""
|
64 |
+
obj_coo = None
|
65 |
+
obj_data = r.json()["data"]
|
66 |
+
if len(obj_data) == 0:
|
67 |
+
return
|
68 |
+
|
69 |
+
obj_name = obj_data[0][0]
|
70 |
+
obj_coo = [obj_data[0][1], obj_data[0][2]]
|
71 |
+
|
72 |
+
info.object = f"<h2>{obj_name}</h2><br><br>"
|
73 |
+
image.object = f"https://cdsportal.u-strasbg.fr/cgi-bin/PhotVizPreview/plot?ra={obj_coo[0]}&dec={obj_coo[1]}&radius_arcsec=5&w=200&h=150&point_size=4"
|
74 |
+
box.loading = False
|
75 |
+
|
76 |
+
|
77 |
+
aladin.set_listener("click", process_result)
|
78 |
+
|
79 |
+
pn.template.FastListTemplate(
|
80 |
+
site="ipyaladin and Panel",
|
81 |
+
site_url="./",
|
82 |
+
title="On Click Callback",
|
83 |
+
sidebar=[
|
84 |
+
pn.pane.PNG(
|
85 |
+
"https://avatars.githubusercontent.com/u/26145382?s=200&v=4",
|
86 |
+
link_url="https://cds.unistra.fr/",
|
87 |
+
),
|
88 |
+
__doc__,
|
89 |
+
],
|
90 |
+
main=[box],
|
91 |
+
accent="#296bb5",
|
92 |
+
main_layout=None,
|
93 |
+
).servable()
|
pyproject.toml
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.ruff]
|
2 |
+
line-length = 120
|
3 |
+
|
4 |
+
[tool.ruff.lint]
|
5 |
+
extend-select = ["I"]
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
ipyaladin
|
2 |
+
ipywidgets_bokeh
|
3 |
+
panel
|
requirements_dev.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
-r requirements.txt
|
2 |
+
ruff
|
3 |
+
watchfiles
|
thumbnails/01_getting_started.png
ADDED
![]() |
thumbnails/06_linked_widgets.png
ADDED
![]() |
thumbnails/07_on_click_callback.png
ADDED
![]() |