def storeFlagsFile(FLAGS_F, file_name, t0, text, ID):
if not FLAGS_F: # this flag doesnt work for mulitple users
f = h5py.File(file_name, "r+")
data_content = np.array([np.round(time.time() - t0, 3), text])
asciiList = np.array([str(n).encode("utf-8", "ignore") for n in data_content]).reshape(1, 2)
dt = h5py.string_dtype(encoding='utf-8')
dset = f[str(ID)].create_dataset('AcqFlags', data=asciiList, compression="gzip", chunks=True, maxshape=(None, 2), dtype=dt)
FLAGS_F = 1
else:
f = h5py.File(file_name, "r+")
data_content = np.array([np.round(time.time() - t0, 3), text])
asciiList = np.array([str(n).encode("utf-8", "ignore") for n in data_content]).reshape(1, 2)
f[str(ID)+'/AcqFlags'].resize((f[str(ID)+'/AcqFlags'].shape[0] + 1), axis = 0)
f[str(ID)+'/AcqFlags'][-1:] = asciiList
I want to save a data format like this in the format (None, 2) since I am continually updating the data row per row by calling the storeFlagsFile function.
['4.412' 'a']
['5.412' 'b']
['6.412' 'c']
['8.226' 'd']
in which t0 the first column and text = the second column of the data, which I give as input row per row to storeFlagsFile(FLAGS_F, file_name, t0, text, ID). FLAGS_F is initially 0 and ID = "122".
but I am observing the hdf5 file like this:
Can anyone point me out what I am doing wrong please? Thank you!