コード例 #1
0
    def test(self):
        info = infos.val(15)

        self.assertTrue(callable(info))
        self.assertEqual(3, info(3))
        self.assertEqual(0, info(0))
        self.assertEqual(15, info(None))
コード例 #2
0
    def test(self):
        info = infos.val(15)

        self.assertTrue(callable(info))
        self.assertEqual(3, info(3))
        self.assertEqual(0, info(0))
        self.assertEqual(15, info(None))
コード例 #3
0
ファイル: blazeDemo.py プロジェクト: gully/abstract_rendering
def _create_plot_component():
    red = util.Color(255, 0, 0, 255)
    green = util.Color(0, 255, 0, 255)
    blue = util.Color(0, 0, 255, 255)
    purple = util.Color(125, 0, 255, 255)
    white = util.Color(255, 255, 255, 255)
    black = util.Color(0, 0, 0, 255)

    shape = glyphset.ShapeCodes.RECT
    glyphs = blzg.load_csv(
        "../data/circlepoints.csv",
        "x",
        "y",
        "series",
        schema="{r:float32, theta:float32, x:float32, y:float32, series:int32}"
    )

    screen = (800, 600)
    ivt = util.zoom_fit(screen, glyphs.bounds())

    with Timer("Abstract-Render") as arTimer:
        image = core.render(
            glyphs, infos.val(), blzg.CountCategories("int32"),
            categories.HDAlpha([red, blue, green, purple, black]), screen, ivt)
#      image = core.render(glyphs,
#                          infos.valAt(4,0),
#                          blzg.Count(),
#                          numeric.BinarySegment(white, black, 1),
#                          screen,
#                          ivt)

# Create a plot data object and give it this data
    pd = ArrayPlotData()
    pd.set_data("imagedata", image)

    # Create the plot
    plot = Plot(pd)
    img_plot = plot.img_plot("imagedata")[0]

    # Tweak some of the plot properties
    plot.title = "Abstract Rendering"
    plot.padding = 50

    return plot
コード例 #4
0
def _create_plot_component():
    red = util.Color(255,0,0,255)
    green = util.Color(0,255,0,255)
    blue = util.Color(0,0,255,255)
    purple = util.Color(125,0,255,255)
    white = util.Color(255,255,255,255)
    black = util.Color(0,0,0,255)
    
    shape = glyphset.ShapeCodes.RECT
    glyphs = blzg.load_csv("../data/circlepoints.csv", "x", "y", "series", 
                            schema="{r:float32, theta:float32, x:float32, y:float32, series:int32}")

    screen = (800,600)
    ivt = util.zoom_fit(screen,glyphs.bounds())

    with Timer("Abstract-Render") as arTimer:   
      image = core.render(glyphs, 
                          infos.val(),
                          blzg.CountCategories("int32"),
                          categories.HDAlpha([red, blue, green, purple, black]),
                          screen,
                          ivt)
#      image = core.render(glyphs, 
#                          infos.valAt(4,0),
#                          blzg.Count(), 
#                          numeric.BinarySegment(white, black, 1),
#                          screen,
#                          ivt)

    # Create a plot data object and give it this data
    pd = ArrayPlotData()
    pd.set_data("imagedata", image)

    # Create the plot
    plot = Plot(pd)
    img_plot = plot.img_plot("imagedata")[0]

    # Tweak some of the plot properties
    plot.title = "Abstract Rendering"
    plot.padding = 50
    
    return plot