Reproducing SAOImageDS9 Colormap in Python
SAOImageDS9 is an image display and visualization tool for astronomical data, which can be used for fast image processing and inspection. In DS9, we can drag the mouse on the image viewer to manipulate the colormap and then visualize data effectively and quickly. Unlike the DS9, color normalization and stretch in Python should be set manually.
Here we take notes about how to reproduce the colormap of DS9 in Python, supposing that you have already tuned the colormap parameters in DS9.
Installation
pip install astromy_ds9
Usage
from astromy_ds9 import ds9_norm
import astropy
import matplotlib.pyplot as plt
data = astropy.io.fits.getdata('https://github.com/lmytime/Reproduce_DS9_colormap_in_Python/raw/main/doc/data/m51.fits')
norm = ds9_norm(vmin=3053.38, vmax=13513.9, bias=0.581921, contrast=0.890152, stretch='sqrt')
plt.imshow(data, norm=norm, cmap='gray', origin='lower', interpolation='None')
There are 5 input parameters for ds9_norm function.
vminandvmax: you can find the values inScale->Scale Parameters-> Below the histogram, Low isvminand High isvmax.biasandcontrast: you can find the values inColor->Color Parametersstretch: you can find it inScale-> see which one is marked with a check mark. Allowed values are 'linear' | 'log' | 'sqrt' | 'power' | 'squared' | 'asinh' | 'sinh'.
Check example code in test and example.
Methodology
Please check the methodology in doc. Also see ds9norm for reference.
Citation
If you find this useful, please acknowledge.
Metadata
Release files for astromy-ds9 1.0.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 | Provenance | Actions |
|---|---|---|---|---|
| astromy_ds9-1.0.1.tar.gz | 5.5 kB | Without provenance | Details for astromy_ds9-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| astromy_ds9-1.0.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for astromy_ds9-1.0.1-py2.py3-none-any.whl |
Total release size: 10.4 kB
Release files / astromy_ds9-1.0.1.tar.gz
| Download URL | astromy_ds9-1.0.1.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2d87ca61e7e577ea88db7cd4d2d610fc141134ac64013f0e4ff6dad922bf8f1
|
|
BLAKE2b-256 checksum How to use checksums |
4b8676f2510d47dbd46605a283e01c3aed3220d27e47f5a525bdc29b405345e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / astromy_ds9-1.0.1-py2.py3-none-any.whl
| Download URL | astromy_ds9-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
9537b8b58fb9c81a41c9073bf78b9151b1e0726d7fb8e98443099606ffc90a46
|
|
BLAKE2b-256 checksum How to use checksums |
cddb86a8ae3d4612e03b9312d5bdef3734dc37f796d2f31b4ef1b5c436659112
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for astromy-ds9 1.0.1
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.