Package timeside :: Package analyzer :: Module h5tools
[hide private]
[frames] | no frames]

Source Code for Module timeside.analyzer.h5tools

 1  # -*- coding: utf-8 -*- 
 2  # 
 3  # Copyright (c) 2007-2013 Parisson SARL 
 4   
 5  # This file is part of TimeSide. 
 6   
 7  # TimeSide is free software: you can redistribute it and/or modify 
 8  # it under the terms of the GNU General Public License as published by 
 9  # the Free Software Foundation, either version 2 of the License, or 
10  # (at your option) any later version. 
11   
12  # TimeSide is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details. 
16   
17  # You should have received a copy of the GNU General Public License 
18  # along with TimeSide.  If not, see <http://www.gnu.org/licenses/>. 
19   
20  # Author: 
21  #   Thomas Fillon <thomas  at parisson.com> 
22   
23   
24 -def dict_to_hdf5(dict_like, h5group):
25 """ 26 Save a dictionnary-like object inside a h5 file group 27 """ 28 # Write attributes 29 attrs = dict_like.keys() 30 for name in attrs: 31 if dict_like[name] is not None: 32 h5group.attrs[str(name)] = dict_like[name]
33 34
35 -def dict_from_hdf5(dict_like, h5group):
36 """ 37 Load a dictionnary-like object from a h5 file group 38 """ 39 # Read attributes 40 for name, value in h5group.attrs.items(): 41 dict_like[name] = value
42