Skip to main content

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 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.

  • vmin and vmax: you can find the values in Scale -> Scale Parameters -> Below the histogram, Low is vmin and High is vmax.
  • bias and contrast: you can find the values in Color -> Color Parameters
  • stretch: you can find it in Scale -> see which one is marked with a check mark. Allowed values are 'linear' | 'log' | 'sqrt' | 'power' | 'squared' | 'asinh' | 'sinh'.
help

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

astromy_ds9-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

astromy_ds9-1.0.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file astromy_ds9-1.0.1.tar.gz.

File metadata

  • Download URL: astromy_ds9-1.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

Hashes for astromy_ds9-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c2d87ca61e7e577ea88db7cd4d2d610fc141134ac64013f0e4ff6dad922bf8f1
MD5 a72353813fef208cd7a9933a89a333c9
BLAKE2b-256 4b8676f2510d47dbd46605a283e01c3aed3220d27e47f5a525bdc29b405345e5

See more details on using hashes here.

File details

Details for the file astromy_ds9-1.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for astromy_ds9-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9537b8b58fb9c81a41c9073bf78b9151b1e0726d7fb8e98443099606ffc90a46
MD5 ebf5e3f32a0c03df635c1cd9de9905ec
BLAKE2b-256 cddb86a8ae3d4612e03b9312d5bdef3734dc37f796d2f31b4ef1b5c436659112

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page