Skip to content

Commit

Permalink
Merge pull request #14 from jakobj/restore_old_load_h5
Browse files Browse the repository at this point in the history
Restore old load h5
  • Loading branch information
mschmidt87 committed Mar 10, 2016
2 parents ac0e9eb + 4b2be1c commit 7243f35
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ def load_h5_old(filename, sep='_'):
return dic


# builds a nested dictionary out of a flattened dictionary
def unflatten(dictionary, separator='_'):
resultDict = dict()
for key, value in dictionary.iteritems():
parts = key.split(separator)
d = resultDict
for part in parts[:-1]:
if part not in d:
d[part] = dict()
d = d[part]
d[parts[-1]] = value
return resultDict

######################################################################
# b) New Version

Expand Down

0 comments on commit 7243f35

Please sign in to comment.