Skip to content

Instantly share code, notes, and snippets.

@chronopoulos
Last active August 29, 2015 13:56
Show Gist options
  • Save chronopoulos/8942744 to your computer and use it in GitHub Desktop.
Save chronopoulos/8942744 to your computer and use it in GitHub Desktop.
Python script to separate the channel data from the auxiliary data in the HDF5 files.
ns = 30000 # number of samples
f = h5py.File('/home/chrono/sng/data/take5.h5')
dset = f['wired-dataset'] # this has length 30000, where each element is a non-rectangular tuple
data = np.zeros((1024,ns), dtype='int16') # 1024 channels at 30 kHz
aux = np.zeros((32,45,ns/15), dtype='int16') # 32 chips, 45 aux values, samples at 2 kHz
for i in range(ns):
data[:,i] = dset[i][3][:1024]
for j in range(96):
aux[j//3, (i%15)*3+j%3, i//15] = dset[i][3][1024+j]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment