File: test_bz.py

package info (click to toggle)
python-ase 3.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,484 kB
  • sloc: python: 148,112; xml: 2,728; makefile: 110; javascript: 47
file content (20 lines) | stat: -rw-r--r-- 610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# fmt: off
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.testing.compare import compare_images
from scipy.spatial.transform import Rotation

from ase.lattice import HEX2D


def test_repeat_transpose_bz(testdir, datadir) -> None:
    """Testing plot_bz."""

    hex2d = HEX2D(a=1.0)
    r = Rotation.from_rotvec([0, 0, np.deg2rad(10)])
    fig, ax = plt.subplots()
    hex2d.plot_bz(repeat=(2, 1), transforms=[r], ax=ax)
    test_image = 'test_bz.png'
    ref_image = str(datadir / 'rotated_bz.png')
    fig.savefig(test_image)
    assert compare_images(test_image, ref_image, 0.5) is None