David Reed
2013-08-08 00:58:07 UTC
Hi there,
I have some generic functions that take time series data with 2 numpy array
arguments, time and value, and return 2 numpy arrays of time and value.
I would like to place these arrays into a Numpy structured array or
directly into a new pytables table with fields, time and value.
Now Ive found I could do this:
t, v = some_func(t, v)
A = np.empty(len(t), dtype=[('time', np.float64), ('value',
np.float64)])
A['time'] = t
A['value'] = v
hfile.createTable(grp, 'signal', description=A)
hfile.flush()
But this seems rather clunky and inefficient. Any suggestions to make this
repackaging a little smoother?
I have some generic functions that take time series data with 2 numpy array
arguments, time and value, and return 2 numpy arrays of time and value.
I would like to place these arrays into a Numpy structured array or
directly into a new pytables table with fields, time and value.
Now Ive found I could do this:
t, v = some_func(t, v)
A = np.empty(len(t), dtype=[('time', np.float64), ('value',
np.float64)])
A['time'] = t
A['value'] = v
hfile.createTable(grp, 'signal', description=A)
hfile.flush()
But this seems rather clunky and inefficient. Any suggestions to make this
repackaging a little smoother?