Skip to main content

Python bindings for Rust Planetarium rendering library

Project description

PyPlanetarium

Python bindings for Planetarium sub-pixel precision light spot rendering library for astronomy and video tracking applications.

Example usage

from pyplanetarium import Canvas, SpotShape, ImageFormat, Window

# Draw on a square 256x256 pixel canvas.
c = Canvas.new(256, 256)

# Define a round spot shape with diffraction radius of 2.5 pixels.
shape = SpotShape().scale(2.5)

# Add some spots at random positions with varying shape size
# and peak intensity.
spot1 = c.add_spot((100.3, 130.8), shape, 0.5)
spot2 = c.add_spot((80.6, 200.2), shape.scale(0.5), 0.9)

# Note: Out of range position coordinates and peak intensities are fine.
#       The resulting spot image is clipped into the canvas rectangle.
#       Peak intensity > 1.0 leads to saturation to the maximum pixel value.
spot3 = c.add_spot((256.1, 3.5), shape.scale(10.0), 1.1)

# Set the canvas background pixel value.
c.set_background(int(0.05 * Canvas.PIXEL_MAX))

# Clear the canvas and paint the light spots.
c.draw()

# Export to a 8-bit gamma-compressed grayscale PNG image.
png_8bpp_bytes = c.export_image(ImageFormat.PngGamma8Bpp)

# Export to a 16-bit linear light grayscale PNG image.
png_16bpp_bytes = c.export_image(ImageFormat.PngLinear16Bpp)

# Export a rectangular canvas window to a 8-bit gamma-compressed RAW image.
wnd = Window.new(64, 32).at(90, 120)
raw_window_8bpp_bytes = c.export_window_image(wnd, ImageFormat.RawGamma8Bpp)

# Export the 2x2 subsampled canvas frame to a 10-bit linear light RAW image.
factors = (2, 2)
raw_subsampled_10bpp_bytes = c.export_subsampled_image(factors, ImageFormat.RawLinear10BppLE)

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

pyplanetarium-0.2.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distributions

pyplanetarium-0.2.0-cp37-abi3-win_amd64.whl (290.7 kB view details)

Uploaded CPython 3.7+ Windows x86-64

pyplanetarium-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (296.2 kB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

File details

Details for the file pyplanetarium-0.2.0.tar.gz.

File metadata

  • Download URL: pyplanetarium-0.2.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.14.15

File hashes

Hashes for pyplanetarium-0.2.0.tar.gz
Algorithm Hash digest
SHA256 56e9b888bfd27a45d77bb415c69e483b32026dbb44682eb141111e65bb823b59
MD5 96ddfa7ac6464bb77bf457bdffd1a7c0
BLAKE2b-256 94752c06a2a664b316b2837fa3da3a3332bb5f8e0b18e6373ab365274f467e9e

See more details on using hashes here.

File details

Details for the file pyplanetarium-0.2.0-cp37-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pyplanetarium-0.2.0-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 eb15732236ada7e59d304883b4bb2b3d6b79a0bc29b5fa5ff0fc441fa981d56e
MD5 211858650518b70bb9853a9518a59611
BLAKE2b-256 fa99342cb55936f1565c6bfedf23422df144524dccbebf018438818a2e4e7749

See more details on using hashes here.

File details

Details for the file pyplanetarium-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pyplanetarium-0.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d42aedb915cf655e1f8e03c21c3b4277e0d11f8faa2b2e47275a98accb4bfd2
MD5 4046dcead73d7e68e2f9aad01aa3966c
BLAKE2b-256 8b44875cc62368fa90a38b71d6f641c506a2c06468788dc920581a878ca91cbc

See more details on using hashes here.

Supported by

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