From f9d539d13e2b820317111a30a46c13e153918f5e Mon Sep 17 00:00:00 2001 From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de> Date: Tue, 26 Apr 2016 07:19:43 +0200 Subject: [PATCH] add test for new field class obviously, it's basically empty. all I need to do now is generate the field class, then generate a C++ main file that uses it, then compare the results against pyFFTW --- tests/test_field_class.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/test_field_class.py diff --git a/tests/test_field_class.py b/tests/test_field_class.py new file mode 100644 index 00000000..152e23ff --- /dev/null +++ b/tests/test_field_class.py @@ -0,0 +1,34 @@ +import numpy as np +import matplotlib.pyplot as plt +import pyfftw +import bfps +import bfps.tools + +def main(): + kdata = pyfftw.n_byte_align_empty( + (32, 32, 17), + pyfftw.simd_alignment, + dtype = np.complex64) + rdata = pyfftw.n_byte_align_empty( + (32, 32, 32), + pyfftw.simd_alignment, + dtype = np.float32) + c2r = pyfftw.FFTW( + kdata.transpose((1, 0, 2)), + rdata, + axes = (0, 1, 2), + direction = 'FFTW_BACKWARD', + threads = 8) + kdata[:] = bfps.tools.generate_data_3D(32, 32, 32, dtype = np.complex64) + c2r.execute() + fig = plt.figure() + a = fig.add_subplot(111) + a.set_axis_off() + a.imshow(rdata[:, 4, :], interpolation = 'none') + fig.tight_layout() + fig.savefig('tst.pdf') + return None + +if __name__ == '__main__': + main() + -- GitLab