-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement 1D animations #36
Conversation
Hello @johnomotani! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2019-10-23 16:04:00 UTC |
ada1242
to
2afe9f8
Compare
Thanks! I will have a look at this properly later, but you will be interested in this PR to xarray, which I hope one day can can supplant this. |
Codecov Report
@@ Coverage Diff @@
## master #36 +/- ##
==========================================
- Coverage 48.03% 43.72% -4.31%
==========================================
Files 6 6
Lines 254 279 +25
Branches 51 59 +8
==========================================
Hits 122 122
- Misses 122 147 +25
Partials 10 10
Continue to review full report at Codecov.
|
To allow for the use of PillowWriter in plotting/animate.py
…ixture to create temporary directory to deal with the output of subsequent animate function
Animation Writer changed to PillowWriter in animate_line and animate_imshow
Note the test failures seem to be due to an |
Thanks to @rdoyle45, the xarray issue causing the test failures is now fixed in xarray/master, so the tests should pass once the next xarray release comes out (whenever that is). In the meantime, the tests pass on my computer with the older xarray/1.3.0, so I think this PR is ready for review/merge. I guess we could change the test environment to use a specific version of xarray that works, but I think it's good to keep using the latest version to pick up issues like this, so I'm in favour of leaving the test setup as-is, and just verifying the checks manually. |
I need to update the test data files in |
Yes, if we can automate the generation of test data we should.
Do they need to be 21MB?
…On Mon, 21 Oct 2019, 14:55 johnomotani, ***@***.***> wrote:
I need to update the test data files in xbout/tests/data/dump_files to
add jyseps1_2, etc. to get the tests to pass. The files are ~21MB - I
think it might be better to remove the .nc files and replace them with a
simple python script/function to generate the required files. Thoughts?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#36?email_source=notifications&email_token=AISNPI3EQXKJFD7ZPIC4E63QPWYGRA5CNFSM4IDYL3E2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB2NAFI#issuecomment-544526357>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AISNPIY22DW3UMWWLXQC5PTQPWYGRANCNFSM4IDYL3EQ>
.
|
Not sure, I don't know why they were originally created with the structure they have. But there are 32 files in the |
I think my logic was along the lines of:
We want to test concatenation on the most general output, which means
having files with all possible combinations of guard cells (so 3 for times
3 for y), then combine along along time (so times 2). So maybe the minimum
number of files is 18? But each one doesn't need to have much data in it.
…On Mon, 21 Oct 2019, 17:06 johnomotani, ***@***.***> wrote:
Do they need to be 21MB?
Not sure, I don't know why they were originally created with the structure
they have. But there are 32 files in the tests/data/dump_files/along_x
directory, which seems like a lot, so I'd guess they could be cut down.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#36?email_source=notifications&email_token=AISNPIZT4LBTGM3OQWHKGCTQPXHRHA5CNFSM4IDYL3E2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB23SII#issuecomment-544586017>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AISNPI4SHY2V4QVALG4FOWTQPXHRHANCNFSM4IDYL3EQ>
.
|
makes sense, but I'll try and replace by using the |
Actually, because |
I like the |
My thinking is that we depend strongly on |
A slight digression gents; on the errors thrown by the checks of a4ad8b7, those in in Python 3.6 have been solved in xarray and will be in the next release as mentioned by @johnomotani earlier. Whereas those thrown by Python 3.5, relating to the I don't believe this is of the greatest importance, but should more recent releases of python be used for test? Maybe 3.6 and 3.7 instead (with a possible inclusion of 3.8) or is the backwards compatibility of xBOUT to 3.5 of greater importance? @TomNicholas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should solve the problem with python 3.5 test.
Thanks Rhys. As xBOUT is not even at an initial release version yet I see
no reason to strive for backwards compatibility to different versions of
python, we can just make 3.6 a requirement.
…On Tue, 22 Oct 2019 at 12:28, Rhys Doyle ***@***.***> wrote:
***@***.**** requested changes on this pull request.
This should solve the problem with python 3.5 test.
------------------------------
In xbout/tests/test_animate.py
<#36 (comment)>:
> @@ -0,0 +1,41 @@
+import pytest
+
+from xbout import open_boutdataset
+from xbout.boutdataarray import BoutDataArrayAccessor
+from .generate_test_data import generate_test_data
+
+from animatplot.blocks import Imshow, Line
+
+
***@***.***
+def create_test_file(tmpdir_factory):
+
+ # Create temp dir for output of animate1D/2D
+ save_dir = tmpdir_factory.mktemp("test_data")
⬇️ Suggested change
- save_dir = tmpdir_factory.mktemp("test_data")
+ save_dir = str(tmpdir_factory.mktemp("test_data"))
------------------------------
In xbout/tests/test_animate.py
<#36 (comment)>:
> +from xbout.boutdataarray import BoutDataArrayAccessor
+from .generate_test_data import generate_test_data
+
+from animatplot.blocks import Imshow, Line
+
+
***@***.***
+def create_test_file(tmpdir_factory):
+
+ # Create temp dir for output of animate1D/2D
+ save_dir = tmpdir_factory.mktemp("test_data")
+
+ # Generate some test data
+ generate_test_data(save_dir, nt=3, nx=16, ny=6, nz=2, NXPE=3, NYPE=3)
+
+ ds = open_boutdataset(save_dir.join("BOUT.dmp.*.nc")) # Open test data
⬇️ Suggested change
- ds = open_boutdataset(save_dir.join("BOUT.dmp.*.nc")) # Open test data
+ ds = open_boutdataset(save_dir + "/BOUT.dmp.*.nc") # Open test data
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#36?email_source=notifications&email_token=AISNPI4TU4MSA5WVIYCSHA3QP3PU5A5CNFSM4IDYL3E2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCIX67ZQ#pullrequestreview-305131494>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AISNPI7N2V2AX7THOSZHEG3QP3PU5ANCNFSM4IDYL3EQ>
.
--
Thomas Nicholas
PhD Student | Computational plasma physics for nuclear fusion
University of York | Based at Culham Centre for Fusion Energy
<http://www.ccfe.ac.uk/> (D3/1.79)
GitHub <https://github.com/TomNicholas> | LinkedIn
<https://www.linkedin.com/in/tom-nicholas/>
|
Thanks @rdoyle45! |
Agreed on both counts. @johnomotani |
Makes test files more similar to BOUT++ dump files.
Use the file number as a seed for the random number generation so that all files are different.
Previously was ('x','y','z','t'). The new order matches the way BOUT++ stores data.
Instead generate the input files in a temporary directory using test_load.create_bout_ds_list().
a4ad8b7
to
452e69d
Compare
Discussion on Slack agreed with @TomNicholas, so I've removed the |
In Python-3.5 there is an incompatibility between pathlib.Path and pytest.LocalPath, which is fixed in Python-3.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great - thanks both of you.
Implement 1D animations, and refactor generation of test data
Could probably make this fancier, e.g. to allow over-plotting of multiple lines, but it works!