colorsynth
A Python library for creating false-color images from spectral cubes: 3D Numpy arrays with two spatial axes and one spectral axis.
colorsynth collapses the spectral axis into red, green, and blue channels
by mapping the spectrum into the human visible range and weighting it by the
CIE 1931 color-matching functions.
The shape of the spectrum controls the hue of each pixel, and the total
intensity controls its brightness, so features like Doppler shifts are
visible directly in the image.
Installation
colorsynth is available on the Python Package Index and can be installed using pip:
pip install colorsynth
Quickstart
Define a spectral cube containing a Gaussian emission line at every point,
with a center wavelength that increases from left to right and a total
intensity that increases from top to bottom, and collapse it into an RGB
image using
colorsynth.rgb():
import numpy as np
import matplotlib.pyplot as plt
import astropy.units as u
import colorsynth
# Define a wavelength grid for the spectral axis
wavelength = np.linspace(400, 700, num=61) * u.nm
# Define a spatial grid
x = np.linspace(0, 1, num=101)[:, np.newaxis, np.newaxis]
y = np.linspace(0, 1, num=101)[np.newaxis, :, np.newaxis]
# Define a spectral cube containing a Gaussian emission line at every point
center = 420 * u.nm + (680 - 420) * u.nm * y
width = 15 * u.nm
spd = x * np.exp(-np.square((wavelength - center) / width))
# Collapse the wavelength axis of the cube into RGB channels
rgb = colorsynth.rgb(spd, wavelength, axis=~0, spd_min=0, spd_max=1)
# Display the result as a false-color image
plt.imshow(rgb)
plt.show()
The center wavelength of the emission line appears as hue, and its total intensity appears as brightness.
Gallery
An Si IV 1403 A spectroheliogram captured by the Interface Region Imaging Spectrograph and colorized using
colorsynth.rgb().
The code to create this image can be found in the documentation.
Metadata
Release files for colorsynth 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| colorsynth-1.1.1.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| colorsynth-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.5 kB
Release files / colorsynth-1.1.1.tar.gz
| Download URL | colorsynth-1.1.1.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75ac1c186fb25ca3921bf6a43a156385c19a8b18446144a29eb809264c5896ab
|
|
BLAKE2b-256 checksum How to use checksums |
bef2f65197a8abd57b41c0d017567713889d419517959a6ee5e2a13487fab321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency logRelease files / colorsynth-1.1.1-py3-none-any.whl
| Download URL | colorsynth-1.1.1-py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d0e1e76562079c1def5ae5950c2e01acd0c15c5226afdc36a02da067ede9393
|
|
BLAKE2b-256 checksum How to use checksums |
afeb0ef9a9e4b7b237733e0c8dcf7e30525e904f344bad47ea2c59232afc3a70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 29, 2026.
Transparency log