polars_astro
A package adding support for common astronomy data files in Polars.
Installing
pip install polars_astro
Usage
FITS Files
scan_fits adds support for reading in FITS files as a LazyFrame including
predicate pushdown and column projection. The python package fitsio (built around CFITSIO)
is used internally for efficient row/column access.
import polars as pl
import polars_astro as pla
pla.scan_fits("astro_catalog.fits").filter(
pl.col("parallax") > 0.1,
pl.col("parallax_err") < 0.01
).select(
pl.col("ID"),
pl.col("pm_ra"),
pl.col("pm_dec"),
pl.col("B_mag"),
pl.col("V_mag")
)
Numpy Arrays
The np namespace makes it easy to retrieve numpy arrays from a DataFrame
import polars as pl
import polars_astro as pla
pmra, pmdec, distance = pla.read_fits("astro_catalog.fits").filter(
pl.col("parallax") > 0.1,
pl.col("parallax_err") < 0.01
).np.select(
"pm_ra",
"pm_dec",
1/pl.col("parallax")
)
pmra, pmdec and distance will all be one-dimensional numpy arrays of the appropriate type.
Nulls are handled as described in the polars documentation for Series.to_numpy. This may involve casting integers to floats.
Release files for polars-astro 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| polars_astro-0.2.2.tar.gz | 8.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polars_astro-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.1 kB
Release files / polars_astro-0.2.2.tar.gz
| Download URL | polars_astro-0.2.2.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a62406249fb89eabbea6f8dd362d27ef1944bae535e9a08eb4f2aac67413d4d
|
|
BLAKE2b-256 checksum How to use checksums |
e55ae29fe6355f073e2a8b1f8605acc21d13669aafab2cc40a9a73e5161c98fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / polars_astro-0.2.2-py3-none-any.whl
| Download URL | polars_astro-0.2.2-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0aef718d8df56ac62fd019755c7e4f05bc3342bb8c969dbb93cc7b8e6a12ab4
|
|
BLAKE2b-256 checksum How to use checksums |
7dea8cbb80be7d3e84870479964629e85c5ff5dff6ad5e61efbc58f91f2657f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|