Coverage for src/km3pipe/tests/test_plot.py: 100%
19 statements
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 03:14 +0000
« prev ^ index » next coverage.py v7.5.1, created at 2024-05-08 03:14 +0000
1# Filename: test_plot.py
2# pylint: disable=locally-disabled,C0111,R0904,C0103
4import numpy as np
6from km3pipe.testing import TestCase, patch
7from km3pipe.plot import meshgrid, automeshgrid, diag
9__author__ = "Moritz Lotze"
10__copyright__ = "Copyright 2016, Tamas Gal and the KM3NeT collaboration."
11__credits__ = []
12__license__ = "MIT"
13__maintainer__ = "Moritz Lotze"
14__email__ = "mlotze@km3net.de"
15__status__ = "Development"
18class TestMeshStuff(TestCase):
19 def test_meshgrid(self):
20 xx, yy = meshgrid(-1, 1, 0.8)
21 assert np.allclose(
22 [[-1.0, -0.2, 0.6], [-1.0, -0.2, 0.6], [-1.0, -0.2, 0.6]], xx
23 )
24 assert np.allclose(
25 [[-1.0, -1.0, -1.0], [-0.2, -0.2, -0.2], [0.6, 0.6, 0.6]], yy
26 )
28 def test_meshgrid_with_y_specs(self):
29 xx, yy = meshgrid(-1, 1, 0.8, -10, 10, 8)
30 assert np.allclose(
31 [[-1.0, -0.2, 0.6], [-1.0, -0.2, 0.6], [-1.0, -0.2, 0.6]], xx
32 )
33 assert np.allclose([[-10, -10, -10], [-2, -2, -2], [6, 6, 6]], yy)