omde.functional
index
/usr/local/lib/python2.1/site-packages/omde/functional.py

 
Modules
            
copy
types

 
Classes
            
FunctionModel
Function
AddFunction
ConstantFunction
DivFunction
MulFunction
SubFunction
TeeFunction
TimeDependenceAdaptor
Generator
AddGenerator
ConstantGenerator
DivGenerator
Freezer
MulGenerator
SubGenerator
TeeGenerator

 
class AddFunction(Function)
      Add function
 
Given two Functions a and b, this function returns a + b
 
  
__add__(self, function) from Function
__call__(self, t)
Return the sum of the values of the two
functions at time t.
__div__(self, function) from Function
__init__(self, a, b)
Return an AddFunction instance for two given
Functions a and b.
 
a and b are made Function if necessary and possible.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class AddGenerator(Generator)
      Add generator
 
Given two generators a and b, this generator returns a + b
 
  
__add__(self, object) from Generator
__call__(self)
Return the sum of the next values of the two
generators.
__div__(self, object) from Generator
__init__(self, a, b)
Return an AddGenerator instance for two given
Generators a and b.
 
a and b are made Generator if necessary and possible.
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class ConstantFunction(Function)
      Constant function
 
it returns the same value at any time.
 
  
__add__(self, function) from Function
__call__(self, t)
Return the constant value at any time.
__div__(self, function) from Function
__init__(self, value)
Return a ConstantFunction instance.
 
The original value object is deep-copied, if possible.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class ConstantGenerator(Generator)
      Constant generator.
 
The original object is deep-copied, if possible.
 
  
__add__(self, object) from Generator
__call__(self)
__div__(self, object) from Generator
__init__(self, value)
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class DivFunction(Function)
      Div function
 
Given two functions a and b, this function returns a / b
 
  
__add__(self, function) from Function
__call__(self, t)
Return the quotient of the values of the two
functions at time t.
__div__(self, function) from Function
__init__(self, a, b)
Return a DivFunction instance for two given
Functions a and b.
 
a and b are made Function if necessary and possible.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class DivGenerator(Generator)
      Div generator
 
Given two generators a and b, this generator returns a / b
 
  
__add__(self, object) from Generator
__call__(self)
Return the quotient of the next values of the two
generators.
__div__(self, object) from Generator
__init__(self, a, b)
Return a DivGenerator instance for two given
Generators a and b.
 
a and b are made Generator if necessary and possible.
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class Freezer(Generator)
      Convert a Function into a Generator.
 
  
__add__(self, object) from Generator
__call__(self)
__div__(self, object) from Generator
__init__(self, f, t=0.0)
Return a Freezer instance.
 
f is the freezed function.
t is the freeze time (default is 0.0).
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class Function(FunctionModel)
      Abstract base class for functional scoring
 
A subclass of Function must define the __call__(self, t) method,
where t is the evaluation time.
 
Function is also a FunctionModel (of itself).
 
You can also use arithmetic operators
(+, -, *, /) between generators and get the result generator.
 
  
__add__(self, function)
+ operator implementation.
__call__(self, t)
Return the function value at time t.
 
Pure virtual method.
__div__(self, function)
/ operator implementation.
__init__(self)
Return a function instance.
__mul__(self, function)
* operator implementation.
__radd__(self, function)
+ operator implementation (object is on the right)).
__rdiv__(self, function)
/ operator implementation (object is on the right)).
__rmul__(self, function)
* operator implementation (object is on the right)).
__rsub__(self, function)
- operator implementation (object is on the right)).
__sub__(self, function)
- operator implementation.
instance(self, begin, end)
Return self as instance of this Function.

 
class FunctionModel
      Base class for function models.
 
  
__init__(self)
Return a FunctionalModel instance
 
It is an incomplete instance.
instance(self, begin, end)
Return an instance for this FunctionModel as
a real Function.
 
Function is defined in the [begin, end] range.
 
Pure virtual method.

 
class Generator
      Time-independent data generator base class.
 
The call method takes no arguments.
 
You can also use arithmetic operators (+, -, *, /) between
generators and get the result generator.
 
  
__add__(self, object)
+ operator implementation.
__call__(self)
__div__(self, object)
/ operator implementation.
__init__(self)
__mul__(self, object)
* operator implementation.
__radd__(self, object)
+ operator implementation (object is on the right)).
__rdiv__(self, object)
/ operator implementation (object is on the right)).
__rmul__(self, object)
* operator implementation (object is on the right)).
__rsub__(self, object)
- operator implementation (object is on the right)).
__sub__(self, object)
- operator implementation.

 
class MulFunction(Function)
      Mul function
 
Given two functions a and b, this function returns a * b
 
  
__add__(self, function) from Function
__call__(self, t)
Return the product of the values of the two
functions at time t.
__div__(self, function) from Function
__init__(self, a, b)
Return a MulFunction instance for two given
Functions a and b.
 
a and b are made Function if necessary and possible.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class MulGenerator(Generator)
      Mul generator
 
Given two generators a and b, this generator returns a * b
 
  
__add__(self, object) from Generator
__call__(self, t)
Return the product of the next values of the two
generators.
__div__(self, object) from Generator
__init__(self, a, b)
Return a MulGenerator instance for two given
Generators a and b.
 
a and b are made Generator if necessary and possible.
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class SubFunction(Function)
      Sub function
 
Given two functions a and b, this function returns a - b
 
  
__add__(self, function) from Function
__call__(self, t)
Return the difference of the values of the two
functions at time t.
__div__(self, function) from Function
__init__(self, a, b)
Return an SubFunction instance for two given
Functions a and b.
 
a and b are made Function if necessary and possible.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class SubGenerator(Generator)
      Sub generator
 
Given two generators a and b, this generator returns a - b
 
  
__add__(self, object) from Generator
__call__(self)
Return the difference of the next values of the two
generators.
__div__(self, object) from Generator
__init__(self, a, b)
Return a SubGenerator instance for two given
Generators a and b.
 
a and b are made Generator if necessary and possible.
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class TeeFunction(Function)
       
  
__add__(self, function) from Function
__call__(self, t)
__div__(self, function) from Function
__init__(self, f)
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
class TeeGenerator(Generator)
       
  
__add__(self, object) from Generator
__call__(self)
__div__(self, object) from Generator
__init__(self, g)
__mul__(self, object) from Generator
__radd__(self, object) from Generator
__rdiv__(self, object) from Generator
__rmul__(self, object) from Generator
__rsub__(self, object) from Generator
__sub__(self, object) from Generator

 
class TimeDependenceAdaptor(Function)
      This function turns allows you to use a generator
where a function is needed.
 
  
__add__(self, function) from Function
__call__(self, t)
Return the function value at time t.
 
Beware: the next value of the generator is returned at each
call. So evaluating this object twice at the same instant
could return two different values.
__div__(self, function) from Function
__init__(self, tig)
Return a TimeDependenceAdaptor instance.
 
tig is a time independent Generator.
__mul__(self, function) from Function
__radd__(self, function) from Function
__rdiv__(self, function) from Function
__rmul__(self, function) from Function
__rsub__(self, function) from Function
__sub__(self, function) from Function
instance(self, begin, end) from Function

 
Functions
            
make_function(object, begin=None, end=None)
Convert an object to a function.
 
If object is a function, make_function() returns object.
 
If object is a Generator make_function() performs adaptation
and return the resulting Function.
 
If object is a FunctionModel it is instanced and make_function()
returns the resulting function.
But if both begin and end are None, make_function() expects only
ready-to-use generators and not models.
 
Everything else is turned into a ConstantFunction.
make_generator(object, t0=0.0)
Convert an object to a generator.
 
If object is a Generatormake_generator() returns object.
Function be converted to a Generator by freezing it at t0.
Everything else is turned into a ConstantGenerator.

 
Data
             __file__ = '/usr/local/lib/python2.1/site-packages/omde/functional.pyc'
__name__ = 'omde.functional'