aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-05 15:45:43 +0200
committerThomas White <taw@physics.org>2020-08-05 15:45:43 +0200
commit9adaa537b6070bfbe9a55317fcaf8c25dbafe3d6 (patch)
tree1b24ea77b919a797de29faaec85e6f1944b79f00 /scripts
parent95b167d7c9df4fd21e69853a664f02eb7bfe8901 (diff)
Add scripts/display-hdf5
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/display-hdf519
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/display-hdf5 b/scripts/display-hdf5
new file mode 100755
index 00000000..c203df20
--- /dev/null
+++ b/scripts/display-hdf5
@@ -0,0 +1,19 @@
+#!/usr/bin/env python
+
+import h5py
+import sys
+import matplotlib.pyplot as plt
+
+if len(sys.argv) != 3:
+ print("Syntax: {} file.h5 /data/location\n".format(sys.argv[0]))
+ sys.exit(1)
+
+fh = h5py.File(sys.argv[1])
+dataset = fh[sys.argv[2]]
+
+show = plt.figure()
+plt.imshow(dataset)
+plt.title("{} {}".format(sys.argv[1], sys.argv[2]))
+plt.show()
+
+fh.close()