Maps amino-acid charge at neutral pH to colors. 
    Currently does not use the keyword arguments for *maptype*
    or *reverse* but accepts these arguments to be consistent
    with KyteDoolittleColorMapping and MWColorMapping for now.
354137
def ChargeColorMapping(maptype='jet', reverse=False):
    """"""

    pos_color = '#FF0000'
    neg_color = '#0000FF'
    neut_color = '#000000'

    mapping_d = {'A':neut_color,'R':pos_color,'N':neut_color,\
                 'D':neg_color,'C':neut_color,'Q':neut_color,\
                 'E':neg_color,'G':neut_color,'H':pos_color,\
                 'I':neut_color,'L':neut_color,'K':pos_color,\
                 'M':neut_color,'F':neut_color,'P':neut_color,\
                 'S':neut_color,'T':neut_color,'W':neut_color,\
                 'Y':neut_color,'V':neut_color}

    return (None, mapping_d, None)
566447
def _pop_colors_and_alpha(glyphclass, kwargs, prefix="", default_alpha=1.0):
    
    result = dict()

    # TODO: The need to do this and the complexity of managing this kind of
    # thing throughout the codebase really suggests that we need to have
    # a real stylesheet class, where defaults and Types can declaratively
    # substitute for this kind of imperative logic.
    color = kwargs.pop(prefix + "color", get_default_color())
    for argname in ("fill_color", "line_color"):
        if argname not in glyphclass.properties():
            continue
        result[argname] = kwargs.pop(prefix + argname, color)

    # NOTE: text fill color should really always default to black, hard coding
    # this here now until the stylesheet solution exists
    if "text_color" in glyphclass.properties():
        result["text_color"] = kwargs.pop(prefix + "text_color", "black")

    alpha = kwargs.pop(prefix + "alpha", default_alpha)
    for argname in ("fill_alpha", "line_alpha", "text_alpha"):
        if argname not in glyphclass.properties():
            continue
        result[argname] = kwargs.pop(prefix + argname, alpha)

    return result
236951
def _invert(color, **kwargs):
    
    col = ColorValue(color)
    args = [
        255.0 - col.value[0],
        255.0 - col.value[1],
        255.0 - col.value[2],
        col.value[3],
    ]
    inverted = ColorValue(args)
    return inverted
1005276
def getColorMapAsContinuousSLD(self, nodata=-9999):
        
        colorMap = ET.Element('ColorMap', type='interval')

        # Add a line for the no-data values (nv)
        ET.SubElement(colorMap, 'ColorMapEntry', color='#000000', quantity=str(nodata), label='NoData', opacity='0.0')

        def get_label_formatter(value):
            label_tag="{label:.0f}"
            if abs(value) < 0.01 and value != 0:
                label_tag = "{label:.2E}"
            elif abs(value) < 10:
                label_tag="{label:.2f}"
            elif abs(value) < 99:
                label_tag="{label:.1f}"
            return label_tag

        if self.min != self.max and self.slope > 0:
            for rampIndex in range(len(self.colorRamp)):
                valueForIndex = (rampIndex - self.intercept) / self.slope
                red, green, blue = self.colorRamp[rampIndex]
                hexRGB = '#%02X%02X%02X' % (red,
                                            green,
                                            blue)

                label_tag = get_label_formatter(valueForIndex)
                ET.SubElement(colorMap, 'ColorMapEntry', color=hexRGB,
                              quantity=str(valueForIndex),
                              label=label_tag.format(label=valueForIndex),
                              opacity=str(self.alpha))
        else:
            valueForIndex = self.max
            red, green, blue = self.colorRamp[0]
            hexRGB = '#%02X%02X%02X' % (red,
                                        green,
                                        blue)
            label_tag = get_label_formatter(valueForIndex)
            ET.SubElement(colorMap, 'ColorMapEntry', color=hexRGB,
                          quantity=str(valueForIndex),
                          label=label_tag.format(label=valueForIndex),
                          opacity=str(self.alpha))


        return ET.tostring(colorMap)
1087624
public ByteBuffer interpolateColorMap( int mapType, ByteBuffer data, int dataOffset ) {
        int dataLength = data.capacity() - dataOffset;
        /* Allocate colour map output buffer using 4 bytes per cell value (RGBA) */
        ByteBuffer cmapBuffer = ByteBuffer.allocate(dataLength);

        /* Set buffer position */
        data.position(dataOffset);

        if (mapType > 0) {
            while( data.hasRemaining() ) {
                /*
                 * For each value in the array get the index from the rules map and then translate
                 * the rule.
                 */
                int f = data.getInt();

                cmapBuffer.put(f == Integer.MAX_VALUE ? blank : getColor((float) f));
            }
        } else if (mapType == -1) {
            while( data.hasRemaining() ) {
                /*
                 * For each value in the array get the index from the rules map and then translate
                 * the rule.
                 */
                float f = data.getFloat();
                cmapBuffer.put(Float.isNaN(f) ? blank : getColor(f));
            }
        } else if (mapType == -2) {
            while( data.hasRemaining() ) {
                /*
                 * For each value in the array get the index from the rules map and then translate
                 * the rule.
                 */
                float f = (float) data.getDouble();
                cmapBuffer.put(Float.isNaN(f) ? blank : getColor(f));

                // if (!Float.isNaN(f) && f > 0)
                // System.out.println("COLOR-TABLE->" + f + " has color "
                // + (Float.isNaN(f) ? blank : getColor(f)));

                /*
                 * test the data map
                 */
                /*
                 * System.out.print(f + " "); if (counter == 1024) { System.out.println(); counter =
                 * 1; } else { counter++; }
                 */

            }
        }
        return cmapBuffer;
    }
446450
def colorize(self, colormap):
        

        if self.mode not in ("L", "LA"):
            raise ValueError("Image should be grayscale to colorize")
        if self.mode == "LA":
            alpha = self.channels[1]
        else:
            alpha = None
        self.channels = colormap.colorize(self.channels[0])
        if alpha is not None:
            self.channels.append(alpha)
            self.mode = "RGBA"
        else:
            self.mode = "RGB"
473414
public static <K, V> MutableMap<V, K> reverseMapping(Map<K, V> map)
    {
        final MutableMap<V, K> reverseMap = UnifiedMap.newMap(map.size());
        MapIterate.forEachKeyValue(map, new Procedure2<K, V>()
        {
            public void value(K sourceKey, V sourceValue)
            {
                reverseMap.put(sourceValue, sourceKey);
            }
        });
        return reverseMap;
    }
890559
def color_map_data(self, data: numpy.ndarray) -> None:
        
        self.__color_map_data = data
        self.update()
321438
def assert_wildtype_matches(self, mutation):
        ''''''
        readwt = self.getAminoAcid(self.getAtomLine(mutation.Chain, mutation.ResidueID))
        assert(mutation.WildTypeAA == residue_type_3to1_map[readwt])
775296
function ( color, type ) {
            switch ( type ) {
                case 'rgb':
                    return this.toRgb( color );
                    break;
                case 'rgba':
                    return this.toRgba( color );
                    break;
                case 'hsl':
                    return this.toHsl( color );
                    break;
                case 'hsla':
                    return this.toHsla( color );
                    break;
                default:
                    return this.toHex( color );
                    break;
            }
        }
852345
def lookup_color(p_color):
    
    if not lookup_color.colors:
        lookup_color.colors[AbstractColor.NEUTRAL] = Color('NEUTRAL')
        lookup_color.colors[AbstractColor.PROJECT] = config().project_color()
        lookup_color.colors[AbstractColor.CONTEXT] = config().context_color()
        lookup_color.colors[AbstractColor.META] = config().metadata_color()
        lookup_color.colors[AbstractColor.LINK] = config().link_color()

    try:
        return lookup_color.colors[p_color]
    except KeyError:
        return p_color
700102
def _map(value, istart, istop, ostart, ostop):
    
    return ostart + (ostop - ostart) * ((value - istart) / (istop - istart))
161895
def set_amino_acid(self, aa):
        """"""
        aa = aa.upper()  # make sure it is upper case
        aa = aa[2:] if aa.startswith('P.') else aa  # strip "p."
        self.__set_mutation_status()  # set flags detailing the type of mutation
        self.__parse_hgvs_syntax(aa)
308907
@java.lang.Deprecated
  public java.util.Map<java.lang.String, com.google.cloud.datalabeling.v1beta1.AnnotationSpec>
      getAnnotationColors() {
    return getAnnotationColorsMap();
  }
956942
def parse_map_Ks(self):
        """"""
        Kd = os.path.join(self.dir, " ".join(self.values[1:]))
        self.this_material.set_texture_specular_color(Kd)
1182236
def _Backward3_T_Ph(P, h):
    
    hf = _h_3ab(P)
    if h <= hf:
        T = _Backward3a_T_Ph(P, h)
    else:
        T = _Backward3b_T_Ph(P, h)
    return T
521431
def colorize(img, heatmap):
    
    heatmap = viz.intensity_to_rgb(heatmap, cmap='jet')[:, :, ::-1]
    return img * 0.5 + heatmap * 0.5