Reproducing SAOImageDS9 Colormap in Python
Project description
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 ds9_norm
Usage
from astromy_ds9 import ds9norm
import astropy
import matplotlib.pyplot as plt
data = astropy.io.fits.getdata('https://github.com/glue-viz/ds9norm/raw/master/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.
vmin
andvmax
: you can find the values inScale
->Scale Parameters
-> Below the histogram, Low isvmin
and High isvmax
.bias
andcontrast
: you can find the values inColor
->Color Parameters
stretch
: 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.
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
File details
Details for the file astromy_ds9-0.0.1.tar.gz
.
File metadata
- Download URL: astromy_ds9-0.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4b5411f4162aa60fcee5b9a26f6a82c1a7e6e8d49c46dc5995fcfe6b6071643 |
|
MD5 | 4fb9fa7afc868c7fde6ae01eae357c88 |
|
BLAKE2b-256 | c947b1ccd9c4c53940d9875a8192425d3fdad73b7fec64ec9fdab7bc999c332b |
File details
Details for the file astromy_ds9-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: astromy_ds9-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8343732702427adfab4e076045a8b41a146a4203f0431736cf75c12c773fbcbf |
|
MD5 | 214e5ea52abb836fbafd0265e98a39b3 |
|
BLAKE2b-256 | 8ed6b94613c3291340d0a9e51b18bb515a7ebf0b1373748b2d955bf9a8f68b97 |