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

Uploaded Source

Built Distribution

astromy_ds9-1.0.0-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.0.tar.gz.

File metadata

  • Download URL: astromy_ds9-1.0.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-1.0.0.tar.gz
Algorithm Hash digest
SHA256 20b86ee03323d205e155a89dcdfe9b43cdc6528d520261fe11f89bc22ebef618
MD5 9da6e90c03add196af033e00f2c7ff1b
BLAKE2b-256 e2ed0e0989e3621765115665b2deae3e84e741a8dfa8cf85ebea7689138c6cd8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for astromy_ds9-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fc8219d695e7865ea5884a653f5aaeb0ab40b642361bb053333feef460d8469c
MD5 566c545aa40788c28d629b17c822f9be
BLAKE2b-256 20f8b082445e5890bc192002a9de034a849d6a9bb5f7d28da90af52422273f48

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