-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from rdoyle45/1d-animations
Animation Writer changed to PillowWriter in animate_line and animate_imshow
- Loading branch information
Showing
4 changed files
with
47 additions
and
10 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,6 +1,7 @@ | ||
xarray >= 0.12.2 | ||
dask[array] >= 1.0.0 | ||
natsort >= 5.5.0 | ||
matplotlib >= 2.2 | ||
matplotlib >= 3.0.3 | ||
animatplot >= 0.3 | ||
netcdf4 >= 1.4.0 | ||
Pillow >= 6.1.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import pytest | ||
|
||
from xbout import open_boutdataset | ||
from xbout.boutdataarray import BoutDataArrayAccessor | ||
|
||
from animatplot.blocks import Imshow, Line | ||
|
||
# Path to test dmp files | ||
DATA_PATH = './xbout/tests/data/dump_files/along_x/BOUT.dmp.*.nc' | ||
|
||
|
||
@pytest.fixture | ||
def create_test_file(tmpdir_factory): | ||
|
||
# Create temp dir for output of animate1D/2D | ||
save_dir = tmpdir_factory.mktemp("test_data") | ||
ds = open_boutdataset(DATA_PATH).squeeze(drop=True) # Open test data | ||
|
||
return save_dir, ds | ||
|
||
|
||
class TestAnimate: | ||
""" | ||
Set of tests to check whether animate1D() and animate2D() are running properly | ||
and PillowWriter is saving each animation correctly | ||
""" | ||
def test_animate2D(self, create_test_file): | ||
|
||
save_dir, ds = create_test_file | ||
animation = ds['T'].bout.animate2D(y='z', save_as="%s/test" % save_dir) | ||
|
||
assert isinstance(animation, Imshow) | ||
|
||
def test_animate1D(self, create_test_file): | ||
|
||
save_dir, ds = create_test_file | ||
animation = ds['T'][:, :, 0].bout.animate1D(save_as="%s/test" % save_dir) | ||
|
||
assert isinstance(animation, Line) |