3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00

hdfarchive + gf : two corrections

- hdfarchive : transform the key to string with str
  because they can be unicode and C wrapper does not convert python unicode strings.
- gf : Correct the scheme for BlockGf : not very clean, to be improved ?
This commit is contained in:
Olivier Parcollet 2014-07-08 23:23:03 +02:00
parent ab3b9b3d4d
commit a6e1528730
2 changed files with 3 additions and 2 deletions

View File

@ -253,7 +253,7 @@ class HDFArchiveGroup (HDFArchiveGroupBasicLayer) :
except KeyError : except KeyError :
raise RuntimeError, "I can not find the class %s to reconstruct the object !"%r_class_name raise RuntimeError, "I can not find the class %s to reconstruct the object !"%r_class_name
if r_readfun : if r_readfun :
res = r_readfun(self._group,key) res = r_readfun(self._group,str(key)) # str transforms unicode string to regular python string
elif "__factory_from_dict__" in dir(r_class) : elif "__factory_from_dict__" in dir(r_class) :
f = lambda K : SUB.__getitem1__(K,reconstruct_python_object) if SUB.is_group(K) else SUB._read(K) f = lambda K : SUB.__getitem1__(K,reconstruct_python_object) if SUB.is_group(K) else SUB._read(K)
values = dict( (self._key_decipher(K),f(K)) for K in SUB ) values = dict( (self._key_decipher(K),f(K)) for K in SUB )

View File

@ -320,7 +320,8 @@ namespace gfs {
//----------------------------- HDF5 ----------------------------- //----------------------------- HDF5 -----------------------------
friend std::string get_triqs_hdf5_data_scheme(gf_impl const &g) { friend std::string get_triqs_hdf5_data_scheme(gf_impl const &g) {
return "Gf" + gfs_implementation::h5_name<Variable, Target, Opt>::invoke(); auto s = gfs_implementation::h5_name<Variable, Target, Opt>::invoke();
return (s == "BlockGf" ? s : "Gf" + s);
} }
friend struct gfs_implementation::h5_rw<Variable, Target, Opt>; friend struct gfs_implementation::h5_rw<Variable, Target, Opt>;