-
-
Save ndevenish/bf03b390adddb33089a8c6a70e8f4936 to your computer and use it in GitHub Desktop.
Script from Graeme to test HDF5 plugin performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
import bitshuffle.h5 # other plugins could be loaded instead | |
import sys | |
import time | |
def reader(filename): | |
"""Read the data in filename, as an exercise for the CPU.""" | |
t0 = time.time() | |
with h5py.File(filename, "r") as f: | |
d = f["/entry/data/data"] | |
frames, slow, fast = d.shape | |
for frame in range(frames): | |
image = d[frame, :, :] | |
t1 = time.time() | |
print(f"Total: {t1 - t0} Per-frame: {(t1 - t0) / frames}") | |
if __name__ == "__main__": | |
reader(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment