Created
February 19, 2016 01:45
-
-
Save RobbieClarken/1a3f32194f27623b9036 to your computer and use it in GitHub Desktop.
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 | |
from epics import PV, caget | |
import time | |
camera_pv = PV('SR10BM02IMG01:DATA_MONITOR') | |
MAX_SAMPLES = 1000 | |
WIDTH = 128 | |
HEIGHT = 128 | |
with h5py.File('camera-data.hdf5', 'w') as file: | |
dataset = file.create_dataset('injection-001', | |
shape=(MAX_SAMPLES, WIDTH, HEIGHT), | |
dtype='uint8', | |
chunks=(1, WIDTH, HEIGHT)) | |
# Note: specifying the chunk size is necessary to keep the file size down | |
# Store metadata in attrs | |
dataset.attrs['SR03ID01:GAP_MONITOR'] = caget('SR03ID01:GAP_MONITOR') | |
dataset.attrs['SR05ID01:GAP_MONITOR'] = caget('SR05ID01:GAP_MONITOR') | |
dataset.attrs['SR13ID01:GAP_MONITOR'] = caget('SR13ID01:GAP_MONITOR') | |
# Collect camera data | |
for i in range(10): | |
dataset[i] = camera_pv.get(use_monitor=False).reshape(WIDTH, HEIGHT) | |
time.sleep(1) | |
dataset.resize(i + 1, axis=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment