[Bug]: loadMeasurements without names returns nothing for worm results (Time interval has no mean)

オープン 初心者向け
#421 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
data

調査の方向性

まず pyalps/load.py、特に Hdf5Loader.ReadMeasurementFromFile と issue に記載されたファイルごとの例外処理を確認します。mean グループのない observables を loader がどのように処理するかを確認し、次に worm の結果で再現を実行して、loadMeasurements(files) が Density や Stiffness などの読み取り可能な observables を返し、Time interval をスキップするか警告を表示することを確認します。

索引モデルが issue の本文から書いたものです。

説明

area:python bug P2

Summary

For worm results, pyalps.loadMeasurements(files) without observable names returns an empty list for each file. It logs a PathNotFound traceback but doesn't raise:

The group '/simulation/results/Time interval/mean' does not exist.
Traceback (most recent call last):
  File ".../pyalps/load.py", line 416, in ReadMeasurementFromFile
    elif "error" in self.h5f.list_children(respath+'/'+m+'/mean'):
pyalps.hdf5.PathNotFound: The group '/simulation/results/Time interval/mean' does not exist.

worm writes an internal observable, Time interval, that has only count and timeseries children and no mean group. Hdf5Loader.ReadMeasurementFromFile assumes every observable has mean. The resulting exception is caught by the try around the whole file, so every other observable in that file is dropped as well. Master's load.py has the same structure (the "error" in ...list_children(respath+'/'+m+'/mean') check and the per-file except), so this probably isn't fixed there either.

To Reproduce

import pyalps
parms = [{
    'LATTICE'                   : "square lattice",
    'MODEL'                     : "boson Hubbard",
    'L'                         : 4,
    'T'                         : 0.1,
    'U'                         : 1.0,
    'mu'                        : 0.5,
    'Nmax'                      : 2,
    't'                         : 0.05,
    'THERMALIZATION'            : 10000,
    'SWEEPS'                    : 100000,
}]
f = pyalps.writeInputFiles('wm', parms)
pyalps.runApplication('worm', f, Tmin=2)
files = pyalps.getResultFiles(prefix='wm')

print(pyalps.loadMeasurements(files))                          # [[]]
print([s.props['observable'] for s in pyalps.flatten(
    pyalps.loadMeasurements(files, ['Density', 'Stiffness']))])  # ['Density', 'Stiffness']

The file contains Energy, Density, Stiffness, Green's Function, Density Correlations and so on, along with Time interval, Ratio time intervals and Statistics time intervals.

Expected behavior

loadMeasurements(files) returns every observable it can read and skips, or warns about, one it can't, instead of dropping the whole file. Probably the simplest fix is to check that mean exists before reading it, and to catch errors per observable rather than per file.

Environment

  • ALPS / pyalps 3.0.0 (PyPI wheel)
  • macOS 26 (Darwin 25.6), arm64
  • Python 3.14.7

Additional context

Found while writing the measurement examples page for the website (ALPSim/alpsim.github.io#177). Workaround: pass the observable names explicitly.

🤖 Generated with Claude Code

主要言語
C++
スター
32
フォーク
10
平均マージ
3日 19時間
マージ済み PR(30日)
100

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ALPSim/ALPS のほかの issue

ALPSim/ALPS の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。