forked from lmhale99/atomman
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-tests' of https://github.com/tjni/atomman
- Loading branch information
Showing
4 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
import pytest | ||
import numpy as np | ||
|
||
from atomman.plot.interpolate_contour import grid_interpolate_2d | ||
from atomman.plot.interpolate_contour import __grid_interpolate | ||
|
||
|
||
def test_grid_interpolate_2d(): | ||
def test_grid_interpolate(): | ||
x = np.array([0, 0, 1]) | ||
y = np.array([0, 1, 1]) | ||
v = np.array([0, 1, 2]) | ||
range = [[0, 1], [0, 1]] | ||
xlim = (0, 1) | ||
ylim = (0, 1) | ||
|
||
# extrapolation occurs | ||
grid, _, _ = grid_interpolate_2d(x, y, v, range=range) | ||
grid = __grid_interpolate(x, y, v, xlim=xlim, ylim=ylim) | ||
assert np.any(np.isnan(grid)) | ||
|
||
# fill in extrapolated points | ||
fill_value = 1234 | ||
filled_grid, _, _ = grid_interpolate_2d(x, y, v, range=range, fill_value=fill_value) | ||
filled_grid = __grid_interpolate(x, y, v, xlim=xlim, ylim=ylim, fill_value=fill_value) | ||
np.testing.assert_almost_equal(filled_grid[np.isnan(grid)], fill_value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters