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.

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

astrocolor-0.1.0b2.tar.gz (110.3 kB view details)

Uploaded Source

Built Distribution

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

astrocolor-0.1.0b2-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

Details for the file astrocolor-0.1.0b2.tar.gz.

File metadata

  • Download URL: astrocolor-0.1.0b2.tar.gz
  • Upload date:
  • Size: 110.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}

File hashes

Hashes for astrocolor-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 ce27efc33e36ec85548abdc7f46f2fca6c84fce32ad0d360a58fa84d35a82ac5
MD5 0a83dc68e6a707685e5717e35ba711fb
BLAKE2b-256 510d7cc39e9fc1928ec1572adb2bd460be10c8580239166ab16160767a6decd6

See more details on using hashes here.

File details

Details for the file astrocolor-0.1.0b2-py3-none-any.whl.

File metadata

  • Download URL: astrocolor-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 119.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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}

File hashes

Hashes for astrocolor-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 071c584a4ff839f928cf90bcdf170b3725d4298736f33148d03be2e853894d5e
MD5 bb5de1942f8f34099ebccf2364544228
BLAKE2b-256 4b9ace3b634d51e733438e8d15325e0c4be10c52929435837b071476b8f2be2b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0b2 This release

2 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