Skip to content

Commit

Permalink
Add opengl visualization.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohn123 committed Dec 15, 2024
1 parent 317da32 commit 82367e2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ PyQt6_sip==13.8.0
python-dateutil==2.9.0.post0
six==1.16.0
pandas==2.2.3
vispy==0.14.3
18 changes: 18 additions & 0 deletions visualize_opengl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np
import vispy.scene
from vispy.scene import visuals

file_path = "test1" # Replace with your file path

# Read the data into a numpy array
data = np.loadtxt(file_path, delimiter=",", dtype=np.uint8)

canvas = vispy.scene.SceneCanvas(keys="interactive", show=True)
view = canvas.central_widget.add_view()
view.camera = 'panzoom' # Allow panning and zooming

heatmap = visuals.Image(data, cmap='viridis', parent=view.scene, texture_format="r8")

# Set aspect ratio to match the data
view.camera.set_range()
vispy.app.run()

0 comments on commit 82367e2

Please sign in to comment.