add test.py

This commit is contained in:
Peter McGoron 2021-09-17 08:06:57 -04:00
parent fadb371120
commit 985c1446e6
1 changed files with 21 additions and 0 deletions

21
test/test.py Normal file
View File

@ -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')