Skip to main content

Panopti: a Python package for interactive 3D visualization.

Project description

Panopti

Logo

Panopti is a Python package for interactive 3D visualization that seamlessly supports remote development setups (e.g. through SSH). It pairs a Flask server with a React+ThreeJS frontend and is designed such that users only need to write Python code, making it painless to setup interactive experiments and scenes. All code examples and demos throughout the documentation are achieved purely using Panopti in Python -- no JavaScript required!.

Panopti supports various geometric data structures (e.g. meshes, point clouds), UI control elements (e.g. buttons, sliders, color pickers, interactive plots) that are programmable in Python, and global event callbacks (e.g. for camera movement, clicking on geometry).

Simple example

First start a Panopti server in a separate terminal:

python -m panopti.run_server --host localhost --port 8080

Then you can easily define your scene, for example:

import panopti
import trimesh # just for io

# create panopti client that connects to server:
viewer = panopti.connect(server_url="http://localhost:8080", viewer_id='client') 
# viewer at: http://localhost:8080/?viewer_id=client

mesh = trimesh.load('./examples/demosthenes.obj')
verts, faces = mesh.vertices, mesh.faces
verts = np.ascontiguousarray(verts, dtype=np.float32)
faces = np.ascontiguousarray(faces, dtype=np.int32)

# add a mesh to the scene:
viewer.add_mesh(
    vertices=verts,
    faces=faces,
    name="Statue",
    color=(0.8, 0.2, 0.2),
)

def callback_button(viewer):
    # Update the mesh's vertices
    statue = viewer.get('Statue')
    v = np.asarray(statue.vertices)
    v = v * 2.0 
    statue.update(vertices=v)

viewer.button(callback=callback_button, name='Click Me!')

viewer.hold() # prevent script from terminating

Installation

To install from source:

git clone https://github.com/ArmanMaesumi/panopti
cd panopti
pip install .

To install from PIP:

pip install panopti

Dependencies

Core dependencies:

pip install numpy eventlet requests flask flask-socketio

Optional dependencies:

pip install trimesh         # for exporting meshes
pip install matplotlib      # for colormap utilities
pip install plotly==5.22.0  # for plotly figure support

Doc-related dependencies:

pip install mkdocs mkdocs-material mkdocstrings mkdocstrings-python

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

panopti-0.1.0.tar.gz (6.7 MB view details)

Uploaded Source

Built Distribution

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

panopti-0.1.0-py3-none-any.whl (6.8 MB view details)

Uploaded Python 3

File details

Details for the file panopti-0.1.0.tar.gz.

File metadata

  • Download URL: panopti-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for panopti-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2c01532cefcb26cfb5cc255b80aaae91eff0ac337a28974241bed8f4ef73913b
MD5 478d5e5d3bce8e0f10eaf72828609c55
BLAKE2b-256 acb1cd5113a98ea4d608692eec537c2a19358039ece3483b43ff9fd774a2f68d

See more details on using hashes here.

File details

Details for the file panopti-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: panopti-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for panopti-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 921ebad73661e0da1a530b68b1e92f2260cfb986e1f2f2273068254efef721db
MD5 bdf69bbeabf4de3e37eef83b4bec7af0
BLAKE2b-256 d2019f642b0f8005923407c1fe8f5dbea4dc2da61741f67a850c8af50199c5ef

See more details on using hashes here.

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