topsy - An astrophysics simulation visualization package based on OpenGL, using pynbody for reading data
Project description
topsy
This package visualises simulations, and is an add-on to the pynbody analysis package. Its name nods to the TIPSY project.
At the moment, it's a bit of a toy project, but it already works quite well with zoom (or low resolution) simulations. The future development path will depend on the level of interest from the community.
Installing
You will need python 3.8 or later. You can then install topsy
using pip
as usual:
pip install topsy
This will install topsy and its dependencies (including pynbody
itself) into
your current python environment. (If it fails, check that you have python 3.8
or later, and pip
is itself up-to-date using pip install -U pip
.)
As usual, you can also install direct from github, e.g.
pip install git+https://github.com/pynbody/topsy
Or clone the repository and install for development using
pip install -e .
from inside the cloned repository.
If you want to play with topsy
without disturbing your current installation,
I recommend using venv
:
# create a toy environment
python -m venv visualiser-env
# activate the new environment
source visualiser-env/bin/activate
# install
pip install topsy
... other commands ...
# get your old environment back:
deactivate
For more information about venv, see its tutorial page.
Trying it out
The package provides one simple command called topsy
, to be
called straight from your shell. Pass topsy
the path to the
simulation that you wish to visualise.
You can (and probably should) also
tell it what to center on using the -c
flag, to which valid arguments are:
-c none
(just loads the file without changing the centering)-c halo-1
(uses the shrink sphere center of halo 1; or you can change 1 to any other number)-c zoom
(uses the shrink sphere center on the highest resolution particles, without loading a halo catalogue)-c all
(uses the shrink sphere center on all particles in the file)
By default, it will show you dark matter particles. To change this pass -p gas
to show gas particles or -p star
for stars.
By default, it uses matplotlib's twilight_shifted
colormap. To change this pass, for example, -m viridis
, or the name
of any other matplotlib colormap.
Controls in the main window
If everything works, a window will pop up with a beautiful rendering of your simulation. Make sure the window is in focus (for some reason on MacOS I sometimes have to switch to another application then back to python to get this to work). Then you can use the following controls:
- To spin around the centre, drag the mouse.
- To zoom in and out, use the mouse scroll wheel.
- To rescale the colours to an appropriate range for the current view, press
r
(ange) - To return the view to the original orientation and zoom, press
h
(ome) - To save a snapshot of the current image as a pdf press
s
(ave)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file topsy-0.1.tar.gz
.
File metadata
- Download URL: topsy-0.1.tar.gz
- Upload date:
- Size: 12.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee017b334c07e8699cfbe9a3feeadc84e6253c3846a5cddf7ac6805f47d00d17 |
|
MD5 | 9fcd926fcd7ec2c43cac92aadf49077f |
|
BLAKE2b-256 | b7d93cf792f989346fc7157f06e21534664572deb1118368748d357ea6a153c6 |
File details
Details for the file topsy-0.1-py3-none-any.whl
.
File metadata
- Download URL: topsy-0.1-py3-none-any.whl
- Upload date:
- Size: 15.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cf71a85f905f7602fc34b33debe8ccc3c72ca0a86d4c70836b53c10774ffe48 |
|
MD5 | 6def8a55cfc4b75d4790dbe3573fc146 |
|
BLAKE2b-256 | 4d055d9f12b34909cded46b45e3b04fee148339689ea49b0239d1e2ae3afeda2 |