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

# 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(100)

# 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)

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.1.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distributions

pyplanetarium-0.1.1-cp37-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.7+ Windows x86-64

pyplanetarium-0.1.1-cp37-abi3-manylinux_2_27_x86_64.whl (313.1 kB view details)

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

File details

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

File metadata

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

File hashes

Hashes for pyplanetarium-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6cb838bb37be3a7ed609a43e96916f777e9ab9b044057c5dbc052c5c28ea816c
MD5 bf4b3ac6403d72d24af5a58342b40e21
BLAKE2b-256 c5cd1643f8660fafaf8d32a98ba81246add75b16f2d84af05d1bef01d7913484

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyplanetarium-0.1.1-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 63b8c3fc56e4aa15bd96df43838e1f134960c6d4473c7865dd20f00e4efb655c
MD5 838a4033cdd224e7847fae7464151914
BLAKE2b-256 d2b7a7c21b562e5b0007aeb06d19a9b89c7e5f1588e852e38a94b333d6d6df36

See more details on using hashes here.

File details

Details for the file pyplanetarium-0.1.1-cp37-abi3-manylinux_2_27_x86_64.whl.

File metadata

File hashes

Hashes for pyplanetarium-0.1.1-cp37-abi3-manylinux_2_27_x86_64.whl
Algorithm Hash digest
SHA256 44f46afe4fa4f0a9d1c287ec257ba96fd7bbeab0dabe7227c12e5be4c19c0246
MD5 69a4bd46a8d5c94d52eac5d6e6126cfe
BLAKE2b-256 86c5499e9eac8c3221035e9ccd559e468101d749fd12439fb7b0d693b995beff

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