Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

AstroColor

A Python library for general-purpose photometric conversions, image processing and color calculation.

Key features:

  • classes for data of different dimensions (1D/2D/3D, up to spectral cubes)
  • algebraic interactions between classes
  • error processing (with covariance matrices)
  • build-in "true" color calculation
  • filter profiles auto-loading (>11K available)
  • lightweight: absolute minimal dependencies
  • complete typification (basedpyright)

Spectral reconstruction is performed using Tikhonov regularization under the assumption that the result is smooth. It works for planets, moons, small bodies, and any other objects with continuum-dominated spectra that differ from the standard stars usually used in photometric transformations. Further improvements to the method are planned.

Experimental features:

  • photometric models (HG, HG1G2, Exponentials, Hapke, PhaseCoefficient)
  • spectral database parsing (TCT formatting, json5 extension)

Installation

To use the latest stable release from PyPI:

pip install astrocolor

To use the latest development version from GitHub:

pip install git+https://github.com/Askaniy/AstroColor.git

Supplementary notes

Using a virtual environment:

python3 -m venv .venv
.venv/bin/pip install astrocolor

Adding to a uv project:

uv add astrocolor

Examples

  • Synthetic photometry
import astrocolor as ac
spectrum = ac.Spectrum(
    wavelength_nm=[400, 500, 600, 700],
    spectral_dist=[1, 2, 3, 4]
)
bessell_V = ac.Filter.get('Generic/Bessell.V')
flux_value, flux_error = ac.get_photometry(spectrum, bessell_V)
  • Photometry to photometry
bessell_BVR = ac.FilterSet.get('Generic/Bessell.B', 'Generic/Bessell.V', 'Generic/Bessell.R')
photospectrum_BVR = ac.Photospectrum(
    filter_set=bessell_BVR,
    spectral_dist=[1, 2, 3]
)
sloan_gr = ac.FilterSet.get('SLOAN/SDSS.g', 'SLOAN/SDSS.r')
photospectrum = ac.get_photometry(photospectrum_BVR, sloan_gr)
  • Direct spectral reconstruction
spectrum = ac.get_spectrometry(photospectrum_BVR, requested_wavelengths=[400, 700])
  • Color calculations
color_xyz = ac.ColorPoint.from_spectral_data(ac.sun_CALSPEC)
color_system = ac.ColorSystem('sRGB', 'Illuminant E') # recommended
color_rgb = color_xyz.to_color_system(color_system)
color_rgb.gamma_correction = True
color_rgb.maximize_brightness = True
color_html = color_rgb.to_html()
  • Models
bb_7000K = ac.get_spectrometry(ac.BlackBodyModel(7000), [400, 500])

History

TrueColorTools were created in 2020 to resolve disputes regarding the color of celestial bodies. It features a graphical user interface and a user-expandable spectral database. Over time, the core of the program became self-contained enough to be spun off into a library. The refactoring took place in 2026; it opens up a general astronomical application.

For developers

Use uv sync --group dev to set the environment and build the library. Use uv run pytest for testing. Use \dev folder for local experiments.

Any changes suggested by AI must be thoroughly reviewed by the person who generated them. The responsibility always lies with the person.

Acknowledgments

This research has made use of the SVO Filter Profile Service "Carlos Rodrigo", funded by MCIN/AEI/10.13039/501100011033/ through grant PID2023-146210NB-I00

Metadata

Release files for astrocolor 0.1.0b3

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

Source distribution (sdist)

Source distribution for astrocolor 0.1.0b3
File Size Uploaded Provenance
astrocolor-0.1.0b3.tar.gz 124.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 255.8 kB

Release files / astrocolor-0.1.0b3.tar.gz

Download URL astrocolor-0.1.0b3.tar.gz
Size 124.0 kB
Tags Source
SHA-256 checksum
How to use checksums
50d2de8133bc6f7082cf41cd182fe9d60bfa977d4df6617e101e8ff7f105a425
BLAKE2b-256 checksum
How to use checksums
c1891b3a37978ee59ba386edb912d9f0d05e8ca71569553c90994149f3d278a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / astrocolor-0.1.0b3-py3-none-any.whl

Download URL astrocolor-0.1.0b3-py3-none-any.whl
Size 131.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf33c8d2a2a6881452bd7a33a67c521a1a3f59b01e8018b6d965b5a039aefe20
BLAKE2b-256 checksum
How to use checksums
a1a890cd3782bc4faeae597e5288232002c25ddcb688b2654a303ec58778c950
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for astrocolor 0.1.0b3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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