Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A Matplotlib normalize object that replicates DS9 image stretching

Project Description

This file implements a matplotlib Normalize object which mimics the
functionality of image scaling functions in
`ds9 <>`__. It provides 5 ways of
configuring image scaling:

- Clipping the low and high intensities at specified percentiles
(``clip_lo``, ``clip_hi``)
- Specifying an intensity transfer function for ramping from black to
white (``stretch``)
- Setting the mid-point of this transfer function (``bias``, akin to
dragging the right mouse button left/right in ds9)
- Setting how sharp the transition from black-white is (``contrast``,
akin to dragging the right mouse button up/down in ds9)


See the `example
notebook <>`__

.. code:: python

data = fits.getdata('M51.fits')
norm = DS9Normalize(bias=0.2)
figure, axs = plt.subplots(ncols=3, nrows=3, squeeze=False, tight_layout=True)

for ax, bias in zip(axs[2], [.2, .5, .8]):
ax.imshow(data, norm=DS9Normalize(bias=bias))
ax.set_title('Bias = %0.1f' % bias)

for ax, contrast in zip(axs[1], [0.5, 1, 2]):
ax.imshow(data, norm=DS9Normalize(contrast=contrast))
ax.set_title('Contrast = %0.1f' % contrast)

for ax, stretch in zip(axs[0], ['linear', 'sqrt', 'arcsinh']):
ax.imshow(data, norm=DS9Normalize(stretch=stretch))

.. figure:: gallery.png
:alt: ds9norm demo

ds9norm demo
Build Status

[|Build Status|\ ]
( [|Coverage
Status|\ ] (

.. |Build Status| image::
.. |Coverage Status| image::
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ds9norm-0.1.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Aug 7, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting