From 985c1446e622c0b44b51002d2f043455ab333d8e Mon Sep 17 00:00:00 2001 From: Peter McGoron Date: Fri, 17 Sep 2021 08:06:57 -0400 Subject: [PATCH] add test.py --- test/test.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/test.py diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..9fd74fa --- /dev/null +++ b/test/test.py @@ -0,0 +1,21 @@ +from gwygsf import GSF +import matplotlib.pyplot as plt + +plt.ioff() + +def makeplot(name): + c = GSF() + c.fromfile(name) + x0 = float(c.attr["XOffset"]) * 1e6 + xl = x0 + float(c.attr["XReal"]) * 1e6 + y0 = float(c.attr["YOffset"]) * 1e6 + yl = y0 + float(c.attr["YReal"]) * 1e6 + + fig, ax = plt.subplots() + gr = ax.imshow(c.d, extent=(x0,xl,y0,yl)) + ax.set_xlabel("um") + ax.set_ylabel("um") + fig.colorbar(gr) + fig.savefig(f'{name}.png') + +makeplot('test.gsf')