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 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 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-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: astromy_ds9-0.1.0.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-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2daf006335f0f9d0df936ccc46445b2f24f00771d61f59536738132fa66478f
MD5 b40346e33f9b220bd17a7bba6cd36138
BLAKE2b-256 0d418ef4d2b2c8abc26d7fa4c43919e653a04c25fda40b92cb37457f34557a28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astromy_ds9-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1ccc76c226e1139f7a8d3299bd0cb1a8947de841600e8b622aa0e26346075ea1
MD5 a074588f0cfa354a428ba22fec6766a5
BLAKE2b-256 30418f2ca2e49dcdbe857654450bc52f04e9bbe00492d1f8dfdd8ee53e8e8789

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