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
Release history Release notifications | RSS feed
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.2.tar.gz
(12.5 kB
view hashes)
Built Distributions
Close
Hashes for pyplanetarium-0.1.2-cp37-abi3-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9b93879fcbf8df873c1e4df0e52e05cf8d75fd308260f19ad233c8e306b50b7 |
|
MD5 | 652d45f5d59ee7ec310de37fd00e04dc |
|
BLAKE2b-256 | 4fdfed210c395f0bb19ebcdd40e1de370c8a7b46491a9343c930367e79394ece |
Close
Hashes for pyplanetarium-0.1.2-cp37-abi3-manylinux_2_27_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ba8b17c9abfe3b94c176368edb8d6f851ff1d2ec9ca9fdcfb31e8ef22689187 |
|
MD5 | 733265323be2f3f4e60e1378c2280f20 |
|
BLAKE2b-256 | 3c607e86a7a2314f1fdae189127b5f3314f8884825f8a155193047aa1d085b72 |