Tabel of contents¶
Content¶
The jicparameters
Python package¶
Python package making it easier to work with lots of parameters.
- Documentation: http://jicparameters.readthedocs.io
- GitHub: https://github.com/JIC-CSB/jicparameters
- Free software: MIT License
Features¶
- Lightweight: only depends on PyYAML
- Cross-platform: Linux, Mac and Windows are all supported
- Tested with Python 2.7, 3.3, 3.4, and 3.5
Quick Guide¶
To install jicparameters
:
git clone https://github.com/JIC-CSB/jicparameters.git
cd jicparameters
python setup.py install
Create some parameters:
>>> from jicparameters import Parameters
>>> params = Parameters(pi=3.14, radius=10)
>>> params
{'pi': 3.14, 'radius': 10}
Add another parameter:
>>> params["fudge_factor"] = 42
>>> params
{'fudge_factor': 42, 'pi': 3.14, 'radius': 10}
View as YAML:
>>> print(params.to_yaml())
---
fudge_factor: 42
pi: 3.14
radius: 10
Save to file:
>>> params.to_file("params.yml")
Read from file:
>>> p2 = Parameters.from_file("params.yml")
>>> assert params == p2
API documentation¶
jicparameters
¶
Module to make it easier to work with lots of parameters.
-
class
jicparameters.
Parameters
¶ Class for storing, reading in and writing out parameters.
-
classmethod
from_file
(fpath)¶ Read parameters from file.
-
classmethod
from_yaml
(string)¶ Return Parameter instance from yaml string.
-
to_file
(fpath)¶ Write parameters to file.
-
to_yaml
()¶ Return yaml string representation.
-
classmethod