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

Aperta Adatta ai principianti
#421 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Inizia da pyalps/load.py, in particolare da Hdf5Loader.ReadMeasurementFromFile e dalla gestione delle eccezioni per file descritta nell’issue. Controlla come il loader gestisce gli observables senza un gruppo mean, poi esegui la riproduzione con risultati worm e verifica che loadMeasurements(files) restituisca observables leggibili come Density e Stiffness, ignorando Time interval o mostrando un avviso al riguardo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C++
Stelle
32
Fork
10
Merge medio
3g 19h
PR unite (30g)
100

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ALPSim/ALPS

Tutte le issue di ALPSim/ALPS

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.