From 1daad2af920e706d51bf26b1b536b4a09fea8289 Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Mon, 4 Nov 2019 13:05:49 +0100 Subject: [PATCH] add wrapper around field->write_filtered test --- TurTLE/test/test_write_filtered.py | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 TurTLE/test/test_write_filtered.py diff --git a/TurTLE/test/test_write_filtered.py b/TurTLE/test/test_write_filtered.py new file mode 100644 index 00000000..6a484907 --- /dev/null +++ b/TurTLE/test/test_write_filtered.py @@ -0,0 +1,33 @@ +#! /usr/bin/env python + +import numpy as np +import h5py +import sys + +import TurTLE +from TurTLE import TEST + +try: + import matplotlib.pyplot as plt +except: + plt = None + +def main(): + c = TEST() + c.launch( + ['write_filtered_test', + '--simname', 'write_filtered_test', + '--np', '4', + '--ntpp', '1', + '--wd', './'] + + sys.argv[1:]) + df = h5py.File('data_for_write_filtered.h5', 'r') + bla0 = df['scal_field_full/complex/0'][:, 0] + bla1 = df['scal_field_z0slice/complex/0'][...] + assert(np.max(np.abs(bla1 - bla0)) < 1e-5) + print('SUCCESS!!! z=0 slice agrees between different datasets') + return None + +if __name__ == '__main__': + main() + -- GitLab