5. The cpl.Parameter class

class cpl.Parameter(name)

Runtime configuration parameter of a recipe. Parameters are designed to handle monitor/control data and they provide a standard way to pass information to the recipe.

The CPL implementation supports three classes of parameters: a plain value, a value within a given range, or a value as part of an enumeration. When a parameter is created it is created for a particular value type. In the latter two cases, validation is performed whenever the value is set.

Attributes:

value

The value of the parameter, or None if set to default

default

The default value of the parameter (readonly).

name

The parameter name (readonly). Parameter names are unique. They define the identity of a given parameter.

context

The parameter context (readonly). The context usually consists of the instrument name and the recipe name, separated by a dot. The context is used to associate parameters together.

range

The numeric range of a parameter, or None if the parameter range is unlimited (readonly).

sequence

A list of possible values for the parameter if the parameter are limited to an enumeration of possible values (readonly).

The following example prints the attributes of one parameter:

>>> print 'name:    ', muse_scibasic.param.cr.name
name:     cr
>>> print 'fullname:', muse_scibasic.param.cr.fullname
fullname: muse.muse_scibasic.cr
>>> print 'context: ', muse_scibasic.param.cr.context
context:  muse.muse_scibasic
>>> print 'sequence:', muse_scibasic.param.cr.sequence
sequence: ['dcr', 'none']
>>> print 'range:   ', muse_scibasic.param.cr.range
range:    None
>>> print 'default: ', muse_scibasic.param.cr.default
default:  dcr
>>> print 'value:   ', muse_scibasic.param.cr.value
value:    None

See also

Recipe.param