Skip to main content

Foundational pure-function utilities for astronomy analysis

Project description

noobase

Foundational pure-function utilities for astronomy analysis. Rust core with Python bindings via PyO3.

Status: pre-1.0, API unstable. Breaking changes expected between minor versions.

Install

pip install noobase

Requires Python 3.12 or newer. Wheels are published for linux-x86_64, macos-arm64, and windows-x86_64; a source distribution is also available.

Quick start

import numpy as np
import noobase

wavelength = np.linspace(1.0, 5.0, 200)
flux = np.exp(-((wavelength - 3.0) ** 2) / 0.5)
error = 0.01 * np.ones_like(flux)

spectrum = noobase.spectroscopy.Spectrum(
    wavelength=wavelength,
    flux=flux,
    error=error,
    spacing="linear",
    kind="centers",
)

transmission_grid = np.linspace(2.5, 3.5, 50)
transmission_values = np.exp(-((transmission_grid - 3.0) ** 2) / 0.05)

band_flux, band_error, coverage = spectrum.synthetic_photometry(
    transmission_grid=transmission_grid,
    transmission_values=transmission_values,
    convention="photon_counting",
)

What's in the box

  • axis.Grid — 1-D monotonic axis (linear / log, centers / edges)
  • axis.overlap.{rebin, rebin_variance, coverage} — overlap-weighted rebin primitives between two axis grids
  • convolve.{gaussian1d, conv1d, conv_axis, conv2d, conv2d_renorm, conv_axis_renorm} — bare correlation kernels plus NaN-as-missing renormalized variants
  • spectroscopy.Spectrum — wavelength + flux + optional error + optional mask, with rebinning, flux density convention conversion, and noise-free-template LSF broadening via Spectrum.convolve_lsf
  • spectroscopy.synthetic_photometry.{synthetic, SyntheticOperator} — synthetic photometry through transmission curves; the cached operator is suited for MCMC hot loops
  • image.reproject_exact — surface-brightness-conserving image reprojection via planar polygon clipping (rayon-parallel; WCS handling stays in the caller's astropy / gwcs)
  • image.make_pixel_corners — turn a pair of pixel_to_world_values / world_to_pixel_values callables (astropy.wcs or gwcs) into the corner array consumed by reproject_exact, with optional coarse_step for expensive WCS chains
  • image.convolve_psf — true 2-D PSF convolution with NaN-as-missing edge / mask renormalization
  • image.convolve_gaussian_axis — 1-D Gaussian axis correlation for grism-style matched filtering
  • image.build_stamp — recenter a point-source cutout into a fixed stamp (sub-pixel centroid recorded, not applied)
  • image.psf.build_epsf — oversampled ePSF from a stack of under-sampled stamps via projected Landweber / Irani–Peleg super-resolution
  • image.psf.build_extended_psf — bright-star wing stacking + core↔wing stitch into an encircled-energy-normalised extended PSF, with robust_combine / solve_flux_background / stitch_psf exposed as leaves
  • aperture.grow_mask — adaptive aperture mask grown by a heap-driven greedy loop from one or more seed pixels, terminated by an inner-annulus SNR stop and a radial-gradient stop (each with independent hysteresis); accepts an optional segmentation label_map + label_allowed whitelist to keep the mask inside the source's pre-computed segmentation

Convolution examples

template = noobase.spectroscopy.Spectrum(
    wavelength=wavelength,
    flux=flux,
    spacing="linear",
    kind="centers",
)
broadened = template.convolve_lsf(spec="constant_r", resolving_power=3000.0)

psf = psf / psf.sum()
model_image = noobase.image.convolve_psf(image, psf)

line_response = noobase.image.convolve_gaussian_axis(
    image,
    sigma=2.5,
    axis=0,
    normalization="l2",
)

See the full project README on GitHub for the complete feature list, the workspace layout, and the development workflow.

License

MIT.

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

noobase-0.0.6.tar.gz (244.6 kB view details)

Uploaded Source

Built Distributions

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

noobase-0.0.6-cp312-abi3-win_amd64.whl (521.4 kB view details)

Uploaded CPython 3.12+Windows x86-64

noobase-0.0.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (640.9 kB view details)

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

noobase-0.0.6-cp312-abi3-macosx_11_0_arm64.whl (567.1 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

File details

Details for the file noobase-0.0.6.tar.gz.

File metadata

  • Download URL: noobase-0.0.6.tar.gz
  • Upload date:
  • Size: 244.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for noobase-0.0.6.tar.gz
Algorithm Hash digest
SHA256 ad63c0e53b6eedd3f78e5db140e7dc18b1f559919580d7ee9f228e8e531babad
MD5 d1db5425f48d7756617254cdb361c9da
BLAKE2b-256 3a40f1360489c77b1db8c713e43d947ff9e9292fcc66baeb875417d7e20e8aed

See more details on using hashes here.

File details

Details for the file noobase-0.0.6-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: noobase-0.0.6-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 521.4 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for noobase-0.0.6-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 674f211011c9389408942b40277db68757e0669fdb9556f7fbc1d35d88bdbe99
MD5 488bbf3a46aab610e77b0a0d3a3136bb
BLAKE2b-256 697d1402af13703d8315a9ae2ee52e6408c501bb7c3ca0281cefbe463a048839

See more details on using hashes here.

File details

Details for the file noobase-0.0.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for noobase-0.0.6-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef03abdb61f5071bf905efe7d74cb014471bf05e4f7d4f496f5838e33992a825
MD5 dd1e4328a68ba5aeb8effe89e0f74d49
BLAKE2b-256 52a470e79e5da6cf41350b852b5e9f8fadcfc4b58003aed0b9d7119934faa1e3

See more details on using hashes here.

File details

Details for the file noobase-0.0.6-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for noobase-0.0.6-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 532a0d666934baeecb626caadd38b9bc1e964c22f3c033e92c8657ec7526a223
MD5 91f4bc0fff2bf3b83fb0a05e113c3ce3
BLAKE2b-256 0899d6093c0b6dd77ca98270ce62be443ee280e01d41e36c22321e042fd7d75c

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