コード例 #1
0
ファイル: backends.py プロジェクト: kmatt/toyplot
def step_impl(context):
    buffer = io.BytesIO()
    context.backend.render(context.canvas, buffer)
    buffer.seek(0)

    image = testing.read_png(buffer)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #2
0
ファイル: backend.py プロジェクト: sandialabs/toyplot
def step_impl(context):
    buffer = io.BytesIO()
    context.backend.render(context.canvas, buffer)
    buffer.seek(0)

    image = testing.read_png(buffer)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #3
0
ファイル: backend.py プロジェクト: sandialabs/toyplot
def step_impl(context):
    png = context.backend.render(context.canvas, width="200px")
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (200, 200, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #4
0
ファイル: backend.py プロジェクト: sandialabs/toyplot
def step_impl(context):
    target = os.path.join(testing.backend_dir, "%s.png" % context.name)
    context.backend.render(context.canvas, target)
    image = testing.read_png(target)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #5
0
ファイル: backend.py プロジェクト: sandialabs/toyplot
def step_impl(context):
    png = context.backend.render(context.canvas, scale=0.5)
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (300, 300, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #6
0
ファイル: backends.py プロジェクト: kmatt/toyplot
def step_impl(context):
    png = context.backend.render(context.canvas, width="200px")
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (200, 200, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #7
0
ファイル: backends.py プロジェクト: kmatt/toyplot
def step_impl(context):
    target = os.path.join(testing.backend_dir, "%s.png" % context.name)
    context.backend.render(context.canvas, target)
    image = testing.read_png(target)
    nose.tools.assert_equal(image.shape, (600, 600, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #8
0
ファイル: backends.py プロジェクト: kmatt/toyplot
def step_impl(context):
    png = context.backend.render(context.canvas, scale=0.5)
    image = testing.read_png(io.BytesIO(png))
    nose.tools.assert_equal(image.shape, (300, 300, 4))
    nose.tools.assert_equal(image.dtype, "uint8")
コード例 #9
0
def step_impl(context):
    context.image = testing.read_png(
        os.path.join(art_dir, "toyplot-8-RGBA.png"))
    nose.tools.assert_equal(context.image.shape, (256, 256, 4))
    nose.tools.assert_equal(context.image.dtype, "uint8")
コード例 #10
0
def step_impl(context):
    context.image = testing.read_png(os.path.join(art_dir, "toyplot-8-L.png"))
    nose.tools.assert_equal(context.image.shape, (256, 256, 1))
    nose.tools.assert_equal(context.image.dtype, "uint8")
    context.image = (context.image, toyplot.color.brewer.map("BlueRed"))
コード例 #11
0
def step_impl(context):
    context.image = testing.read_png(os.path.join(art_dir, "toyplot-8-L.png"))
    context.image = context.image > 128
    nose.tools.assert_equal(context.image.shape, (256, 256, 1))
    nose.tools.assert_equal(context.image.dtype, "bool")
コード例 #12
0
ファイル: video.py プロジェクト: dahuget/toyplot
def step_impl(context):
    for frame in toyplot.png.render_frames(context.canvas):
        image = testing.read_png(io.BytesIO(frame))
        nose.tools.assert_equal(image.shape, (600, 600, 4))
        nose.tools.assert_equal(image.dtype, "uint8")