Example #1
0
def test_map(engine):
    plotter.set_engine(engine)
    syst = syst_2d()

    with tempfile.NamedTemporaryFile(
            'w+b', suffix=plotter_file_suffix(engine)) as out:
        out_filename = out.name
        plotter.map(syst,
                    lambda site: site.tag[0],
                    pos_transform=good_transform,
                    file=out_filename,
                    method='linear',
                    a=4,
                    oversampling=4,
                    cmap='flag',
                    show=False)
        pytest.raises(ValueError,
                      plotter.map,
                      syst,
                      lambda site: site.tag[0],
                      pos_transform=bad_transform,
                      file=out_filename)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            plotter.map(syst.finalized(),
                        range(len(syst.sites())),
                        file=out_filename,
                        show=False)
        pytest.raises(ValueError,
                      plotter.map,
                      syst,
                      range(len(syst.sites())),
                      file=out_filename)
Example #2
0
def test_map():
    syst = syst_2d()
    with tempfile.TemporaryFile('w+b') as out:
        plotter.map(syst,
                    lambda site: site.tag[0],
                    pos_transform=good_transform,
                    file=out,
                    method='linear',
                    a=4,
                    oversampling=4,
                    cmap='flag')
        pytest.raises(ValueError,
                      plotter.map,
                      syst,
                      lambda site: site.tag[0],
                      pos_transform=bad_transform,
                      file=out)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            plotter.map(syst.finalized(), range(len(syst.sites())), file=out)
        pytest.raises(ValueError,
                      plotter.map,
                      syst,
                      range(len(syst.sites())),
                      file=out)
Example #3
0
def test_map():
    syst = syst_2d()
    with tempfile.TemporaryFile('w+b') as out:
        plotter.map(syst, lambda site: site.tag[0], pos_transform=good_transform,
                    file=out, method='linear', a=4, oversampling=4, cmap='flag')
        pytest.raises(ValueError, plotter.map, syst,
                      lambda site: site.tag[0],
                      pos_transform=bad_transform, file=out)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            plotter.map(syst.finalized(), range(len(syst.sites())),
                        file=out)
        pytest.raises(ValueError, plotter.map, syst,
                      range(len(syst.sites())), file=out)
Example #4
0
def test_map():
    if not plotter.mpl_enabled:
        raise nose.SkipTest
    sys = sys_2d()
    with tempfile.TemporaryFile('w+b') as out:
        plotter.map(sys, lambda site: site.tag[0], pos_transform=good_transform,
                    file=out, method='linear', a=4, oversampling=4, cmap='flag')
        nose.tools.assert_raises(ValueError, plotter.map, sys,
                                 lambda site: site.tag[0],
                                 pos_transform=bad_transform, file=out)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            plotter.map(sys.finalized(), xrange(len(sys.sites())),
                              file=out)
        nose.tools.assert_raises(ValueError, plotter.map, sys,
                                 xrange(len(sys.sites())), file=out)