Skip to main content

processinator

Astronomy image processing library. Converts linear FITS data into visually useful images using nonlinear stretch algorithms.

Install

pip install processinator

JAX is included by default for JIT-accelerated stretching on CPU.

GPU acceleration

For GPU-accelerated processing, install the appropriate extra for your hardware:

NVIDIA (CUDA 12):

pip install processinator[cuda]

AMD (ROCm):

pip install processinator[rocm]
# Then install the ROCm JAX wheel:
pip install --upgrade jaxlib-rocm  # see https://jax.readthedocs.io/en/latest/installation.html#amd-gpu-rocm

Apple Silicon (Metal):

pip install processinator[metal]

Check which backend is active:

import processinator
print(processinator.backend_name())  # "JAX (GPU)", "JAX (CPU)", or "numpy"

Usage

from processinator import stretch, fits_to_image, StretchAlgorithm

# High-level: FITS file → PNG/JPEG
image = fits_to_image("my_image.fits", output_path="stretched.png")

# With gradient removal and denoising
image = fits_to_image(
    "my_image.fits",
    output_path="stretched.png",
    remove_gradient=True,
    denoise=True,
)

# Low-level: numpy array → stretched array
import numpy as np
from astropy.io import fits

data = fits.getdata("my_image.fits").astype(np.float64)
stretched = stretch(data, algorithm=StretchAlgorithm.MTF)

# Full pipeline control
from processinator import process, PipelineConfig

result = process(data, PipelineConfig(
    gradient_removal=True,
    denoise=True,
    denoise_threshold=3.0,
))

Algorithms

Algorithm Best for Description
MTF (default) General use Midtones Transfer Function with background neutralization
Arcsinh Color preservation Inverse hyperbolic sine, maintains color ratios
Log High dynamic range Logarithmic stretch
Linear Quick preview Simple percentile-based clip and scale
Statistical Consistent output Gamma correction targeting a specific median

Denoising

denoise() implements starlet (à trous B3-spline) wavelet thresholding — the standard astronomy approach (Starck & Murtagh). The noise level is estimated automatically from the finest wavelet scale, so there is no noise parameter to tune.

from processinator import denoise

quiet = denoise(data)                        # hard thresholding (default)
smooth = denoise(data, mode="soft")          # smoother, for starless data
gentle = denoise(data, threshold=2.0)        # threshold in noise sigmas

Why it's astronomically safe:

  • Stars and real structure produce wavelet coefficients far above the noise threshold and pass through untouched — hard mode preserves bright-star photometry exactly.
  • The coarse residual (faint nebulosity, sky background) is never thresholded, so large-scale signal survives.

Synthetic test images

processinator.synthetic generates linear test frames with known ground truth (star catalog, noise-free reference) — useful for testing any processing code, not just this library's:

from processinator import make_test_image
from processinator.synthetic import save_fits

img = make_test_image(
    (512, 512),
    rgb=True,
    gradient_amplitude=300.0,   # sky gradient
    nebula_amplitude=150.0,     # large-scale nebulosity
    dark_edges=(10, 0, 14, 0),  # stacking artifacts
    hot_pixels=20,
    seed=13,
)
img.data     # observed frame (signal + noise)
img.clean    # noise-free truth
img.stars    # (N, 3) star catalog: x, y, peak amplitude
save_fits(img.data, "test.fits")

uv run python scripts/make_test_images.py writes a set of example FITS files to examples/ for manual experimentation.

License

AGPL-3.0

Metadata

Release files for processinator 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for processinator 0.6.0
File Size Uploaded
processinator-0.6.0.tar.gz 16.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for processinator 0.6.0
File Interpreter ABI Platform
processinator-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.9 kB

Release files / processinator-0.6.0.tar.gz

Download URL processinator-0.6.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
765f7ba4dcffb14fde638322becd9a79da058a828b50713e3703239f839401db
BLAKE2b-256 checksum
How to use checksums
3b893e8f1b72bd99f504f1e7636ac9fd59f365d2dbc8a09ccf6da667120d5c9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / processinator-0.6.0-py3-none-any.whl

Download URL processinator-0.6.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e98db90e224678aca7c25165077b2d1c9e41fd48448d7741cb99ed01d170cfc6
BLAKE2b-256 checksum
How to use checksums
b9a2c3b2a06ca352c991c26649b2d909d341f60ab50a2ba466a8f9f6cd5ce7cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page