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 gridsconvolve.{gaussian1d, conv1d, conv_axis, conv2d, conv2d_renorm, conv_axis_renorm}— bare correlation kernels plus NaN-as-missing renormalized variantsspectroscopy.Spectrum— wavelength + flux + optional error + optional mask, with rebinning, flux density convention conversion, and noise-free-template LSF broadening viaSpectrum.convolve_lsfspectroscopy.synthetic_photometry.{synthetic, SyntheticOperator}— synthetic photometry through transmission curves; the cached operator is suited for MCMC hot loopsimage.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 ofpixel_to_world_values/world_to_pixel_valuescallables (astropy.wcs or gwcs) into the corner array consumed byreproject_exact, with optionalcoarse_stepfor expensive WCS chainsimage.convolve_psf— true 2-D PSF convolution with NaN-as-missing edge / mask renormalizationimage.convolve_gaussian_axis— 1-D Gaussian axis correlation for grism-style matched filteringimage.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-resolutionimage.psf.build_extended_psf— bright-star wing stacking + core↔wing stitch into an encircled-energy-normalised extended PSF, withrobust_combine/solve_flux_background/stitch_psfexposed as leavesaperture.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 segmentationlabel_map+label_allowedwhitelist 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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file noobase-0.0.5.tar.gz.
File metadata
- Download URL: noobase-0.0.5.tar.gz
- Upload date:
- Size: 233.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1e8c0e150984bc5e2ce014527c53e900eb78e73945855c1511b6e5f460c765f
|
|
| MD5 |
1037d070d04d05777cd490c8748c1f01
|
|
| BLAKE2b-256 |
c3a2bfc376d4d78798deb82fbcae8fb50c9fdced3bb7c75065b29d4770bd88ad
|
File details
Details for the file noobase-0.0.5-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: noobase-0.0.5-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 512.8 kB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b67a6c24e0b4950cbd0810261dacadd444050b356693d029bc9bfbf47665621a
|
|
| MD5 |
88e3729e4fa7baaf3fa4cb7455c470b6
|
|
| BLAKE2b-256 |
eddbc1e7eaabe34fc66329fac13dd8f310c2999865e6f1575e76fcf0175cb9d6
|
File details
Details for the file noobase-0.0.5-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: noobase-0.0.5-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 630.8 kB
- Tags: CPython 3.12+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72a90764b636d6342fe15276cb4d38233a07a78f120a0a6ffeb0ee197f8a19c2
|
|
| MD5 |
dbe2d171f3bf3d238fa04ef138d39a37
|
|
| BLAKE2b-256 |
efc62c90380b106b07d9d1658af2e59bacd6bf64c6b915e764395c0134e30aee
|
File details
Details for the file noobase-0.0.5-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: noobase-0.0.5-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 558.4 kB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa3fe727d91a994d6ff0c40bf6739b1ff759c4f17ed05e1ef7a326c7d2a99994
|
|
| MD5 |
0e7567f80e7eb5bb7c1cc865d458896f
|
|
| BLAKE2b-256 |
578879633b463ea4984fd222e056eeabc67d48e2ed99fe73e5f422b1a1c59c9d
|