Skip to content

Commit

Permalink
Add more tests (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpignedoli authored Apr 15, 2024
1 parent 22da782 commit 6b7fe27
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def test_read_cube():
np.array([[15.1178, 0, 0], [0, 15.1178, 0], [0, 0, 15.1178]]),
atol=0.001,
)
assert cube.scaling_f == 1


def test_get_xyz_index():
Expand Down Expand Up @@ -79,3 +80,14 @@ def test_x_arr_ang():
),
atol=0.001,
)


def test_reduce_data_density():
cube = Cube.from_file(this_dir / "CH4_HOMO.cube")
integral = np.sum(cube.data**2) * cube.dv_au * cube.scaling_f
cube.reduce_data_density(points_per_angstrom=2)
cube.write_cube_file("low_res.cube", low_precision=True)
low_res = Cube.from_file("low_res.cube")
low_res_integral = np.sum(low_res.data**2) * low_res.dv_au * low_res.scaling_f**2
assert np.abs(low_res_integral - integral) < 0.01
assert cube.scaling_f == 0.2848452

0 comments on commit 6b7fe27

Please sign in to comment.