Last active
December 14, 2015 21:28
-
-
Save dagss/5151234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PlanckUniversalColormap(Colormap): | |
name = "planckuniv" | |
def __init__(self, cmap): | |
Colormap.__init__(self, "planckuniv-" + cmap.name, cmap.N) | |
self.cmap = cmap | |
self.N = self.cmap.N | |
def __call__(self, xi, alpha=1.0, **kw): | |
x = xi * (1e7+1e3) - 1e3 | |
yi = self.modsinh(x) | |
# range 0-1 | |
yi = (yi + 3)/10. | |
return self.cmap(yi, alpha) | |
def modsinh(self, x): | |
return np.log10(0.5*(x + np.sqrt(x**2 + 4))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment