-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some tests for legacy file information (#548)
* Added some tests for legacy file information * Improved handling of wrong file input
- Loading branch information
1 parent
3692b3b
commit a5d8843
Showing
7 changed files
with
100 additions
and
6 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
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,43 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
This script creates storage files for backwards compatibility tests | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
PACKAGE_PATH = Path(__file__).resolve().parents[1] | ||
sys.path.insert(0, str(PACKAGE_PATH)) | ||
|
||
import pde | ||
|
||
|
||
def create_storage_test_resources(path, num): | ||
"""test storing scalar field as movie""" | ||
grid = pde.CylindricalSymGrid(3, [1, 2], [2, 2]) | ||
field = pde.ScalarField(grid, [[1, 3], [2, 4]]) | ||
eq = pde.DiffusionPDE() | ||
info = {"payload": "storage-test"} | ||
movie_writer = pde.MovieStorage( | ||
path / f"storage_{num}.avi", info=info, vmax=4, bits_per_channel=16 | ||
) | ||
file_writer = pde.FileStorage(path / f"storage_{num}.hdf5", info=info) | ||
eq.solve( | ||
field, | ||
t_range=3.5, | ||
dt=0.1, | ||
backend="numpy", | ||
tracker=[movie_writer.tracker(2), file_writer.tracker(2)], | ||
) | ||
|
||
|
||
def main(): | ||
"""main function creating all the requirements""" | ||
root = Path(PACKAGE_PATH) | ||
create_storage_test_resources(root / "tests" / "storage" / "resources", 1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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