TRIQS / triqs

a Toolbox for Research on Interacting Quantum Systems
https://triqs.github.io
GNU General Public License v3.0
141 stars 72 forks source link

Exessive warnings when reading "old" Gf from hdf5 #886

Closed HugoStrand closed 1 year ago

HugoStrand commented 1 year ago

Currently one is flooded in warnings when reading old gfs from an hdf5 file

Warning : The hdf5 format GfIndices is not recognized. Returning as a group. Hint : did you forgot to import this python class ?
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long

The Green's functions produced are still fine, but it would be nice to have a quiet backwards compatibility.

the-hampel commented 1 year ago

I also noticed this. We should fix this warning somehow!

Wentzell commented 1 year ago

Thank you for pointing this out. Not immediately obvious how to suppress this as it's fairly deep in the h5 layer, and the warnings are in general sensible for mismatching reads or unknown types.

@parcollet Any opinion on this?

the-hampel commented 1 year ago

Hi @HugoStrand, at least the GfIndices warning should be now fixed with the two PR's merged above. Can you rebuild triqs (including h5 dependency) with the latest unstable commit and check if the issue is fixed?

When are you getting the

WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long

warning? So far I did not saw this one.

Wentzell commented 1 year ago

@HugoStrand Can you let us know for which Green function type you are seeing the second warning

WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
HugoStrand commented 1 year ago

@Wentzell @the-hampel I think the storage scheme in the Legendre Green's function has changed. It is one case that triggers this warning.

The output

WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long
WARNING: Mismatching types in h5_read. Expecting a long while the array stored in the hdf5 file has type unsigned long

Is generated by the example code

from triqs.gf import *
from h5 import HDFArchive

filename = './test.h5'
with HDFArchive(filename, 'r') as a:
    G_l = a['G_l']

using this hdf5 data file with a few years old Legendre Green's function: test.tar.gz

Wentzell commented 1 year ago

Thank you @HugoStrand for the minimal example. This was now addressed in 4f8dc18