SpaceTelescopeColorImage tools for astronomy cutouts.
Project description
STCI
STCI stands for SpaceTelescopeColorImage.
STCI is a small astronomy image-composition tool for making display-ready color JPEGs or 16-bit TIFFs from space telescope cutouts and other aligned mono images.
Installation
pip install STCI
The installed Python import module is STCI.
Example usage
mk_colorimg creates one color image from either a 3-channel RGB array or three mono images in (R, G, B) order. For Euclid-style color images, the default mapping is NIR_J, NIR_Y, VIS.
from STCI import mk_colorimg
mk_colorimg(
[
"cutout_H.fits", # R channel
"cutout_VIS.fits", # G channel
"cutout_Y.fits", # B channel
],
output_jpg="target_mtf_vis_y_h.jpg",
input_mode="raw",
ReplaceL=False,
reference_ROI=200,
)
For a NumPy RGB cube:
from STCI import mk_colorimg
mk_colorimg(rgb_array, output_jpg="target_color.jpg", input_mode="normalized")
Use a .tif or .tiff output filename to write a 16-bit TIFF instead of an 8-bit JPEG:
mk_colorimg(rgb_array, output_jpg="target_color.tiff", input_mode="normalized")
Set ReplaceL=False to skip replacing the CIELab L* channel with the stretched blue luminosity channel. By default, mk_colorimg keeps the original replacement behavior.
Set reference_ROI=200 to estimate the raw normalization, color calibration, and STF/HT stretch from the centered 200 x 200 pixel region, then apply those settings to the full image. By default, reference_ROI=None estimates from the full image.
Single-Band MTF Image
mk_monoimg creates one grayscale image from a single mono image. It uses the same MTF-style stretch as mk_colorimg, but omits RGB-only steps such as color calibration, Lab luminance replacement, SCNR, and saturation.
from STCI import mk_monoimg
mk_monoimg(
"cutout_VIS.fits",
output_jpg="target_vis_mtf.jpg",
input_mode="raw",
)
For a NumPy mono image:
from STCI import mk_monoimg
mk_monoimg(mono_array, output_jpg="target_mono.jpg", input_mode="normalized")
Download a Euclid Color Image
Euclidimg downloads Euclid DR1 VIS, NIR_Y, NIR_J, and NIR_H FITS cutouts, then renders one color image using the NIR_J / NIR_Y / VIS channel order.
from STCI import Euclidimg
result = Euclidimg(
ra=50.7163333,
dec=-39.7693889,
size=5.0,
path="euclid_color",
cred="Euclid/cred.txt",
output_jpg="EUCLJ032251.92-394609.8.jpg",
ReplaceL=True,
RGB="auto",
reference_ROI=None,
)
print(result["jpg"])
print(result["fits"])
print(result["rgb_bands"])
Arguments:
ra,dec: target coordinates in degrees.size: cutout radius in arcsec. For example,size=5.0makes a10" x 10"image.path: output directory for the FITS files and rendered image.cred: Euclid credentials file passed toastroquery.esa.euclid.output_jpg: optional output filename written insidepath; use.tifor.tifffor 16-bit TIFF.ReplaceL: ifFalse, skip replacing the CIELab L* channel with the stretched blue luminosity channel.RGB: Euclid bands in(R, G, B)order. Use"auto"for the default available-band choice, or pass bands such as("NIR_H", "NIR_Y", "VIS")or("H", "Y", "VIS").reference_ROI: optional centered square ROI size, in pixels, used to estimate the display scaling before applying it to the full image.
The returned dictionary contains the selected FITS paths and the final rendered image path. If the first overlapping mosaic tile for a band is empty or all zero, the downloader tries the next matching tile.
Download Euclid FITS Only
from Download_Euclid import EUC_download
fits_paths = EUC_download(
ra=50.7163333,
dec=-39.7693889,
size=5.0,
path="euclid_fits",
cred="Euclid/cred.txt",
)
Project details
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 stci-0.1.3.tar.gz.
File metadata
- Download URL: stci-0.1.3.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26e50fcb0981a992dadae0532d01ed9209978c807c88ce4239fbaf9cf4336396
|
|
| MD5 |
d82829a7d8f2049181d54f06b4fb0c28
|
|
| BLAKE2b-256 |
80b8557ff88dc9e38f83585478388081b0fecba62c5278cdbe5613849ac4c03c
|
File details
Details for the file stci-0.1.3-py3-none-any.whl.
File metadata
- Download URL: stci-0.1.3-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13fe0c530bc4915911c8681031486e09b0ded5489f8ff759522d2842531b105c
|
|
| MD5 |
a220218bd9034d2c441f63bc556d4959
|
|
| BLAKE2b-256 |
41a5d1ca67242d1185f0cc1cdf50f6eb91a95edd805b19a91894f88bd087b0b6
|