import SciParam
param = SciParam.StringParam('name')
import SciParam.parameter
param = SciParam.parameter.StringParam('name')
from SciParam import FloatParam, IntParam, StringParam, ChoiceParam, DistParam
param = StringParam('name')
from SciParam import *
param = StringParam('name')
Every parameter instance must have a name and can have a description, a unit, a default value, a current value and a comment. Additionally there is the required flag and the notunknown flag. See the description of the SciParam class for details.
If you want to import them, use one of these methods:
import SciParam range1 = SciParam.Range() dist1 = SciParam.Distribution()
import SciParam.range import SciParam.distribution range1 = SciParam.range.Range() dist1 = SciParam.distribution.Distribution()
from SciParam import Range, Distribution range1 = Range() dist1 = Distribution()
from SciParam import * range1 = Range() dist1 = Distribution()
See the description of the Range class and the description of the Distribution class for details.
#!/usr/bin/env python
#
# Copyright (C) 2002 by Intevation GmbH
# Authors:
# Thomas Koester <tkoester@intevation.de>
#
# This program is free software under the GPL (>=v2)
# Read the file COPYING coming with the software for details.
"""
Scientific Parameters
"""
from SciParam import FloatParam, IntParam, StringParam, ChoiceParam, DistParam
if __name__ == "__main__":
parameter = [
StringParam('Name', 'a unique identifier', required=1,
value='Silicon',
comment='This is an example for a required value.\n'
'The user can change this comment to note the '
'source of this information.'),
StringParam('Symbol', 'chemical symbol', required=1, value='Si'),
IntParam('Atomic No',
'Number in the periodic table of the elements',
value=14, wrange='[1;260]', erange='[1;oo['),
FloatParam('Atomic Mass', None, value=28.0855, erange='[0;oo['),
FloatParam('Melting Point', 'under normal conditions', '°C',
value=1414,
wrange='[-273.15;4e3]', erange='[-273.15;oo['),
FloatParam('Boiling Point', 'under normal conditions', '°C',
value=3265, wrange='[-270;6e3]', erange='[-273.15;oo['),
ChoiceParam('Crystal', 'crystal structure',
choices=[None, 'simple cubic', 'face centered cubic',
'body centered cubic', 'diamond cubic',
'tetragonal', 'orthorombic', 'monoclinc'],
value='face centered cubic', long=1),
DistParam('Temperature', 'temperature of samples', '°C',
default=20, value=17.5, erange='[-273.15;oo[',
dist=(3.7, 'normal')),
DistParam('Volume', 'Volume of used samples', 'cm³',
default='2;20/uniform', erange='[0;oo['),
ChoiceParam('Verified', 'Have these values been checked?',
choices=ChoiceParam.yes_no, value=0),
]
for par in parameter:
print par.name, "=", par.value
print " comment =", par.comment
if isinstance(par, DistParam):
print " dist =", par.dist