add test.py
This commit is contained in:
parent
fadb371120
commit
985c1446e6
|
@ -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')
|
Loading…
Reference in New Issue