# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008-2022 EDF R&D
+# Copyright (C) 2008-2023 EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
"""
def __init__(self,
toleranceInRedundancy = 1.e-18,
- lenghtOfRedundancy = -1,
+ lengthOfRedundancy = -1,
):
"""
Les caractéristiques de tolérance peuvent être modifiées à la création.
"""
self.__tolerBP = float(toleranceInRedundancy)
- self.__lenghtOR = int(lenghtOfRedundancy)
- self.__initlnOR = self.__lenghtOR
+ self.__lengthOR = int(lengthOfRedundancy)
+ self.__initlnOR = self.__lengthOR
self.__seenNames = []
self.__enabled = True
self.clearCache()
__alc = False
__HxV = None
if self.__enabled:
- for i in range(min(len(self.__listOPCV),self.__lenghtOR)-1,-1,-1):
+ for i in range(min(len(self.__listOPCV),self.__lengthOR)-1,-1,-1):
if not hasattr(xValue, 'size'):
pass
elif (str(oName) != self.__listOPCV[i][3]):
def storeValueInX(self, xValue, HxValue, oName="" ):
"Stocke pour un opérateur o un calcul Hx correspondant à la valeur x"
- if self.__lenghtOR < 0:
- self.__lenghtOR = 2 * min(xValue.size, 50) + 2 # 2 * xValue.size + 2
- self.__initlnOR = self.__lenghtOR
+ if self.__lengthOR < 0:
+ self.__lengthOR = 2 * min(numpy.size(xValue), 50) + 2
+ self.__initlnOR = self.__lengthOR
self.__seenNames.append(str(oName))
if str(oName) not in self.__seenNames: # Etend la liste si nouveau
- self.__lenghtOR += 2 * min(xValue.size, 50) + 2 # 2 * xValue.size + 2
- self.__initlnOR += self.__lenghtOR
+ self.__lengthOR += 2 * min(numpy.size(xValue), 50) + 2
+ self.__initlnOR += self.__lengthOR
self.__seenNames.append(str(oName))
- while len(self.__listOPCV) > self.__lenghtOR:
+ while len(self.__listOPCV) > self.__lengthOR:
self.__listOPCV.pop(0)
self.__listOPCV.append( (
copy.copy(numpy.ravel(xValue)), # 0 Previous point
def disable(self):
"Inactive le cache"
- self.__initlnOR = self.__lenghtOR
- self.__lenghtOR = 0
+ self.__initlnOR = self.__lengthOR
+ self.__lengthOR = 0
self.__enabled = False
def enable(self):
"Active le cache"
- self.__lenghtOR = self.__initlnOR
+ self.__lengthOR = self.__initlnOR
self.__enabled = True
# ==============================================================================
if "withReducingMemoryUse" not in __Function: __Function["withReducingMemoryUse"] = __reduceM
if "withAvoidingRedundancy" not in __Function: __Function["withAvoidingRedundancy"] = __avoidRC
if "withToleranceInRedundancy" not in __Function: __Function["withToleranceInRedundancy"] = 1.e-18
- if "withLenghtOfRedundancy" not in __Function: __Function["withLenghtOfRedundancy"] = -1
+ if "withLengthOfRedundancy" not in __Function: __Function["withLengthOfRedundancy"] = -1
if "NumberOfProcesses" not in __Function: __Function["NumberOfProcesses"] = None
if "withmfEnabled" not in __Function: __Function["withmfEnabled"] = inputAsMF
from daCore import NumericObjects
reducingMemoryUse = __Function["withReducingMemoryUse"],
avoidingRedundancy = __Function["withAvoidingRedundancy"],
toleranceInRedundancy = __Function["withToleranceInRedundancy"],
- lenghtOfRedundancy = __Function["withLenghtOfRedundancy"],
+ lengthOfRedundancy = __Function["withLengthOfRedundancy"],
mpEnabled = __Function["EnableMultiProcessingInDerivatives"],
mpWorkers = __Function["NumberOfProcesses"],
mfEnabled = __Function["withmfEnabled"],
- CurrentOptimum : état optimal courant lors d'itérations
- CurrentState : état courant lors d'itérations
- CurrentStepNumber : pas courant d'avancement dans les algorithmes en évolution, à partir de 0
+ - EnsembleOfSimulations : ensemble d'états (sorties, simulations) rangés par colonne dans une matrice
+ - EnsembleOfSnapshots : ensemble d'états rangés par colonne dans une matrice
+ - EnsembleOfStates : ensemble d'états (entrées, paramètres) rangés par colonne dans une matrice
+ - ForecastCovariance : covariance de l'état prédit courant lors d'itérations
+ - ForecastState : état prédit courant lors d'itérations
- GradientOfCostFunctionJ : gradient de la fonction-coût globale
- GradientOfCostFunctionJb : gradient de la partie ébauche de la fonction-coût
- GradientOfCostFunctionJo : gradient de la partie observations de la fonction-coût
- MahalanobisConsistency : indicateur de consistance des covariances
- OMA : Observation moins Analyse : Y - Xa
- OMB : Observation moins Background : Y - Xb
- - ForecastCovariance : covariance de l'état prédit courant lors d'itérations
- - ForecastState : état prédit courant lors d'itérations
- Residu : dans le cas des algorithmes de vérification
- SampledStateForQuantiles : échantillons d'états pour l'estimation des quantiles
- SigmaBck2 : indicateur de correction optimale des erreurs d'ébauche
self.StoredVariables["CurrentOptimum"] = Persistence.OneVector(name = "CurrentOptimum")
self.StoredVariables["CurrentState"] = Persistence.OneVector(name = "CurrentState")
self.StoredVariables["CurrentStepNumber"] = Persistence.OneIndex(name = "CurrentStepNumber")
+ self.StoredVariables["EnsembleOfSimulations"] = Persistence.OneMatrix(name = "EnsembleOfSimulations")
+ self.StoredVariables["EnsembleOfSnapshots"] = Persistence.OneMatrix(name = "EnsembleOfSnapshots")
+ self.StoredVariables["EnsembleOfStates"] = Persistence.OneMatrix(name = "EnsembleOfStates")
self.StoredVariables["ForecastCovariance"] = Persistence.OneMatrix(name = "ForecastCovariance")
self.StoredVariables["ForecastState"] = Persistence.OneVector(name = "ForecastState")
self.StoredVariables["GradientOfCostFunctionJ"] = Persistence.OneVector(name = "GradientOfCostFunctionJ")
self.StoredVariables["MahalanobisConsistency"] = Persistence.OneScalar(name = "MahalanobisConsistency")
self.StoredVariables["OMA"] = Persistence.OneVector(name = "OMA")
self.StoredVariables["OMB"] = Persistence.OneVector(name = "OMB")
+ self.StoredVariables["OptimalPoints"] = Persistence.OneVector(name = "OptimalPoints")
+ self.StoredVariables["ReducedBasis"] = Persistence.OneMatrix(name = "ReducedBasis")
self.StoredVariables["Residu"] = Persistence.OneScalar(name = "Residu")
+ self.StoredVariables["Residus"] = Persistence.OneVector(name = "Residus")
self.StoredVariables["SampledStateForQuantiles"] = Persistence.OneMatrix(name = "SampledStateForQuantiles")
self.StoredVariables["SigmaBck2"] = Persistence.OneScalar(name = "SigmaBck2")
self.StoredVariables["SigmaObs2"] = Persistence.OneScalar(name = "SigmaObs2")
logging.debug("%s Taille mémoire utilisée de %.0f Mio"%(self._name, self._m.getUsedMemory("Mio")))
self._getTimeState(reset=True)
#
- # Mise a jour des paramètres internes avec le contenu de Parameters, en
+ # Mise à jour des paramètres internes avec le contenu de Parameters, en
# reprenant les valeurs par défauts pour toutes celles non définies
self.__setParameters(Parameters, reset=True)
for k, v in self.__variable_names_not_public.items():
def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
"""
- Doit implémenter l'opération élémentaire de calcul d'assimilation sous
- sa forme mathématique la plus naturelle possible.
+ Doit implémenter l'opération élémentaire de calcul algorithmique.
"""
- raise NotImplementedError("Mathematical assimilation calculation has not been implemented!")
+ raise NotImplementedError("Mathematical algorithmic calculation has not been implemented!")
def defineRequiredParameter(self,
name = None,
asDict = None,
asScript = None,
):
- "Mise a jour des parametres"
+ "Mise à jour des paramètres"
if asDict is None and asScript is not None:
__Dict = Interfaces.ImportFromScript(asScript).getvalue( self.__name, "Parameters" )
else:
# ==============================================================================
class ExternalParameters(object):
"""
- Classe générale d'interface de type texte de script utilisateur
+ Classe générale d'interface pour le stockage des paramètres externes
"""
def __init__(self,
name = "GenericExternalParameters",
asDict = None,
asScript = None,
):
- "Mise a jour des parametres"
+ "Mise à jour des paramètres"
if asDict is None and asScript is not None:
__Dict = Interfaces.ImportFromScript(asScript).getvalue( self.__name, "ExternalParameters" )
else:
# logging.debug("MULTF Internal multifonction calculations end")
return __multiHX
-
# ==============================================================================
if __name__ == "__main__":
print('\n AUTODIAGNOSTIC\n')