A tool to visualize and play with CMB maps. psplay is a jupyter extension to allow
interactive visualization of CMB maps through Leaflet library. psplay also
provides a set of tools based on pspy to compute and to show
CMB power spectra. You can have a better idea of what psplay can do by watching this short
video.
All the specific javascript library developed for psplay is done by Sigurd Naess. The build process and javascript architecture is highly inspired by
ipyleaflet project.
To install, you will need to have or to install numpy. Then, run
$ pip install psplay [--user]psplay runs within a Jupyter notebook and we recommend to use JupyterLab to fully enjoy psplay
To enable the extension within Jupyter, you will need to install several JupyterLab extensions
especially the Python plotly library and the Jupyter widgets. You will also need nodejs library and its package manager npm. For JupyterLab > 2.0.0, you can do
$ jupyter labextension install plotlywidget jupyterlab-plotly
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager @jupyter-widgets/jupyterlab-sidecarFinally, you need to install the jupyter-leaflet-car extension
$ jupyter labextension install jupyter-leaflet jupyter-leaflet-carGiven the number of requirements, you can use a docker image already made with the needed
libraries and everything compiled and installed. You should first install docker for your operating system.
Then, you can run the simonsobs/psplay image by doing
$ docker run --rm -p 8888:8888 simonsobs/psplay:latestAfter pulling the docker image, a JupyterLab instance should start. If your web browser does not
automatically load the web page, you can copy-paste the JupyterLab URL.
You can bind a local directory to make it available within the docker container with the -v
flag (see https://docs.docker.com/storage/bind-mounts for more details).
For a development installation (requires npm)
$ git clone https://github.com/xgarrido/psplay.git
$ cd psplay
$ pip install -e .If you are using the classic Jupyter Notebook you need to install the nbextension:
$ jupyter nbextension install --py --symlink --sys-prefix psplay
$ jupyter nbextension enable --py --sys-prefix psplayIf you are using JupyterLab, you need to install the labextension:
$ jupyter labextension install @jupyter-widgets/jupyterlab-manager jsNote for developers:
- the
-epip option allows one to modify the Python code in-place. Restart the kernel in order to see the changes. - the
--symlinkargument on Linux or OS X allows one to modify the JavaScript code in-place. This feature is not available with Windows.
For automatically building the JavaScript code every time there is a change, run the following
command from the psplay/js/ directory:
$ npm run watchIf you are on JupyterLab you also need to run the following in a separate terminal:
$ jupyter lab --watchEvery time a JavaScript build has terminated you need to refresh the Notebook page in order to load the JavaScript code again.
- Xavier Garrido
- Thibaut Louis
- Sigurd Naess
The code is part of PSpipe the Simons Observatory power spectrum pipeline.
