Library to perform spectral reconstruction, calculate synthetic photometry and colors.
Project description
AstroColor
A Python library for converting between photometric systems, true color calculation, and space image processing.
It performs synthetic photometry on low-resolution (5-nm wavelength grid step) spectra as well as spectral reconstruction from measurements in filters based on Tikhonov regularization.
Pre-alpha version! Do not use!
Installation
Use AstroColor in a virtual environment:
python3 -m venv .venv
.venv/bin/pip install git+https://github.com/Askaniy/AstroColor.git
Or add AstroColor to your uv project:
uv add git+https://github.com/Askaniy/AstroColor.git
Key features
- Calculate synthetic photometry
import astrocolor as ac
spectrum = ac.Spectrum(
wavelength_nm=[400, 500, 600, 700],
spectral_dist=[1, 2, 2, 1]
)
v_band = ac.Filter.get('Generic_Bessell.V')
flux_value, flux_error = ac.observe(spectrum, v_band)
- Create a filter system
johnson_system = ac.FilterSet.get(
'Generic_Bessell.B',
'Generic_Bessell.V',
'Generic_Bessell.R'
)
photospectrum_BVR = ac.observe(spectrum, johnson_system)
- Reconstruct photometry measurements into a smooth spectrum
reconstructed = ac.spectral_reconstruction(photospectrum_BVR, requested_wavelengths=[400, 700])
- Convert measurements directly between photometric systems
sloan_system = ac.FilterSet.get('SLOAN_SDSS.g', 'SLOAN_SDSS.r')
photospectrum_gr = ac.observe(photospectrum_BVR, sloan_system)
- Work on your wavelengths
custom_filter_set = ac.Filter.monochromatic(656.279) | ac.Filter.monochromatic(486.135)
- Calculate true colors
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.maximize_brightness = True
color_html = color_rgb.to_html()
- Model spectra
bb_3000K = ac.BlackBodyModel(3000).determine_at_wavelengths([400, 700])
- Process images via spectral cube reconstruction
# coming soon after debugging
- Error propagation with covariance matrices
# coming soon after debugging
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 astrocolor-0.1.0.tar.gz.
File metadata
- Download URL: astrocolor-0.1.0.tar.gz
- Upload date:
- Size: 104.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e9e21cdf5ed65d58d625299d1426c37625b2d89604760b0884b499210ccabef
|
|
| MD5 |
acbd59acce2a06e5e2f609f3cede7f91
|
|
| BLAKE2b-256 |
900742f19f486b5bd90511cb893b2e44dd3d103b13829ffa8623ef730bbf7c0d
|
File details
Details for the file astrocolor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: astrocolor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 111.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c735c47ad9b7476868139001a1819e3ed7665ea0c9b05fd24849c38ead8df455
|
|
| MD5 |
fee04b977ff544711047698d9a3e3c88
|
|
| BLAKE2b-256 |
f5e15308331e3a0c61afdc0220c8d41956e09518ce521eb9e78634433a8c1f75
|