h5config 0.1
Conveniently save and load config-options from HDF5 and YAML files.
H5config
H5config is a Python package for conviniently saving and loading configuration classes from disk. After populating base configuration classes with parameters, h5config automatically generates HDF5 and YAML backends for saving and loading that class. Yes, all this information could go into a single database, but if you like the flexibility of having a bunch of individual files that you can peek into one at a time, this module is for you.
I wrote the module to support my experiment-control infrastructure, and one of the key goals was to easily embed control parameters in the saved data:
experiment.h5
|-- raw/
| |-- thermocouple: [32757, 32731, 32796, 32789, 32809, ...]
| `-- deflection: [29808, 29793, 29782, 29817, 29775, ...]
|-- timeseries-config/
| |-- frequency: 0.1
| |-- run-time: 100
| |-- thermocouple-channel/
| | |-- conversion-coefficients: [-10.0, 0.000305180437934]
| | `-- conversion-origin: [0.0]
| |-- deflection-channel/
| | |-- conversion-coefficients: [-10.0, 0.000305180437934]
| | `-- conversion-origin: [0.0]
| `-- thermocouple-calibration: [25.08355e3, 7.860106e4]
`-- environment-config/
|-- temperature: 20
`-- timestamp: 1311851980.750180
Storing all of the calibration and conversion factors can get complicated quickly. h5config will keep you organized, and allow you to focus on defining the config options without getting bogged down in the bookkeeping.
As a side effect, h5config also provides some tools to support system- and user-wide configuration files. For example, the pypiezo package uses h5config to automatically detect and load the following config file:
$ cat ~/.pypiezorc.yaml log-level: debug matplotlib: no
Installation
Packages
Gentoo
I've packaged h5config for Gentoo. You need layman and my wtk overlay. Install with:
# emerge -av app-portage/layman # layman --add wtk # emerge -av dev-python/h5config
Usage
See the module docstrings for simple examples.
Testing
Run internal unit tests with:
$ nosetests --with-doctest --doctest-tests h5config
Licence
This project is distributed under the GNU General Public License Version 3 or greater.
Author
W. Trevor King wking@drexel.edu Copyright 2011
- Author: W. Trevor King
- Home Page: http://blog.tremily.us/posts/h5config/
- Download URL: http://git.tremily.us/?p=h5config.git;a=snapshot;h=v0.1;sf=tgz
- License: GNU General Public License (GPL)
- Platform: all
- Provides h5config (0.1)
-
Categories
- Development Status :: 2 - Pre-Alpha
- Intended Audience :: Developers
- Intended Audience :: Science/Research
- License :: OSI Approved :: GNU General Public License (GPL)
- Operating System :: OS Independent
- Programming Language :: Python
- Topic :: Scientific/Engineering
- Topic :: Software Development :: Libraries :: Python Modules
- Package Index Owner: wking
- DOAP record: h5config-0.1.xml
