sionna-vispy


Namesionna-vispy JSON
Version 0.19.0 PyPI version JSON
download
home_pageNone
SummaryVisPy scene previewer for Sionna
upload_time2024-11-13 15:10:46
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords preview raytracing sionna vispy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sionna-vispy

[![Latest Release][pypi-version-badge]][pypi-version-url]
[![Python version][pypi-python-version-badge]][pypi-version-url]

A [VisPy](https://github.com/vispy/vispy)
backend to preview
[Sionna](https://github.com/NVlabs/sionna) scenes
that works both inside and **outside** Jupyter Notebook.

<p align="center">
  <img alt="Example VisPy canvas" width="480" src="https://github.com/user-attachments/assets/04195e43-674b-43d6-8422-baf3d4dc572d">
</p>

This library consists of two parts:

1. a VisPy-based `InteractiveDisplay` 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:

```bash
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:

```bash
pip install sionna-vispy
```

And later install your preferred
[VisPy backend(s)](https://vispy.org/installation.html).

## Usage

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

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

```python
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

```python
scene.preview(...)
```

with the following:

```python
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
> `InteractiveDisplay`.

[^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:

```python
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*](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch)
`sionna.rt.scene.InteractiveDisplay`.

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.

[pypi-version-badge]: https://img.shields.io/pypi/v/sionna-vispy?label=sionna-vispy
[pypi-version-url]: https://pypi.org/project/sionna-vispy/
[pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/sionna-vispy
[pypi-download-badge]: https://img.shields.io/pypi/dm/sionna-vispy

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sionna-vispy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "preview, raytracing, sionna, vispy",
    "author": null,
    "author_email": "J\u00e9rome Eertmans <jeertmans@icloud.com>",
    "download_url": "https://files.pythonhosted.org/packages/10/fe/01adddc07c1538735552ee494681898a114256df3844b4ea0077d3f3ad2d/sionna_vispy-0.19.0.tar.gz",
    "platform": null,
    "description": "# sionna-vispy\n\n[![Latest Release][pypi-version-badge]][pypi-version-url]\n[![Python version][pypi-python-version-badge]][pypi-version-url]\n\nA [VisPy](https://github.com/vispy/vispy)\nbackend to preview\n[Sionna](https://github.com/NVlabs/sionna) scenes\nthat works both inside and **outside** Jupyter Notebook.\n\n<p align=\"center\">\n  <img alt=\"Example VisPy canvas\" width=\"480\" src=\"https://github.com/user-attachments/assets/04195e43-674b-43d6-8422-baf3d4dc572d\">\n</p>\n\nThis library consists of two parts:\n\n1. a VisPy-based `InteractiveDisplay` to replace `sionna.rt.previewer`;\n2. and a `patch()` context manager that dynamically replaces\n  the old pythreejs previewer with the new VisPy previewer.\n\n## Installation\n\nFor the best out-of-the-box experience, we recommend\ninstalling via Pip with `recommended` extras:\n\n```bash\npip install sionna-vispy[recommended]\n```\n\nThis will install this package, as well as PySide6 and jupyter-rfb,\nso that `scene.preview(...)` works inside and **outside** Jupyter Notebooks.\n\nAlternatively, you can install sionna-vispy with:\n\n```bash\npip install sionna-vispy\n```\n\nAnd later install your preferred\n[VisPy backend(s)](https://vispy.org/installation.html).\n\n## Usage\n\nThe VisPy scene previewer works both\ninside and **outside** Jupyter Notebooks.\n\nFirst, you need to import the package (import order does not matter):\n\n```python\nimport sionna_vispy\n```\n\nNext, the usage of `patch` depends on the environment,\nsee the subsections.\n\n> **NOTE:**\n> If `with patch():` is called before any\n> call to `scene.preview(...)`,\n> then you only need to call\n> `patch()` once.\n\n### Inside Notebooks[^1]\n\nVery simply, rewrite any\n\n```python\nscene.preview(...)\n```\n\nwith the following:\n\n```python\nwith sionna_vispy.patch():\n    canvas = scene.preview()\n\ncanvas\n```\n\n> **WARNING:**\n> `canvas` must be the return variable\n> of the cell, because the `with` context\n> does not return an instance of\n> `InteractiveDisplay`.\n\n[^1]: Note that you need `jupyter_rfb` to work inside Jupyter Notebooks.\n\n### Outside Notebooks\n\nCanvas need to be *shown* and the VisPy application\nmust be started to open a window:\n\n```python\nwith sionna_vispy.patch():\n    canvas = scene.preview(...)\n\ncanvas.show()\ncanvas.app.run()\n```\n\n## How it works\n\nThis package replaces the pythreejs previewer with some\nVisPy implementation by\n[*monkey-patching*](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch)\n`sionna.rt.scene.InteractiveDisplay`.\n\nAdditionally, `patch()` will (by default) look at\nany existing `sionna.rt.scene.Scene` class instance in the local\nnamespace of the callee, and temporarily replace any\nexisting preview widget to make sure to use the new previewer. You can\nopt-out of this by calling `patch(patch_existing=False)` instead.\n\n## Design goals\n\nThis package aims to be a very minimal replacement to the pythreejs\npreviewer, with maximum compatibility.\n\nAs a result, **it does not aim to provide any additional feature**.\n\nInstead, it aims at providing a very similar look to that of\npythreejs, with all the nice features that come with VisPy.\n\n## Contributing\n\nThis project welcomes any contribution, and especially:\n\n+ bug fixes;\n+ graphical improvements to closely match the original pythreejs previewers;\n+ or documentation typos.\n\nAs stated above, new features are not expected to be added, unless they are also\nadded to the original pythreejs previewer.\n\n[pypi-version-badge]: https://img.shields.io/pypi/v/sionna-vispy?label=sionna-vispy\n[pypi-version-url]: https://pypi.org/project/sionna-vispy/\n[pypi-python-version-badge]: https://img.shields.io/pypi/pyversions/sionna-vispy\n[pypi-download-badge]: https://img.shields.io/pypi/dm/sionna-vispy\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "VisPy scene previewer for Sionna",
    "version": "0.19.0",
    "project_urls": {
        "Changelog": "https://github.com/jeertmans/sionna-vispy/releases",
        "Documentation": "https://github.com/jeertmans/sionna-vispy",
        "Founding": "https://github.com/sponsors/jeertmans",
        "Homepage": "https://github.com/jeertmans/sionna-vispy",
        "Repository": "https://github.com/jeertmans/sionna-vispy"
    },
    "split_keywords": [
        "preview",
        " raytracing",
        " sionna",
        " vispy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7457877c2a1578cfce0c0148405dda9f293191667c7321a88b562aea527f0aa9",
                "md5": "0750c04fb86278dcbb2a874b2a95429d",
                "sha256": "07c5eaefb4b817b633c786d8e2f0e4c1ed6a81034d3620b07b55fedc05564447"
            },
            "downloads": -1,
            "filename": "sionna_vispy-0.19.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0750c04fb86278dcbb2a874b2a95429d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9759,
            "upload_time": "2024-11-13T15:10:44",
            "upload_time_iso_8601": "2024-11-13T15:10:44.518838Z",
            "url": "https://files.pythonhosted.org/packages/74/57/877c2a1578cfce0c0148405dda9f293191667c7321a88b562aea527f0aa9/sionna_vispy-0.19.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10fe01adddc07c1538735552ee494681898a114256df3844b4ea0077d3f3ad2d",
                "md5": "df7a71e16d133c1d29658f89a7a2e043",
                "sha256": "95277cbe265635e92aa7d83f9b405cdcdf7b343be22bc08a0943676b9762affa"
            },
            "downloads": -1,
            "filename": "sionna_vispy-0.19.0.tar.gz",
            "has_sig": false,
            "md5_digest": "df7a71e16d133c1d29658f89a7a2e043",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 121221,
            "upload_time": "2024-11-13T15:10:46",
            "upload_time_iso_8601": "2024-11-13T15:10:46.477682Z",
            "url": "https://files.pythonhosted.org/packages/10/fe/01adddc07c1538735552ee494681898a114256df3844b4ea0077d3f3ad2d/sionna_vispy-0.19.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-13 15:10:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jeertmans",
    "github_project": "sionna-vispy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sionna-vispy"
}
        
Elapsed time: 9.14341s