Skip to content

yt-project/widgyts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

widgyts

Documentation Status codecov status DOI

A fully client-side pan-and-zoom widget, using WebAssembly, for variable mesh datasets from yt. It runs in the browser, so once the data hits your notebook, it's super fast and responsive!

If you'd like to dig into the Rust and WebAssembly portion of the code, you can find it at https://github.com/data-exp-lab/rust-yt-tools/ and in the npm package @data-exp-lab/yt-tools.

Check out our SciPy 2018 talk and the associated slides for more info!

Documentation

Our documentation is hosted at readthedocs. Take a look here.

Installation

To install using pip from the most recent released version:

$ pip install widgyts

To install using pip from this directory:

$ git clone https://github.com/yt-project/widgyts.git
$ cd widgyts
$ pip install .

Development installation

The following assumes you're using conda. If not, you'll need to install nodejs in your environemnt separately.

conda create -n widgyts-dev -c conda-forge nodejs python=3.10 jupyterlab=4
conda activate widgyts-dev

Install the python. This will also build the TS package.

pip install -e .

When developing your extensions, you need to manually enable your extensions with the notebook / lab frontend. For lab, this is done by the command:

jupyter labextension develop --overwrite .
jlpm run build

Note that jupyterlab provides jlpm, a jupyter-flavored version of yarn, provided by jupyterlab.

How to see your changes

Typescript:

If you use JupyterLab to develop then you can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the widget.

# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab

After a change wait for the build to finish and then refresh your browser and the changes should take effect.

Python:

If you make a change to the python code then you will need to restart the notebook kernel to have it take effect.

Using

To use this, you will need to have yt installed. Importing it monkeypatches the Slice and Projection objects, so you are now able to do:

#!python
import yt
import widgyts

ds = yt.load("data/IsolatedGalaxy/galaxy0030/galaxy0030")
s = ds.r[:,:,0.5]
s.display("density")

and for a projection:

#!python
ds = yt.load("data/IsolatedGalaxy/galaxy0030/galaxy0030")
p = ds.r[:].integrate("density", axis="x")
p.display()

There are a number of traits you can set on the resultant objects, as well.