【问题标题】:Adding attributes to hdf5 file向 hdf5 文件添加属性
【发布时间】:2020-07-03 16:48:08
【问题描述】:

我有这个脚本可以将一些 .txt 文件转换为 .hdf5。这些后来被用作另一个函数的输入。

我之前已经实施过,一切都运行顺利(大约 2 周前)。

name = "ecg.hdf5"
sampling_rate = 250;
ecg = np.genfromtxt('ecg.txt') 

hf = h5py.File(name, 'w')

# Create subgroups and add dataset
signals = hf.create_group('signals/ECG/raw')
ecg = signals.create_dataset('ecg',data = ecg)

# max and min for plot limits
ecg_max = max(ecg)
ecg_min = min(ecg)

# Add attributes
ecg.attrs.create('json','{"name": "signal0", "resolution": 16, "labels": ["I"], "units": {"signal": {"max": %f, "min": %f}, "time": {"label": "second"}}, "sampleRate": %d, "type": "/ECG/raw/ecg"}' %(ecg_max,ecg_min,sampling_rate))

hf.close()

当我运行它时,我一直有这个错误并且无法归因于“属性” rro adding atribu

有什么想法吗? 提前致谢

【问题讨论】:

  • 解决它:将 h5py 版本从 2.9.0 更新到 2.10.0
  • 考虑发布评论作为您自己问题的答案。

标签: attributes hdf5


【解决方案1】:

解决它:将 h5py 版本从 2.9.0 更新到 2.10.0

【讨论】:

    猜你喜欢
    • 2015-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-15
    • 2018-10-01
    • 1970-01-01
    相关资源
    最近更新 更多