Exemplo n.º 1
0
def test_multislice_raises():
    array = np.ones((1, 25, 25), dtype=np.complex64)
    potential = DummyPotential(extent=5)

    waves = Waves(array, extent=5)
    with pytest.raises(RuntimeError) as e:
        waves.multislice(potential, pbar=False)

    assert str(e.value) == 'Energy is not defined'

    waves.energy = 60e3
    waves.multislice(potential, pbar=False)
Exemplo n.º 2
0
def test_multislice():
    array = np.ones((1, 25, 25), dtype=np.complex64)
    waves = Waves(array, energy=60e3)

    potential = DummyPotential(extent=5)

    new_waves = waves.multislice(potential, pbar=False)

    assert potential.gpts is not None
    assert waves.extent is not None
    assert new_waves is waves

    new_waves = copy(new_waves)
    new_waves = new_waves.multislice(potential, pbar=False)

    assert potential.gpts is not None
    assert waves.extent is not None
    assert not np.all(np.isclose(new_waves.array, waves.array))