def test_Analyser_height():
    Analyser = FlatAnalyser(position=(0.0, 1.0, 0.0), direction=(1.0, 0, 0))
    try:
        Analyser.height = -0.1
        assert False
    except AttributeError:
        assert True
Exemplo n.º 2
0
def test_FlatAnalyser_kwChecker():

    try:
        Analyser = FlatAnalyser(Position=(0.0,1.0,0.0),direction=(1.0,0,0))
        assert False
    except:
        assert True

    try:
        Analyser = FlatAnalyser(pos=(0.0,1.0,0.0),direction=(1.0,0,0))
        assert False
    except:
        assert True
def test_Analyser_init():
    Analyser = FlatAnalyser(position=(0.0, 1.0, 0.0),
                            direction=(1.0, 0, 0),
                            d_spacing=3.35,
                            mosaicity=60,
                            width=0.05,
                            height=0.1)
    assert (np.all(Analyser.position == np.array([0.0, 1.0, 0.0])))
    assert (np.all(Analyser.direction == (1.0, 0.0, 0.0)))
    assert (Analyser.width == 0.05)
    assert (Analyser.height == 0.1)
def test_FlatAnalyser_str():
    Analyser = FlatAnalyser(position=(0.0, 1.0, 0.0), direction=(1.0, 0, 0))
    assert (str(Analyser) == 'FlatAnalyser located at ' +
            np.array2string(np.array([0.0, 1.0, 0.0])))
def test_FlatAnalyser_plot():
    Analyser = FlatAnalyser(position=(0.0, 1.0, 0.0), direction=(1.0, 0, 0))
    fig = plt.figure()
    ax = fig.gca(projection='3d')

    Analyser.plot(ax)