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

Miscellaneous data generators for OMDE/pmask:
 
RangeAccumulatorQuantizerMask and List are
the standard Cmask generators.
 
Attactor, ChoiceStaticChoice are new in
pmask.

 
Modules
            
copy
math
omde
types

 
Classes
            
omde.functional.Function(omde.functional.FunctionModel)
Accumulator
Attractor
Choice
Mask
Quantizer
StaticChoice
omde.functional.Generator
IntRange
List
Range
_MarkAccumulator
_MarkAccumulatorEvaluate
_PossibleChoice

 
class Accumulator(omde.functional.Function)
      Accumulator(generator, mode = 'unbound', lower = None, upper = None, sum0 = 0)
 
Accumulator adds the values of generator at each call and returns the partial
result.
 
If mode is 'unbound' or 'u', the absolute value of the sum is allowed to
grow without limits.
 
If mode is 'limit' or 'l', the sum will be limited to the [lower, upper] range.
 
If mode is 'reflect' or 'r' or 'mirror' or 'm', the Accumulator folds values
inside the [lower, upper] range.
 
If mode 'wrap' or 'w', the Accumulator performs a wrap around.
 
lower and upper can be generators.
 
An Accumulator can be initialized by passing the sum0 argument.
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, generator, mode='unbound', lower=None, upper=None, sum0=0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function
limitAtBounds(self, value, t)
noBounds(self, value, t)
reflectAtBounds(self, value, t)
wrapAtBounds(self, value, t)

 
class Attractor(omde.functional.Function)
       
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, generator, points, strength=1.0, exponent=0.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
findClosest(self, value, t)
instance(self, begin, end) from omde.functional.Function

 
class Choice(omde.functional.Function)
      Choice((object1, probability1)...)
 
This is a time-independent generator which performs
a weighted choice from its set of items.
 
 
 
for example the following generator
 
Choice((0, 10), (5: 1))
 
returns ten times more often 0 than 5.
 
Probabilities may be generators: they
are evaluated and normalized. This way you can
use time-varying configuration of probability.
If you don't need this feature use StaticChoice
instead.
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, pair0, *pairs)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class IntRange(omde.functional.Generator)
      This generator returns an integer random value uniformly
distributed between min and max.
 
min and max are constant.
If you want time-dependent boundaries, use
the more generic tendency Mask.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self, min, max)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class List(omde.functional.Generator)
      List(... [, mode=...])
 
This a time-independent generator. It stores a set of items
and return one of them each one it is called.
The next item returned depends on the mode parameter
 
mode = 'cycle'
the list traversed in its natural order, after the last
item, the generator begins again from the first
 
mode = 'swing'
the generator goes back and forth, without repetition
of the last element
 
mode = 'swing-repeat'
the generator goes back and forth, with repetition of
the last element
 
mode = 'heap'
the generators computes all permutation of the given
set and traverse them all
 
mode = 'random'
one item is chosen at random (with replacement). The
item have the same probability (but you can insert
some of them more than once.
If you want a more sophisitaced weighted random choice,
use Choice.
 
The items are copied, so you can safely change them
after you put them in the List.
List items are _not_ evaluated.
 
Default mode is 'cycle'.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self, *list0, **dict)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator
computePermutations(self, list)
cycle_next(self)
random_next(self)
swapAdiacentElements(self, list, n)
swing_next(self)

 
class Mask(omde.functional.Function)
      Mask(mainFunction, lowerLimit, upperLimit, exp = 0.0)
 
The Mask generator is a transformer. It maps the values of the main
generator in the interval [lowerLimit, upperLimit], the extremes of
the interval being two generators.
The main generator should be normalized for Mask to work properly.
Random generator of the pmask.rng module valid main generators for
pmask.
 
exp is the exponent of the mapping function. It defaults to zero
(linear mapping). As usual in the Cmask language the real exponent
is 2^exp.
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, mainFunction, lowerLimit, upperLimit, exp=0.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function
mapAt(self, value, t)

 
class Quantizer(omde.functional.Function)
       
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, generator, delta, strength=1.0, offset=0.0)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class Range(omde.functional.Generator)
      This generator returns a random value uniformly
distributed between min and max.
 
min and max are constant.
If you want time-dependent boundaries, use
the more generic tendency Mask.
 
  
__add__(self, object) from omde.functional.Generator
__call__(self)
__div__(self, object) from omde.functional.Generator
__init__(self, min, max)
__mul__(self, object) from omde.functional.Generator
__radd__(self, object) from omde.functional.Generator
__rdiv__(self, object) from omde.functional.Generator
__rmul__(self, object) from omde.functional.Generator
__rsub__(self, object) from omde.functional.Generator
__sub__(self, object) from omde.functional.Generator

 
class StaticChoice(omde.functional.Function)
      StaticChoice(set)
 
StaticChoice is a variant of Choice.
Please read the Choice documentation.
The only different is that items probabilities
are fixed and will not be evaluated.
 
  
__add__(self, function) from omde.functional.Function
__call__(self, t)
__div__(self, function) from omde.functional.Function
__init__(self, pair, *pairs)
__mul__(self, function) from omde.functional.Function
__radd__(self, function) from omde.functional.Function
__rdiv__(self, function) from omde.functional.Function
__rmul__(self, function) from omde.functional.Function
__rsub__(self, function) from omde.functional.Function
__sub__(self, function) from omde.functional.Function
instance(self, begin, end) from omde.functional.Function

 
class _MarkAccumulator
      Internal helper class
 
  
__call__(self, possible_choice)
__init__(self, factor)

 
class _MarkAccumulatorEvaluate
      Internal helper class
 
  
__call__(self, possible_choice)
__init__(self, t, factor)

 
class _PossibleChoice
      Internal helper class
 
  
__init__(self, object, probability)

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