Package topo :: Package transferfn :: Module basic :: Class TransferFnWithState
[hide private]
[frames] | no frames]

Class TransferFnWithState

source code


Abstract base class for TransferFns that need to maintain a self.plastic parameter.

These TransferFns typically maintain some form of internal history or other state from previous calls, which can be disabled by override_plasticity_state().

Nested Classes [hide private]

Inherited from param.parameterized.Parameterized: __metaclass__

Instance Methods [hide private]
 
__init__(self, **params)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
override_plasticity_state(self, new_plasticity_state)
Temporarily disable plasticity of internal state.
source code
 
restore_plasticity_state(self)
Re-enable plasticity of internal state after an override_plasticity_state call.
source code
 
state_pop(self)
Restore the state saved by the most recent state_push call.
source code
 
state_push(self)
Save the current state onto a stack, to be restored using state_pop.
source code

Inherited from base.functionfamily.TransferFn: __call__

Inherited from param.parameterized.Parameterized: __getstate__, __repr__, __setstate__, __str__, debug, defaults, force_new_dynamic_value, get_param_values, get_value_generator, inspect_value, message, print_param_values, script_repr, set_default, set_dynamic_time_fn, set_param, verbose, warning

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

Class Methods [hide private]

Inherited from param.parameterized.Parameterized: params, print_param_defaults

Class Variables [hide private]
  __abstract = True
bool(x) -> bool
  name = <param.parameterized.String object at 0xb58966c>
String identifier for this object.
  plastic = param.Boolean(default= True, doc= ...
Whether or not to update the internal state on each call.

Inherited from base.functionfamily.TransferFn: norm_value

Inherited from param.parameterized.Parameterized: print_level

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **params)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

override_plasticity_state(self, new_plasticity_state)

source code 

Temporarily disable plasticity of internal state.

This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern (apart from true randomness or other differences that do not depend on an internal state), and no call should have any effect that persists after a subsequent restore_plasticity_state() call.

By default, simply saves a copy of the 'plastic' parameter to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets the plastic parameter to the given value (True or False).

restore_plasticity_state(self)

source code 

Re-enable plasticity of internal state after an override_plasticity_state call.

This function should be implemented by all subclasses to remove the effect of the most recent override_plasticity_state call, i.e. to reenable changes to the internal state, without any lasting effect from the time during which plasticity was disabled.

By default, simply restores the last saved value of the 'plastic' parameter.

state_pop(self)

source code 
Restore the state saved by the most recent state_push call.
Overrides: param.parameterized.Parameterized.state_pop

state_push(self)

source code 

Save the current state onto a stack, to be restored using state_pop.

Subclasses must implement state_push and state_pop if they store any lasting state across invocations, so that the result of state_pop will be the state that was present at the previous state_push.

Overrides: param.parameterized.Parameterized.state_push

Class Variable Details [hide private]

__abstract

bool(x) -> bool

Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.

Value:
True

plastic

Whether or not to update the internal state on each call. Allows plasticity to be turned off during analysis, and then re-enabled.
Value:
param.Boolean(default= True, doc= """
        Whether or not to update the internal state on each call.
        Allows plasticity to be turned off during analysis, and then re-enabled.""\
")