Can't read panda hdf file

未关闭
#67 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
64/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Start by reading HdfMap._store_dataset and its call path in hdfmap_class.py, especially the group lookup shown in the traceback. Reproduce the failure with the provided hdfmap.create_hdf_map(f_hdf) example and inspect how the root-level dataset path is handled. Done means the Panda HDF file loads without the KeyError; add or update a regression test for that case.

由索引模型根据 Issue 内容生成。

描述

Tried reading a h5 file from P51 written by BlueSky but got an error.

import hdfmap

f_nxs = "/dls/p51/data/2026/cm44254-4/3336.nxs"
f_hdf = "/dls/p51/data/2026/cm44254-4/p51-3336-panda1.h5"

m = hdfmap.create_hdf_map(f_hdf)
print(m)

Gives error

Traceback (most recent call last):
  File "/scratch/grp66007/python/mmg_toolbox/examples/check_p51-3336-panda_file.py", line 15, in <module>
    m = hdfmap.create_hdf_map(f_hdf)
  File "/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/hdfmap/file_functions.py", line 40, in create_hdf_map
    hdf_map = HdfMap(hdf)
  File "/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/hdfmap/hdfmap_class.py", line 137, in __init__
    self.populate(file)
    ~~~~~~~~~~~~~^^^^^^
  File "/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/hdfmap/hdfmap_class.py", line 451, in populate
    self._populate(hdf_file)
    ~~~~~~~~~~~~~~^^^^^^^^^^
  File "/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/hdfmap/hdfmap_class.py", line 343, in _populate
    self._store_dataset(obj, hdf_path, name, external_file)
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/grp66007/python/mmg_toolbox/.venv/lib/python3.14/site-packages/hdfmap/hdfmap_class.py", line 275, in _store_dataset
    group = self.groups[SEP.join(hdf_path.split(SEP)[:-1])]  # group is already stored
            ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: ''
主要语言
Python
星标
2
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DiamondLightSource/hdfmap 的其他 Issue

查看 DiamondLightSource/hdfmap 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。