tbird.py - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
 (HTM) git clone git://src.adamsgaard.dk/sphere
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tbird.py (2205B)
       ---
            1 '''
            2 A sequential colormap named after a colorful blue-yellow bird.
            3 '''
            4 
            5 import matplotlib
            6 test=True
            7 
            8 cmdict_bird = {\
            9         'red': (
           10             (0.0,   0.20784313725490197,  0.20784313725490197),
           11             (0.125, 0.027450980392156862, 0.027450980392156862),
           12             (0.25,  0.07450980392156863,  0.07450980392156863),
           13             (0.375, 0.0196078431372549,   0.0196078431372549),
           14             (0.5,   0.16470588235294117,  0.16470588235294117),
           15             (0.625, 0.4980392156862745,   0.4980392156862745),
           16             (0.75,  0.7843137254901961,   0.7843137254901961),
           17             (0.875, 0.996078431372549,    0.996078431372549),
           18             (1.0,   0.9725490196078431,   0.9725490196078431)),
           19 
           20         'green': (
           21             (0.0,   0.1647058823529412, 0.1647058823529412),
           22             (0.125, 0.3764705882352941, 0.3764705882352941),
           23             (0.25,  0.5058823529411764, 0.5058823529411764),
           24             (0.375, 0.6392156862745098, 0.6392156862745098),
           25             (0.5,   0.7137254901960784, 0.7137254901960784),
           26             (0.625, 0.7490196078431373, 0.7490196078431373),
           27             (0.75,  0.7333333333333333, 0.7333333333333333),
           28             (0.875, 0.7568627450980392, 0.7568627450980392),
           29             (1.0,   0.9803921568627451, 0.9803921568627451)),
           30 
           31         'blue': (
           32             (0.0,   0.5254901960784314, 0.5254901960784314),
           33             (0.125, 0.8745098039215686, 0.8745098039215686),
           34             (0.25,  0.8313725490196079, 0.8313725490196079),
           35             (0.375, 0.7882352941176470, 0.7882352941176470),
           36             (0.5,   0.6470588235294118, 0.6470588235294118),
           37             (0.625, 0.4784313725490196, 0.4784313725490196),
           38             (0.75,  0.3607843137254902, 0.3607843137254902),
           39             (0.875, 0.2235294117647059, 0.2235294117647059),
           40             (1.0,   0.0509803921568627, 0.0509803921568627))}
           41 
           42 cm_bird = matplotlib.colors.LinearSegmentedColormap('bird', cmdict_bird)
           43 matplotlib.pyplot.register_cmap(cmap=cm_bird)
           44 
           45 # e.g.: 
           46 # plt.imshow(..., cmap='bird')
           47 if test:
           48     import numpy
           49     x = numpy.linspace(0, 1)
           50     y = numpy.linspace(0, 1)
           51     X,Y = numpy.meshgrid(x,y)
           52     Z = X
           53     matplotlib.pyplot.imshow(Z, cmap='bird')
           54     matplotlib.pyplot.show()