Ejemplo n.º 1
0
def qcd_rainbow(layout):
    """
    Colour particles according to their QCD color. Each colour+anticolour pair 
    gets a unique hue, with anti-colours brighter than the colours.
    """
    colors = [e.item.color for e in layout.edges]
    anticolors = [e.item.anticolor for e in layout.edges]
    unique_colors = sorted(list(set(colors + anticolors)))
    color_values = [i/len(unique_colors) for i in range(len(unique_colors))]
    seed(42) # Determinism, please.
    shuffle(color_values)
    cmap = dict([(unique_colors[i], rainbow_color(color_values[i], 0.5)) for i in range(len(unique_colors))])
    amap = dict([(unique_colors[i], rainbow_color(color_values[i], 0.8)) for i in range(len(unique_colors))])
    set_color(layout, cmap, amap)
Ejemplo n.º 2
0
    def __call__(self, layout):

        colors = [rainbow_color(i/10, 0.25 + 0.5*(i%2)) for i in xrange(10)]
        log.info("Colors are: %r", colors)
        
        if isinstance(layout, FeynmanLayout):
            for edge in layout.edges:
                particle = edge.item
                edge.style_args["stroke"] = colors[abs(particle.status) // 10]
                
        elif isinstance(layout, DualLayout):
            for node in layout.nodes:
                particle = node.item
                if hasattr(particle, "status"):
                    node.style_args["fill"] = colors[abs(particle.status) // 10]
Ejemplo n.º 3
0
    def __call__(self, layout):

        colors = [
            rainbow_color(i / 10, 0.25 + 0.5 * (i % 2)) for i in xrange(10)
        ]
        log.info("Colors are: %r", colors)

        if isinstance(layout, FeynmanLayout):
            for edge in layout.edges:
                particle = edge.item
                edge.style_args["stroke"] = colors[abs(particle.status) // 10]

        elif isinstance(layout, DualLayout):
            for node in layout.nodes:
                particle = node.item
                if hasattr(particle, "status"):
                    node.style_args["fill"] = colors[abs(particle.status) //
                                                     10]