colormaps.py 4.84 KB
Newer Older
Martin Reinecke's avatar
Martin Reinecke committed
1
from ..colormap.colormap import Colormap
Theo Steininger's avatar
Theo Steininger committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209


def HighEnergyCmap():
    """
        Returns a color map often used in High Energy Astronomy.
    """

    red = [(0.0, 0.0),
           (0.167, 0.0),
           (0.333, 0.5),
           (0.5, 1.0),
           (0.667, 1.0),
           (0.833, 1.0),
           (1.0, 1.0)]

    green = [(0.0, 0.0),
             (0.167, 0.0),
             (0.333, 0.0),
             (0.5, 0.0),
             (0.667, 0.5),
             (0.833, 1.0),
             (1.0, 1.0)]

    blue = [(0.0, 0.0),
            (0.167, 1.0),
            (0.333, 0.5),
            (0.5, 0.0),
            (0.667, 0.0),
            (0.833, 0.0),
            (1.0, 1.0)]
    return Colormap("High Energy", red, green, blue)


def FaradayMapCmap():
    """
        Returns a color map used in reconstruction of the "Faraday Map".

        References
        ----------
        .. [#] N. Opermann et. al.,
            "An improved map of the Galactic Faraday sky",
            Astronomy & Astrophysics, Volume 542, id.A93, 06/2012;
            `arXiv:1111.6186 <http://www.arxiv.org/abs/1111.6186>`_
    """
    red = [(0.0, 0.35),
           (0.1, 0.4),
           (0.2, 0.25),
           (0.41, 0.47),
           (0.5, 0.8),
           (0.56, 0.96),
           (0.59, 1.0),
           (0.74, 0.8),
           (0.8, 0.8),
           (0.9, 0.5),
           (1.0, 0.4)]

    green = [(0.0, 0.0),
             (0.2, 0.0),
             (0.362, 0.88),
             (0.5, 1.0),
             (0.638, 0.88),
             (0.8, 0.25),
             (0.9, 0.3),
             (1.0, 0.2)]

    blue = [(0.0, 0.35),
            (0.1, 0.4),
            (0.2, 0.8),
            (0.26, 0.8),
            (0.41, 1.0),
            (0.44, 0.96),
            (0.5, 0.8),
            (0.59, 0.47),
            (0.8, 0.0),
            (1.0, 0.0)]

    return Colormap("Faraday Map", red, green, blue)


def FaradayUncertaintyCmap():
    """
        Returns a color map used for the "Faraday Map Uncertainty".

        References
        ----------
        .. [#] N. Opermann et. al.,
            "An improved map of the Galactic Faraday sky",
            Astronomy & Astrophysics, Volume 542, id.A93, 06/2012;
            `arXiv:1111.6186 <http://www.arxiv.org/abs/1111.6186>`_
    """
    red = [(0.0, 1.0),
           (0.1, 0.8),
           (0.2, 0.65),
           (0.41, 0.6),
           (0.5, 0.7),
           (0.56, 0.96),
           (0.59, 1.0),
           (0.74, 0.8),
           (0.8, 0.8),
           (0.9, 0.5),
           (1.0, 0.4)]

    green = [(0.0, 0.9),
             (0.2, 0.65),
             (0.362, 0.95),
             (0.5, 1.0),
             (0.638, 0.88),
             (0.8, 0.25),
             (0.9, 0.3),
             (1.0, 0.2)]

    blue = [(0.0, 1.0),
            (0.1, 0.8),
            (0.2, 1.0),
            (0.41, 1.0),
            (0.44, 0.96),
            (0.5, 0.7),
            (0.59, 0.42),
            (0.8, 0.0),
            (1.0, 0.0)]

    return Colormap("Faraday Uncertainty", red, green, blue)


def PlusMinusCmap():
    """
        Returns a color map useful for a zero-centerd range of values.
    """
    red = [(0.0, 1.0),
           (0.1, 0.96),
           (0.2, 0.84),
           (0.3, 0.64),
           (0.4, 0.36),
           (0.5, 0.0),
           (0.6, 0.0),
           (0.7, 0.0),
           (0.8, 0.0),
           (0.9, 0.0),
           (1.0, 0.0)]

    green = [(0.0, 0.5),
             (0.1, 0.32),
             (0.2, 0.18),
             (0.3, 0.08),
             (0.4, 0.02),
             (0.5, 0.0),
             (0.6, 0.02),
             (0.7, 0.08),
             (0.8, 0.18),
             (0.9, 0.32),
             (1.0, 0.5)]

    blue = [(0.0, 0.0),
            (0.1, 0.0),
            (0.2, 0.0),
            (0.3, 0.0),
            (0.4, 0.0),
            (0.5, 0.0),
            (0.6, 0.36),
            (0.7, 0.64),
            (0.8, 0.84),
            (0.9, 0.96),
            (1.0, 1.0)]

    return Colormap("Plus Minus", red, green, blue)


def PlankCmap():
    """
        Returns a color map similar to the one used for the "Planck CMB Map".
    """
    red = [(0.0, 0.0),
           (0.1, 0.0),
           (0.2, 0.0),
           (0.3, 0.0),
           (0.4, 0.0),
           (0.5, 1.0),
           (0.6, 1.0),
           (0.7, 1.0),
           (0.8, 0.83),
           (0.9, 0.67),
           (1.0, 0.5)]

    green = [(0.0, 0.0),
             (0.1, 0.0),
             (0.2, 0.0),
             (0.3, 0.3),
             (0.4, 0.7),
             (0.5, 1.0),
             (0.6, 0.7),
             (0.7, 0.3),
             (0.8, 0.0),
             (0.9, 0.0),
             (1.0, 0.0)]

    blue = [(0.0, 0.5),
            (0.1, 0.67),
            (0.2, 0.83),
            (0.3, 1.0),
            (0.4, 1.0),
            (0.5, 1.0),
            (0.6, 0.0),
            (0.7, 0.0),
            (0.8, 0.0),
            (0.9, 0.0),
            (1.0, 0.0)]

    return Colormap("Planck-like", red, green, blue)