Package npsgd :: Module model_parameters :: Class ModelParameter
[hide private]
[frames] | no frames]

Class ModelParameter

source code

object --+
         |
        ModelParameter
Known Subclasses:

Model parameter - keeps track of arguments to a model.

This object has a dual purpose, first to declare the parameters that are actually needed by a module and secondly to keep track of the values of that parameter. To switch between the two, a call to "withValue" creates a copy of the parameter, this time with a given value.

Note: this is a lot less screwy than it sounds.

Instance Methods [hide private]
 
__init__(self, name)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
withValue(self, value)
Instantiates a copy of the model parameter with a given value.
source code
 
asDict(self) source code
 
fromDict(self, d) source code
 
asMatlabCode(self)
Converts an instance of this parameter (with value) into matlab code.
source code
 
asHTML(self)
Returns this parameter as HTML.
source code
 
hiddenHTML(self)
Returns this parameter as hidden HTML.
source code
 
helpHTML(self)
Returns HTML helptext for this parameter (directly for inclusion)
source code
 
nonExistValue(self)
Gives a value of this parameter does not exist (i.e.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

withValue(self, value)

source code 

Instantiates a copy of the model parameter with a given value.

The setValue method will return a ValidationError if validation fails, so this method implicitly performs parameter verification.

asMatlabCode(self)

source code 

Converts an instance of this parameter (with value) into matlab code.

This is used to inject copies of the parameters __directly__ into the Matlab namespace.

nonExistValue(self)

source code 

Gives a value of this parameter does not exist (i.e. in a post request).

This is mostly useful for the screwy way browsers handle "checkbox" parameters, by simply not sending the key when the checkbox is unchecked.