ParamIterators
index
/home/tessonec/devel/PySPG/ParamIterators.py

###########################################################################
# :::~ Copyright (C) 2005 by Claudio J. Tessone <tessonec@imedea.uib.es>                                                        

# Created on: 09 Jan 2005
#
# Copyright: Distributed according to GNU/GPL Version 2 
#            (see http://www.gnu.org)
#
###########################################################################

 
Modules
       
sys

 
Classes
       
SPGIterator
ItConstant
ItOperator
ItOperatorDivision
ItOperatorMinus
ItOperatorPlus
ItOperatorPower
ItOperatorProduct
ItPunctual
ItRepetition

 
class ItConstant(SPGIterator)
    This subclass generates a constant "iteration" type
 
  Methods defined here:
__init__(self)
is_variable(self)
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
next(self)
reset(self)

 
class ItOperator(SPGIterator)
    This subclass generates the values for classes defined according to the rule
@var_name val_min val_max step
where @ is the operation defined for the data type. 
var_name is the variable name
val_min, val_max the bounds
step  the step
the actualization process runs according to actual_value = actual_value @ step
 
  Methods defined here:
__init__(self, it_type)
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItOperatorDivision(ItOperator)
    
Method resolution order:
ItOperatorDivision
ItOperator
SPGIterator

Methods defined here:
__init__(self)

Methods inherited from ItOperator:
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItOperatorMinus(ItOperator)
    
Method resolution order:
ItOperatorMinus
ItOperator
SPGIterator

Methods defined here:
__init__(self)

Methods inherited from ItOperator:
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItOperatorPlus(ItOperator)
    
Method resolution order:
ItOperatorPlus
ItOperator
SPGIterator

Methods defined here:
__init__(self)

Methods inherited from ItOperator:
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItOperatorPower(ItOperator)
    
Method resolution order:
ItOperatorPower
ItOperator
SPGIterator

Methods defined here:
__init__(self)

Methods inherited from ItOperator:
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItOperatorProduct(ItOperator)
    
Method resolution order:
ItOperatorProduct
ItOperator
SPGIterator

Methods defined here:
__init__(self)

Methods inherited from ItOperator:
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItPunctual(SPGIterator)
    This subclass generates a list of defined values in command
command should be
.var_name value1 value2 value3 
... and so on
 
  Methods defined here:
__init__(self)
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)

 
class ItRepetition(SPGIterator)
    This subclass generates a list of null with length defined
useful when trying to repit the run of the program with the same parameters
 
  Methods defined here:
__init__(self)
is_variable(self)
set_command(self, command, separator=' ')

Methods inherited from SPGIterator:
__iter__(self)
get_value(self)
get_varname(self)
next(self)
reset(self)

 
class SPGIterator
    This is a subsidiary abstract class for the ParamParser one.
It defines the iteration type in the constructor. Must be subclassed (it's abstract)
In principle there is no need to touch anything here (well, you can always improve the code)
only you must subclass this object if you wish to add other iterator types
 
  Methods defined here:
__init__(self)
__iter__(self)
get_value(self)
get_varname(self)
is_variable(self)
next(self)
reset(self)
set_command(self)
this is the function called to generate all the possible values of the iterator
it returns the variable name and all the possible values it can take
command holds the input line in the parameters file, 
separator is the character delimiting fields
(if separator=None, any space is considered a separator)

 
Functions
       
acos(...)
acos(x)
 
Return the arc cosine (measured in radians) of x.
asin(...)
asin(x)
 
Return the arc sine (measured in radians) of x.
atan(...)
atan(x)
 
Return the arc tangent (measured in radians) of x.
atan2(...)
atan2(y, x)
 
Return the arc tangent (measured in radians) of y/x.
Unlike atan(y/x), the signs of both x and y are considered.
ceil(...)
ceil(x)
 
Return the ceiling of x as a float.
This is the smallest integral value >= x.
cos(...)
cos(x)
 
Return the cosine of x (measured in radians).
cosh(...)
cosh(x)
 
Return the hyperbolic cosine of x.
degrees(...)
degrees(x) -> converts angle x from radians to degrees
exp(...)
exp(x)
 
Return e raised to the power of x.
fabs(...)
fabs(x)
 
Return the absolute value of the float x.
floor(...)
floor(x)
 
Return the floor of x as a float.
This is the largest integral value <= x.
fmod(...)
fmod(x,y)
 
Return fmod(x, y), according to platform C.  x % y may differ.
frexp(...)
frexp(x)
 
Return the mantissa and exponent of x, as pair (m, e).
m is a float and e is an int, such that x = m * 2.**e.
If x is 0, m and e are both 0.  Else 0.5 <= abs(m) < 1.0.
hypot(...)
hypot(x,y)
 
Return the Euclidean distance, sqrt(x*x + y*y).
ldexp(...)
ldexp(x, i) -> x * (2**i)
log(...)
log(x[, base]) -> the logarithm of x to the given base.
If the base not specified, returns the natural logarithm (base e) of x.
log10(...)
log10(x) -> the base 10 logarithm of x.
modf(...)
modf(x)
 
Return the fractional and integer parts of x.  Both results carry the sign
of x.  The integer part is returned as a real.
pow(...)
pow(x,y)
 
Return x**y (x to the power of y).
radians(...)
radians(x) -> converts angle x from degrees to radians
sin(...)
sin(x)
 
Return the sine of x (measured in radians).
sinh(...)
sinh(x)
 
Return the hyperbolic sine of x.
sqrt(...)
sqrt(x)
 
Return the square root of x.
tan(...)
tan(x)
 
Return the tangent of x (measured in radians).
tanh(...)
tanh(x)
 
Return the hyperbolic tangent of x.

 
Data
        e = 2.7182818284590451
pi = 3.1415926535897931