[Yt-svn] commit/yt: MatthewTurk: Adding cubehelix colormap, based on patch from Pim Schellart and astro-ph/1108.5083

Bitbucket commits-noreply at bitbucket.org
Fri Sep 9 08:51:37 PDT 2011


1 new changeset in yt:

http://bitbucket.org/yt_analysis/yt/changeset/fbd2c0132d35/
changeset:   fbd2c0132d35
branch:      yt
user:        MatthewTurk
date:        2011-09-09 17:51:19
summary:     Adding cubehelix colormap, based on patch from Pim Schellart and astro-ph/1108.5083
affected #:  1 file (1.0 KB)

--- a/yt/visualization/color_maps.py	Thu Sep 08 14:07:26 2011 -0400
+++ b/yt/visualization/color_maps.py	Fri Sep 09 11:51:19 2011 -0400
@@ -105,6 +105,25 @@
 
 add_cmap('black_green', cdict)
 
+# This one comes from
+# http://permalink.gmane.org/gmane.comp.python.matplotlib.devel/10518
+# and is an implementation of http://arxiv.org/abs/1108.5083
+#
+
+# cubehelix parameters
+_gamma_cubehelix = 1.0
+_s_cubehelix = 0.5
+_r_cubehelix = -1.5
+_h_cubehelix = 1.0
+
+_cubehelix_data = {
+        'red': lambda x: x**_gamma_cubehelix + (_h_cubehelix * x**_gamma_cubehelix * (1 - x**_gamma_cubehelix) / 2) * (-0.14861 * na.cos(2 * na.pi * (_s_cubehelix / 3 + _r_cubehelix * x)) + 1.78277 * na.sin(2 * na.pi * (_s_cubehelix / 3 + _r_cubehelix * x))),
+        'green': lambda x: x**_gamma_cubehelix + (_h_cubehelix * x**_gamma_cubehelix * (1 - x**_gamma_cubehelix) / 2) * (-0.29227 * na.cos(2 * na.pi * (_s_cubehelix / 3 + _r_cubehelix * x)) - 0.90649 * na.sin(2 * na.pi * (_s_cubehelix / 3 + _r_cubehelix * x))),
+        'blue': lambda x: x**_gamma_cubehelix + (_h_cubehelix * x**_gamma_cubehelix * (1 - x**_gamma_cubehelix) / 2) * (1.97294 * na.cos(2 * na.pi * (_s_cubehelix / 3 + _r_cubehelix * x))),
+}
+
+add_cmap("cubehelix", _cubehelix_data)
+
 def _extract_lookup_table(cmap_name):
     cmap = mcm.get_cmap(cmap_name)
     if not cmap._isinit: cmap._init()

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list