Package diffpy :: Package pdfgui :: Package control :: Module constraint :: Class Constraint
[hide private]
[frames] | no frames]

Class Constraint

source code

Constraint --> storage and check of a single constraint equation

Data members:
    formula  -- right-side of constraint equation (string).  When
                assigned it is checked for math correctness and updates
                the parguess dictionary
    parguess -- read-only dictionary of parameter indices and their
                estimated initial values.  Values are None if they
                cannot be estimated.

Private members:
    __lhs    -- last value of constrained variable passed to guess()



Instance Methods [hide private]
 
__init__(self, formula, value=None)
initialize the Constraint.
source code
 
evalFormula(self, parvalues)
evaluate constraint formula parvalues -- dictionary of int parameter indices and float values.
source code
 
lambdaFormula(self)
Build lambda function from constraint formula.
source code
 
guess(self, value)
guess the initial values of parameters contained in parguess value -- current value of the constrained variable The keys of self.parguess are indices of parameters used in formula, and the values are suggested parameter values (None if they cannot be estimated).
source code
 
__setattr__(self, name, value)
check math and update parguess when formula is assigned...
source code
Method Details [hide private]

__init__(self, formula, value=None)
(Constructor)

source code 
initialize the Constraint.

formula  -- (string) right-side of constraint equation
value    -- (optional) current value of the variable

__init__ raises ControlSyntaxError when formula is incorrect

evalFormula(self, parvalues)

source code 
evaluate constraint formula

parvalues -- dictionary of int parameter indices and float values.

returns formula result

lambdaFormula(self)

source code 
Build lambda function from constraint formula.
Lambda function expects dictionary argument.

returns lambda function

guess(self, value)

source code 
guess the initial values of parameters contained in parguess

value -- current value of the constrained variable

The keys of self.parguess are indices of parameters used in formula,
and the values are suggested parameter values (None if they cannot
be estimated).

returns a copy of self.parguess

__setattr__(self, name, value)

source code 
check math and update parguess when formula is assigned