Package topo :: Package base :: Module parameterclasses :: Class Integer
[hide private]
[frames] | no frames]

Class Integer

source code

                   object --+            
                            |            
parameterizedobject.Parameter --+        
                                |        
                          Dynamic --+    
                                    |    
                               Number --+
                                        |
                                       Integer

Number is a numeric parameter. Numbers have a default value, and bounds. There are two types of bounds: bounds and softbounds. bounds are hard bounds: the parameter must have a value within the specified range. The default bounds are (None,None), meaning there are actually no hard bounds. One or both bounds can be set by specifying a value (e.g. bounds=(None,10) means there is no lower bound, and an upper bound of 10).

Number is also a type of Dynamic parameter, so its value can be set to a callable to get a dynamically generated number (see Dynamic).

When not being dynamically generated, bounds are checked when a Number is created or set. Using a default value outside the hard bounds, or one that is not numeric, results in an exception. When being dynamically generated, bounds are checked when a the value of a Number is requested. A generated value that is not numeric, or is outside the hard bounds, results in an exception.

A separate function set_in_bounds() is provided that will silently crop the given value into the legal range, for use in, for instance, a GUI.

softbounds are present to indicate the typical range of the parameter, but are not enforced. Setting the soft bounds allows, for instance, a GUI to know what values to display on sliders for the Number.

Example of creating a Number::
AB = Number(default=0.5, bounds=(None,10), softbounds=(0,1), doc='Distance from A to B.')


Nested Classes [hide private]

Inherited from parameterizedobject.Parameter: __metaclass__

Instance Methods [hide private]
 
_check_value(self, val)
Checks that the value is numeric and that it is within the hard bounds; if not, an exception is raised.
source code

Inherited from Number: __get__, __init__, __set__, crop_to_bounds, get_soft_bounds, set_in_bounds

Inherited from Dynamic: time_fn

Inherited from parameterizedobject.Parameter: __delete__, __getstate__, __setstate__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from Number: bounds

Inherited from Number (private): _softbounds

Inherited from parameterizedobject.Parameter: constant, default, doc, instantiate, precedence, readonly

Inherited from object: __class__

Method Details [hide private]

_check_value(self, val)

source code 
Checks that the value is numeric and that it is within the hard bounds; if not, an exception is raised.
Overrides: Number._check_value
(inherited documentation)