Skip to main content

VisPy scene previewer for Sionna

Project description

sionna-vispy

Latest Release Python version

A VisPy backend to preview Sionna scenes that works both inside and outside Jupyter Notebook.

Example VisPy canvas

This library consists of two parts:

  1. a VisPy-based Previewer to replace sionna.rt.previewer;
  2. and a patch() context manager that dynamically replaces the old pythreejs previewer with the new VisPy previewer.

Installation

For the best out-of-the-box experience, we recommend installing via Pip with recommended extras:

pip install sionna-vispy[recommended]

This will install this package, as well as PySide6 and jupyter-rfb, so that scene.preview(...) works inside and outside Jupyter Notebooks.

Alternatively, you can install sionna-vispy with:

pip install sionna-vispy

And later install your preferred VisPy backend(s).

Usage

The VisPy scene previewer works both inside and outside Jupyter Notebooks.

First, you need to import the package (import order does not matter):

import sionna_vispy

Next, the usage of patch depends on the environment, see the subsections.

NOTE: If with patch(): is called before any call to scene.preview(...), then you only need to call patch() once.

Inside Notebooks[^1]

Very simply, rewrite any

scene.preview(...)

with the following:

with sionna_vispy.patch():
    canvas = scene.preview()

canvas

WARNING: canvas must be the return variable of the cell, because the with context does not return an instance of Previewer.

[^1]: Note that you need jupyter_rfb to work inside Jupyter Notebooks.

Outside Notebooks

Canvas need to be shown and the VisPy application must be started to open a window:

with sionna_vispy.patch():
    canvas = scene.preview(...)

canvas.show()
canvas.app.run()

How it works

This package replaces the pythreejs previewer with some VisPy implementation by monkey-patching sionna.rt.scene.Previewer.

Additionally, patch() will (by default) look at any existing sionna.rt.scene.Scene class instance in the local namespace of the callee, and temporarily replace any existing preview widget to make sure to use the new previewer. You can opt-out of this by calling patch(patch_existing=False) instead.

Design goals

This package aims to be a very minimal replacement to the pythreejs previewer, with maximum compatibility.

As a result, it does not aim to provide any additional feature.

Instead, it aims at providing a very similar look to that of pythreejs, with all the nice features that come with VisPy.

Contributing

This project welcomes any contribution, and especially:

  • bug fixes;
  • graphical improvements to closely match the original pythreejs previewers;
  • or documentation typos.

As stated above, new features are not expected to be added, unless they are also added to the original pythreejs previewer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sionna_vispy-1.0.0.tar.gz (162.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sionna_vispy-1.0.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file sionna_vispy-1.0.0.tar.gz.

File metadata

  • Download URL: sionna_vispy-1.0.0.tar.gz
  • Upload date:
  • Size: 162.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sionna_vispy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 42fbaf11607580545fe33514a54e4e299687363792c716e10c5f81047b8d9712
MD5 3119fd8f694ea30c60c5c24c447e8d28
BLAKE2b-256 d8fdb7466aa4627c28b09b8a9d3154d4a23665deb00393202a3c93a8f364d852

See more details on using hashes here.

Provenance

The following attestation bundles were made for sionna_vispy-1.0.0.tar.gz:

Publisher: publish.yml on jeertmans/sionna-vispy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sionna_vispy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sionna_vispy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for sionna_vispy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d418786bbc87175915bd75cbf0fc86573758a14336c54d9e2f061a0cdbf37a1c
MD5 616048c32b5f85409538952dd31244a2
BLAKE2b-256 7eb54d425c70c08fa2b9e11569b15884eb9433573d5ff4191e4a2e0101d3598f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sionna_vispy-1.0.0-py3-none-any.whl:

Publisher: publish.yml on jeertmans/sionna-vispy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page