diff --git a/nifty2go/plotting/plot.py b/nifty2go/plotting/plot.py index de5c2c1797f8b9d43656e21b90ffbc901335506e..7f01d09a11f43808f3af0dbee5437f7b40b11bdb 100644 --- a/nifty2go/plotting/plot.py +++ b/nifty2go/plotting/plot.py @@ -82,6 +82,7 @@ def _limit_xy(**kwargs): y2 = kwargs.get("ymax") plt.axis((x1, x2, y1, y2)) + def _register_cmaps(): try: if _register_cmaps._cmaps_registered: @@ -91,45 +92,45 @@ def _register_cmaps(): from matplotlib.colors import LinearSegmentedColormap import matplotlib.pyplot as plt - planckcmap = {'red': ((0.0, 0.0, 0.0), - (0.4, 0.0, 0.0), - (0.5, 1.0, 1.0), - (0.7, 1.0, 1.0), - (0.8, 0.83, 0.83), - (0.9, 0.67, 0.67), - (1.0, 0.5, 0.5)), - 'green':((0.0, 0.0, 0.0), - (0.2, 0.0, 0.0), - (0.3, 0.3, 0.3), - (0.4, 0.7, 0.7), - (0.5, 1.0, 1.0), - (0.6, 0.7, 0.7), - (0.7, 0.3, 0.3), - (0.8, 0.0, 0.0), - (1.0, 0.0, 0.0)), - 'blue': ((0.0, 0.5, 0.5), - (0.1, 0.67, 0.67), - (0.2, 0.83, 0.83), - (0.3, 1.0, 1.0), - (0.5, 1.0, 1.0), - (0.6, 0.0, 0.0), - (1.0, 0.0, 0.0)) } - he_cmap = { 'red': ((0.0, 0.0, 0.0), + planckcmap = {'red': ((0.0, 0.0, 0.0), + (0.4, 0.0, 0.0), + (0.5, 1.0, 1.0), + (0.7, 1.0, 1.0), + (0.8, 0.83, 0.83), + (0.9, 0.67, 0.67), + (1.0, 0.5, 0.5)), + 'green': ((0.0, 0.0, 0.0), + (0.2, 0.0, 0.0), + (0.3, 0.3, 0.3), + (0.4, 0.7, 0.7), + (0.5, 1.0, 1.0), + (0.6, 0.7, 0.7), + (0.7, 0.3, 0.3), + (0.8, 0.0, 0.0), + (1.0, 0.0, 0.0)), + 'blue': ((0.0, 0.5, 0.5), + (0.1, 0.67, 0.67), + (0.2, 0.83, 0.83), + (0.3, 1.0, 1.0), + (0.5, 1.0, 1.0), + (0.6, 0.0, 0.0), + (1.0, 0.0, 0.0))} + he_cmap = {'red': ((0.0, 0.0, 0.0), (0.167, 0.0, 0.0), (0.333, 0.5, 0.5), (0.5, 1.0, 1.0), (1.0, 1.0, 1.0)), - 'green':((0.0, 0.0, 0.0), + 'green': ((0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (0.667, 0.5, 0.5), (0.833, 1.0, 1.0), (1.0, 1.0, 1.0)), - 'blue': ((0.0, 0.0, 0.0), + 'blue': ((0.0, 0.0, 0.0), (0.167, 1.0, 1.0), (0.333, 0.5, 0.5), (0.5, 0.0, 0.0), - (1.0, 1.0, 1.0)) } - fd_cmap = { 'red': ((0.0, 0.35, 0.35), + (1.0, 1.0, 1.0))} + fd_cmap = {'red': ((0.0, 0.35, 0.35), (0.1, 0.4, 0.4), (0.2, 0.25, 0.25), (0.41, 0.47, 0.47), @@ -140,7 +141,7 @@ def _register_cmaps(): (0.8, 0.8, 0.8), (0.9, 0.5, 0.5), (1.0, 0.4, 0.4)), - 'green':((0.0, 0.0, 0.0), + 'green': ((0.0, 0.0, 0.0), (0.2, 0.0, 0.0), (0.362, 0.88, 0.88), (0.5, 1.0, 1.0), @@ -148,7 +149,7 @@ def _register_cmaps(): (0.8, 0.25, 0.25), (0.9, 0.3, 0.3), (1.0, 0.2, 0.2)), - 'blue': ((0.0, 0.35, 0.35), + 'blue': ((0.0, 0.35, 0.35), (0.1, 0.4, 0.4), (0.2, 0.8, 0.8), (0.26, 0.8, 0.8), @@ -157,43 +158,43 @@ def _register_cmaps(): (0.5, 0.8, 0.8), (0.59, 0.47, 0.47), (0.8, 0.0, 0.0), - (1.0, 0.0, 0.0)) } - fdu_cmap= { 'red': ((0.0, 1.0, 1.0), - (0.1, 0.8, 0.8), - (0.2, 0.65, 0.65), - (0.41, 0.6, 0.6), - (0.5, 0.7, 0.7), - (0.56, 0.96, 0.96), - (0.59, 1.0, 1.0), - (0.74, 0.8, 0.8), - (0.8, 0.8, 0.8), - (0.9, 0.5, 0.5), - (1.0, 0.4, 0.4)), - 'green':((0.0, 0.9, 0.9), - (0.2, 0.65, 0.65), - (0.362, 0.95, 0.95), - (0.5, 1.0, 1.0), - (0.638, 0.88, 0.88), - (0.8, 0.25, 0.25), - (0.9, 0.3, 0.3), - (1.0, 0.2, 0.2)), - 'blue': ((0.0, 1.0, 1.0), - (0.1, 0.8, 0.8), - (0.2, 1.0, 1.0), - (0.41, 1.0, 1.0), - (0.44, 0.96, 0.96), - (0.5, 0.7, 0.7), - (0.59, 0.42, 0.42), - (0.8, 0.0, 0.0), - (1.0, 0.0, 0.0)) } - pm_cmap = { 'red': ((0.0, 1.0, 1.0), + (1.0, 0.0, 0.0))} + fdu_cmap = {'red': ((0.0, 1.0, 1.0), + (0.1, 0.8, 0.8), + (0.2, 0.65, 0.65), + (0.41, 0.6, 0.6), + (0.5, 0.7, 0.7), + (0.56, 0.96, 0.96), + (0.59, 1.0, 1.0), + (0.74, 0.8, 0.8), + (0.8, 0.8, 0.8), + (0.9, 0.5, 0.5), + (1.0, 0.4, 0.4)), + 'green': ((0.0, 0.9, 0.9), + (0.2, 0.65, 0.65), + (0.362, 0.95, 0.95), + (0.5, 1.0, 1.0), + (0.638, 0.88, 0.88), + (0.8, 0.25, 0.25), + (0.9, 0.3, 0.3), + (1.0, 0.2, 0.2)), + 'blue': ((0.0, 1.0, 1.0), + (0.1, 0.8, 0.8), + (0.2, 1.0, 1.0), + (0.41, 1.0, 1.0), + (0.44, 0.96, 0.96), + (0.5, 0.7, 0.7), + (0.59, 0.42, 0.42), + (0.8, 0.0, 0.0), + (1.0, 0.0, 0.0))} + pm_cmap = {'red': ((0.0, 1.0, 1.0), (0.1, 0.96, 0.96), (0.2, 0.84, 0.84), (0.3, 0.64, 0.64), (0.4, 0.36, 0.36), (0.5, 0.0, 0.0), (1.0, 0.0, 0.0)), - 'green':((0.0, 0.5, 0.5), + 'green': ((0.0, 0.5, 0.5), (0.1, 0.32, 0.32), (0.2, 0.18, 0.18), (0.3, 0.08, 0.08), @@ -204,18 +205,19 @@ def _register_cmaps(): (0.8, 0.18, 0.18), (0.9, 0.32, 0.32), (1.0, 0.5, 0.5)), - 'blue': ((0.0, 0.0, 0.0), + 'blue': ((0.0, 0.0, 0.0), (0.5, 0.0, 0.0), (0.6, 0.36, 0.36), (0.7, 0.64, 0.64), (0.8, 0.84, 0.84), (0.9, 0.96, 0.96), - (1.0, 1.0, 1.0)) } + (1.0, 1.0, 1.0))} plt.register_cmap(cmap=LinearSegmentedColormap("Planck-like", planckcmap)) plt.register_cmap(cmap=LinearSegmentedColormap("High Energy", he_cmap)) plt.register_cmap(cmap=LinearSegmentedColormap("Faraday Map", fd_cmap)) - plt.register_cmap(cmap=LinearSegmentedColormap("Faraday Uncertainty", fdu_cmap)) + plt.register_cmap(cmap=LinearSegmentedColormap("Faraday Uncertainty", + fdu_cmap)) plt.register_cmap(cmap=LinearSegmentedColormap("Plus Minus", pm_cmap)) diff --git a/nifty2go/spaces/power_space/power_space.py b/nifty2go/spaces/power_space/power_space.py index 62657069f5e3a37b85d6f9b88f6d6743ae124aa5..f07baa84c172f1505005090c875204699b0265bd 100644 --- a/nifty2go/spaces/power_space/power_space.py +++ b/nifty2go/spaces/power_space/power_space.py @@ -156,8 +156,7 @@ class PowerSpace(Space): key = (harmonic_partner, binbounds) if self._powerIndexCache.get(key) is None: - distance_array = \ - self.harmonic_partner.get_distance_array() + distance_array = self.harmonic_partner.get_distance_array() temp_pindex = self._compute_pindex( harmonic_partner=self.harmonic_partner, distance_array=distance_array,