Skip to main content

A Python package for high-performance tensor-based GPU/CPU buffer rendering, supporting tables, text, images, and graphics.

Project description

pymatgraph

pymatgraph is a Python package that provides a multiprocess-safe buffer for PyTorch tensors, specifically designed for rendering RGB matrices and tables using Pygame. This package allows for efficient sharing of tensor data between processes, making it suitable for applications that require real-time rendering and updates.

Features

  • Multiprocess Safe: Utilizes shared memory and locks to ensure safe access to tensor data across multiple processes.
  • Flexible Modes: Supports both numerical and RGB modes for tensor data.
  • Table Rendering: Built-in utilities to render structured tabular data directly on the screen.
  • Easy Integration: Designed to work seamlessly with Pygame for rendering visual data.

Installation

You can install the pymatgraph package using pip:

pip install pymatgraph

Usage

Here is a simple example of how to use the pymatgraph package:

width, height = 640, 480
buffer = MultiprocessSafeTensorBuffer(n=height, m=width, mode="rgb")
buffer.write_matrix(torch.zeros((height,width,3), dtype=torch.uint8))

g = Graphics(width=width, height=height, bg_color=(30,30,30))

text1 = Text("Custom Rendering Engine!", x=50, y=50, font_size=32, color=(255,255,0))
table1 = Table(
    data=[["Name","Age"], ["Alice","24"], ["Bob","30"]],
    x=50, y=120, cell_width=120, cell_height=40,
    bg_color=(50,50,100), grid_color=(255,255,255)
)

text1.render_to_tensor(buffer)
table1.render_to_tensor(buffer)

g.run(buffer)

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

pymatgraph-0.3.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

pymatgraph-0.3.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file pymatgraph-0.3.1.tar.gz.

File metadata

  • Download URL: pymatgraph-0.3.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pymatgraph-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ce3d72ce45847afd831182769f1c52b4294b5c9e549012aa482b29546fc81dae
MD5 c38c2f817f679153cbfacc803bd2d3ae
BLAKE2b-256 1173159ed14774db95bc915280dfd024396702f34ea3b411342d9118895e69c7

See more details on using hashes here.

File details

Details for the file pymatgraph-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pymatgraph-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pymatgraph-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7b6cabd52fa56545c923d36eaeb44fd19222861d551147f8dee9649203efa827
MD5 458f5794c8916f284fe5ecc1caa550aa
BLAKE2b-256 624b44427076a18425495ed8390a7b0b8a207810fad661bc9ece69cd63067206

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