if hasattr(Q,"asfullmatrix"): Qn = Q.asfullmatrix(__n)
else: Qn = Q
#
- self.StoredVariables["Analysis"].store( Xb.A1 )
- if self._toStore("APosterioriCovariance"):
- self.StoredVariables["APosterioriCovariance"].store( Pn )
- covarianceXa = Pn
- Xa = XaMin = Xb
+ if len(self.StoredVariables["Analysis"])==0 or not self._parameters["nextStep"]:
+ self.StoredVariables["Analysis"].store( numpy.ravel(Xb) )
+ if self._toStore("APosterioriCovariance"):
+ self.StoredVariables["APosterioriCovariance"].store( Pn )
+ covarianceXa = Pn
+ #
+ Xa = Xb
+ XaMin = Xb
previousJMinimum = numpy.finfo(float).max
#
# Predimensionnement
Xn = Xb
Pn = B
#
- self.StoredVariables["Analysis"].store( Xn.A1 )
- if self._toStore("APosterioriCovariance"):
- self.StoredVariables["APosterioriCovariance"].store( Pn.asfullmatrix(Xn.size) )
- covarianceXa = Pn
- Xa = XaMin = Xn
+ if len(self.StoredVariables["Analysis"])==0 or not self._parameters["nextStep"]:
+ self.StoredVariables["Analysis"].store( numpy.ravel(Xn) )
+ if self._toStore("APosterioriCovariance"):
+ self.StoredVariables["APosterioriCovariance"].store( Pn.asfullmatrix(Xn.size) )
+ covarianceXa = Pn
+ #
+ Xa = Xn
+ XaMin = Xn
previousJMinimum = numpy.finfo(float).max
#
for step in range(duration-1):
Xn = Xb
Pn = B
#
- self.StoredVariables["Analysis"].store( Xn.A1 )
- if self._toStore("APosterioriCovariance"):
- self.StoredVariables["APosterioriCovariance"].store( Pn.asfullmatrix(Xn.size) )
- covarianceXa = Pn
+ if len(self.StoredVariables["Analysis"])==0 or not self._parameters["nextStep"]:
+ self.StoredVariables["Analysis"].store( numpy.ravel(Xn) )
+ if self._toStore("APosterioriCovariance"):
+ self.StoredVariables["APosterioriCovariance"].store( Pn.asfullmatrix(Xn.size) )
+ covarianceXa = Pn
+ #
Xa = Xn
previousJMinimum = numpy.finfo(float).max
#
#
# Initialisation
# --------------
+ __n = Xb.size
Xn = Xb
- if hasattr(B,"asfullmatrix"): Pn = B.asfullmatrix(Xn.size)
+ if hasattr(B,"asfullmatrix"): Pn = B.asfullmatrix(__n)
else: Pn = B
#
- self.StoredVariables["Analysis"].store( Xn.A1 )
- if self._toStore("APosterioriCovariance"):
- self.StoredVariables["APosterioriCovariance"].store( Pn )
- covarianceXa = Pn
- Xa = XaMin = Xb
+ if len(self.StoredVariables["Analysis"])==0 or not self._parameters["nextStep"]:
+ self.StoredVariables["Analysis"].store( numpy.ravel(Xb) )
+ if self._toStore("APosterioriCovariance"):
+ self.StoredVariables["APosterioriCovariance"].store( Pn )
+ covarianceXa = Pn
+ #
+ Xa = Xb
+ XaMin = Xb
previousJMinimum = numpy.finfo(float).max
#
for step in range(duration-1):
# -----------------------------------------------------------
- def execute(self, Executor=None, SaveCaseInFile=None):
+ def execute(self, Executor=None, SaveCaseInFile=None, nextStep=False):
"Lancement du calcul"
self.__case.register("execute",dir(),locals(),None,True)
- Operator.CM.clearCache()
+ self.updateAlgorithmParameters(Parameters={"nextStep":bool(nextStep)})
+ if not nextStep: Operator.CM.clearCache()
try:
if Executor == "YACS": self.__executeYACSScheme( SaveCaseInFile )
else: self.__executePythonScheme( SaveCaseInFile )
for k in self.__adaoObject['AlgorithmParameters'].keys():
if k == "Algorithm": continue
if k in self.__StoredInputs:
- raise ValueError("the key \"%s\s to be transfered for pickling will overwrite an existing one.")
+ raise ValueError("The key \"%s\" to be transfered for pickling will overwrite an existing one."%(k,))
if self.__adaoObject['AlgorithmParameters'].hasObserver( k ):
self.__adaoObject['AlgorithmParameters'].removeObserver( k, "", True )
self.__StoredInputs[k] = self.__adaoObject['AlgorithmParameters'].pop(k, None)
self._parameters = {"StoreSupplementaryCalculations":[]}
self.__required_parameters = {}
self.__required_inputs = {"RequiredInputValues":{"mandatory":(), "optional":()}}
+ self.__variable_names_not_public = {"nextStep":False} # Duplication dans AlgorithmAndParameters
#
self.StoredVariables = {}
self.StoredVariables["APosterioriCorrelations"] = Persistence.OneMatrix(name = "APosterioriCorrelations")
# Mise a jour de self._parameters avec Parameters
self.__setParameters(Parameters)
#
+ for k, v in self.__variable_names_not_public.items():
+ if k not in self._parameters: self.__setParameters( {k:v} )
+ #
# Corrections et complements
def __test_vvalue(argument, variable, argname):
if argument is None:
self.__P.update( {"Algorithm":self.__A} )
#
self.__setAlgorithm( self.__A )
+ #
+ self.__variable_names_not_public = {"nextStep":False} # Duplication dans Algorithm
def updateParameters(self,
asDict = None,
elif key in self.__P:
return self.__P[key]
else:
- return self.__P
+ allvariables = self.__P
+ for k in self.__variable_names_not_public: allvariables.pop(k, None)
+ return allvariables
def pop(self, k, d):
"Necessaire pour le pickling"
return self.__algorithm.StoredVariables[ __V ].hasDataObserver()
def keys(self):
- return list(self.__algorithm.keys()) + list(self.__P.keys())
+ __allvariables = list(self.__algorithm.keys()) + list(self.__P.keys())
+ for k in self.__variable_names_not_public:
+ if k in __allvariables: __allvariables.remove(k)
+ return __allvariables
def __contains__(self, key=None):
"D.__contains__(k) -> True if D has a key k, else False"
if k == "Stored" and not __v: continue
if k == "ColMajor" and not __v: continue
if k == "InputFunctionAsMulti" and not __v: continue
+ if k == "nextStep" and not __v: continue
if k == "AvoidRC" and __v: continue
- if k == "noDetails": continue
+ if k == "noDetails": continue
if isinstance(__v,Persistence.Persistence): __v = __v.values()
if callable(__v): __text = self._missing%__v.__name__+__text
if isinstance(__v,dict):
__text += "%s_config['From'] = '%s'\n"%(__command,__f)
__text += "%s_config['Data'] = %s\n"%(__command,__v)
__text = __text.replace("''","'")
- elif __k in ('Stored', 'Checked', 'ColMajor', 'InputFunctionAsMulti'):
+ elif __k in ('Stored', 'Checked', 'ColMajor', 'InputFunctionAsMulti', 'nextStep'):
if bool(__v):
__text += "%s_config['%s'] = '%s'\n"%(__command,__k,int(bool(__v)))
elif __k in ('AvoidRC', 'noDetails'):