"SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum", "SimulationQuantiles"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Quantiles
This list indicates the values of quantile, between 0 and 1, to be estimated
these variables being calculated and stored by default. The possible names
are in the following list: ["APosterioriCorrelations",
"APosterioriCovariance", "APosterioriStandardDeviations",
- "APosterioriVariances", "BMA", "CostFunctionJ", "OMA", "OMB", "Innovation",
- "SigmaBck2", "SigmaObs2", "MahalanobisConsistency",
- "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum",
- "SimulationQuantiles"].
+ "APosterioriVariances", "BMA", "OMA", "OMB", "CurrentState",
+ "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2",
+ "MahalanobisConsistency", "SimulationQuantiles",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Quantiles
This list indicates the values of quantile, between 0 and 1, to be estimated
The options of the algorithm are the following:
+ StoreSupplementaryCalculations
+ This list indicates the names of the supplementary variables that can be
+ available at the end of the algorithm. It involves potentially costly
+ calculations or memory consumptions. The default is a void list, none of
+ these variables being calculated and stored by default. The possible names
+ are in the following list: ["CurrentState", "Innovation",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
+
+ Example : ``{"StoreSupplementaryCalculations":["CurrentState", "Innovation"]}``
+
SetSeed
This key allow to give an integer in order to fix the seed of the random
generator used to generate the ensemble. A convenient value is for example
these variables being calculated and stored by default. The possible names
are in the following list: ["APosterioriCorrelations",
"APosterioriCovariance", "APosterioriStandardDeviations",
- "APosterioriVariances", "BMA", "CostFunctionJ", "OMA", "OMB", "Innovation",
- "SigmaBck2", "SigmaObs2", "MahalanobisConsistency",
- "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum",
- "SimulationQuantiles"].
+ "APosterioriVariances", "BMA", "OMA", "OMB", "CurrentState",
+ "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2",
+ "MahalanobisConsistency", "SimulationQuantiles",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Quantiles
This list indicates the values of quantile, between 0 and 1, to be estimated
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Information and variables available at the end of the algorithm
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Information and variables available at the end of the algorithm
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
available at the end of the algorithm. It involves potentially costly
calculations or memory consumptions. The default is a void list, none of
these variables being calculated and stored by default. The possible names
- are in the following list: ["OMA", "CostFunctionJ",
- "SimulatedObservationAtOptimum"].
+ are in the following list: ["OMA", "CurrentState", "CostFunctionJ",
+ "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["OMA"]}``
+ Example : ``{"StoreSupplementaryCalculations":["OMA", "CurrentState"]}``
*Tips for this algorithm:*
"OMB", "Innovation", "SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
*Tips for this algorithm:*
"OMB", "Innovation", "SimulatedObservationAtBackground",
"SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Information and variables available at the end of the algorithm
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"OMB", "Innovation", "SimulatedObservationAtBackground",
"SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
*Tips for this algorithm:*
careful to the size of the hyper-cube (and then to the number of calculations)
that can be reached, it can be big very quickly.
-To perform distributed or complex sampling, see other modules available in
+To be visible by the user, the results of sampling has to be explicitly asked
+for. One use for that, on the desired variable, the final saving through
+"*UserPostAnalysis*" or the treatment during the calculation by "*observer*".
+
+To perform distributed or more complex sampling, see other modules available in
SALOME : PARAMETRIC or OPENTURNS.
Optional and required commands
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Example : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Example : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Information and variables available at the end of the algorithm
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ref_assimilation_keywords
ref_algorithm_3DVAR
- ref_algorithm_LinearLeastSquares
- ref_algorithm_NonLinearLeastSquares
ref_algorithm_Blue
- ref_algorithm_ExtendedBlue
ref_algorithm_EnsembleBlue
- ref_algorithm_KalmanFilter
+ ref_algorithm_ExtendedBlue
ref_algorithm_ExtendedKalmanFilter
- ref_algorithm_UnscentedKalmanFilter
+ ref_algorithm_KalmanFilter
+ ref_algorithm_LinearLeastSquares
+ ref_algorithm_NonLinearLeastSquares
ref_algorithm_ParticleSwarmOptimization
ref_algorithm_QuantileRegression
+ ref_algorithm_UnscentedKalmanFilter
.. _section_reference_checking:
ref_algorithm_GradientTest
ref_algorithm_LinearityTest
ref_algorithm_ObserverTest
- ref_algorithm_TangentTest
ref_algorithm_SamplingTest
+ ref_algorithm_TangentTest
"SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum", "SimulationQuantiles"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Quantiles
Cette liste indique les valeurs de quantile, entre 0 et 1, à estimer par
aucune de ces variables n'étant calculée et stockée par défaut. Les noms
possibles sont dans la liste suivante : ["APosterioriCorrelations",
"APosterioriCovariance", "APosterioriStandardDeviations",
- "APosterioriVariances", "BMA", "CostFunctionJ", "OMA", "OMB", "Innovation",
- "SigmaBck2", "SigmaObs2", "MahalanobisConsistency",
- "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum",
- "SimulationQuantiles"].
+ "APosterioriVariances", "BMA", "OMA", "OMB", "CurrentState",
+ "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2",
+ "MahalanobisConsistency", "SimulationQuantiles",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Quantiles
Cette liste indique les valeurs de quantile, entre 0 et 1, à estimer par
Les options de l'algorithme sont les suivantes:
+ StoreSupplementaryCalculations
+ Cette liste indique les noms des variables supplémentaires qui peuvent être
+ disponibles à la fin de l'algorithme. Cela implique potentiellement des
+ calculs ou du stockage coûteux. La valeur par défaut est une liste vide,
+ aucune de ces variables n'étant calculée et stockée par défaut. Les noms
+ possibles sont dans la liste suivante : ["CurrentState", "Innovation",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
+
+ Exemple : ``{"StoreSupplementaryCalculations":["CurrentState", "Innovation"]}``
+
SetSeed
Cette clé permet de donner un nombre entier pour fixer la graine du
générateur aléatoire utilisé pour générer l'ensemble. Un valeur pratique est
disponibles à la fin de l'algorithme. Cela implique potentiellement des
calculs ou du stockage coûteux. La valeur par défaut est une liste vide,
aucune de ces variables n'étant calculée et stockée par défaut. Les noms
- possibles sont dans la liste suivante : ["APosterioriCorrelations",
- "APosterioriCovariance", "APosterioriStandardDeviations",
- "APosterioriVariances", "BMA", "CostFunctionJ", "OMA", "OMB", "Innovation",
- "SigmaBck2", "SigmaObs2", "MahalanobisConsistency",
- "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum",
- "SimulationQuantiles"].
-
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ possibles sont dans la liste suivante : ["CurrentState", "Innovation",
+ "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
+ "SimulatedObservationAtOptimum"].
+
+ Exemple : ``{"StoreSupplementaryCalculations":["CurrentState", "Innovation"]}``
Quantiles
Cette liste indique les valeurs de quantile, entre 0 et 1, à estimer par
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Informations et variables disponibles à la fin de l'algorithme
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Informations et variables disponibles à la fin de l'algorithme
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
disponibles à la fin de l'algorithme. Cela implique potentiellement des
calculs ou du stockage coûteux. La valeur par défaut est une liste vide,
aucune de ces variables n'étant calculée et stockée par défaut. Les noms
- possibles sont dans la liste suivante : ["OMA", "CostFunctionJ",
+ possibles sont dans la liste suivante : ["OMA", "CurrentState",
+ "CostFunctionJ", "SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum"].
- Exemple : ``{"StoreSupplementaryCalculations":["OMA"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["OMA", "CurrentState"]}``
*Astuce pour cet algorithme :*
"CurrentState", "OMA", "OMB", "Innovation",
"SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
*Astuce pour cet algorithme :*
"SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Informations et variables disponibles à la fin de l'algorithme
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
possibles sont dans la liste suivante : ["BMA", "CostFunctionJ",
"CurrentState", "OMA", "OMB", "Innovation",
"SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState",
- "SimulatedObservationAtOptimum"].
+ "SimulatedObservationAtOptimum"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
*Astuce pour cet algorithme :*
courantes. Attention à la taille de l'hyper-cube (et donc au nombre de calculs)
qu'il est possible d'atteindre, elle peut rapidement devenir importante.
-Pour effectuer un échantillonage distribué ou plus complexe, voir d'autres
+Pour apparaître pour l'utilisateur, les résultats de l'échantillonnage doivent
+être demandés explicitement. On utilise pour cela, sur la variable désirée, la
+sauvegarde finale à l'aide du mot-clé "*UserPostAnalysis*" ou le traitement en
+cours de calcul à l'aide des "*observer*" adaptés.
+
+Pour effectuer un échantillonnage distribué ou plus complexe, voir d'autres
modules disponibles dans SALOME : PARAMETRIC ou OPENTURNS.
Commandes requises et optionnelles
"APosterioriVariances", "BMA", "CostFunctionJ", "CurrentState",
"Innovation"].
- Exemple : ``{"StoreSupplementaryCalculations":["BMA","Innovation"]}``
+ Exemple : ``{"StoreSupplementaryCalculations":["BMA", "Innovation"]}``
Informations et variables disponibles à la fin de l'algorithme
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
à l'aide de l'étape de post-processing du calcul.
L'étape est aisément identifiée par l'utilisateur dans son cas ADAO de
-définition (par la mot-clé "*UserPostAnalysis*") ou dans son schéma YACS
+définition (par le mot-clé "*UserPostAnalysis*") ou dans son schéma YACS
d'exécution (par des noeuds ou blocs situés après le bloc de calcul, et reliés
graphiquement au port de sortie "*algoResults*" du bloc de calcul):
ref_assimilation_keywords
ref_algorithm_3DVAR
- ref_algorithm_LinearLeastSquares
- ref_algorithm_NonLinearLeastSquares
ref_algorithm_Blue
- ref_algorithm_ExtendedBlue
ref_algorithm_EnsembleBlue
- ref_algorithm_KalmanFilter
+ ref_algorithm_ExtendedBlue
ref_algorithm_ExtendedKalmanFilter
- ref_algorithm_UnscentedKalmanFilter
+ ref_algorithm_KalmanFilter
+ ref_algorithm_LinearLeastSquares
+ ref_algorithm_NonLinearLeastSquares
ref_algorithm_ParticleSwarmOptimization
ref_algorithm_QuantileRegression
+ ref_algorithm_UnscentedKalmanFilter
.. _section_reference_checking:
ref_algorithm_GradientTest
ref_algorithm_LinearityTest
ref_algorithm_ObserverTest
- ref_algorithm_TangentTest
ref_algorithm_SamplingTest
+ ref_algorithm_TangentTest
en TUI.
Les variables de résultats de calcul, ou les variables internes issues de
-l'optimisation sont disponibles à travers la méthode ``get`` du cas de calcul TUI
-ADAO, qui renvoie un objet de type liste de la variable demandée. On se
-reportera aux :ref:`section_ref_output_variables` pour une description détaillée
-sur ce sujet.
+l'optimisation ou de l'assimilation de données, sont disponibles à travers la
+méthode ``get`` du cas de calcul TUI ADAO, qui renvoie un objet de type liste de
+la variable demandée. On se reportera aux :ref:`section_ref_output_variables`
+pour une description détaillée sur ce sujet.
A titre d'exemple, on donne quelques lignes de script qui permettent d'obtenir
le nombre d'itérations de l'optimisation et la valeur optimale ainsi que sa
print
print " Nombre d'iterations :", len(case.get("CostFunctionJ"))
Xa = case.get("Analysis")
- print " Analyse optimale :", Xa[-1]
+ print " Analyse optimale :", Xa[-1]
print " Taille de l'analyse :", len(Xa[-1])
print
de calcul TUI ADAO proposé dans :ref:`subsection_tui_example`.
De même que pour l'entrée des données, la simplicité de récupération des
-résultats permet d'envisager aisément des post-traitements enchaînés, pour
-utiliser par exemple de la visualisation avec MatPlotLib ou PARAVIS [PARAVIS]_,
-de l'adaptation de maillage avec HOMARD [HOMARD]_, ou pour d'autres calculs.
+résultats permet d'envisager aisément des post-traitements enchaînés dans
+SALOME, pour utiliser par exemple de la visualisation avec MatPlotLib ou PARAVIS
+[PARAVIS]_, de l'adaptation de maillage avec HOMARD [HOMARD]_, ou pour d'autres
+calculs.
.. _subsection_tui_commands:
Les hypothèses du cas utilisateur sont les suivantes. On suppose :
-#. que l'on veut recaler 3 paramètres ``alpha``, ``beta`` et ``gamma`` dans un domaine borné,
-#. que l'on dispose d'observations nommées ``observations``,
-#. que l'utilisateur dispose en Python d'une fonction de simulation physique appellée ``simulation`` préalablement testée, qui transforme les 3 paramètres en résultats similaires aux observations,
-#. que l'exploitation indépendante, que l'utilisateur veut faire, est représentée ici par l'affichage simple de l'état initial, de l'état optimal, de la simulation en ce point, des états intermédiaires et du nombre d'itérations d'optimisation.
+#. que l'on veut recaler 3 paramètres ``alpha``, ``beta`` et ``gamma`` dans un domaine borné,
+#. que l'on dispose d'observations nommées ``observations``,
+#. que l'utilisateur dispose en Python d'une fonction de simulation physique appellée ``simulation`` préalablement testée, qui transforme les 3 paramètres en résultats similaires aux observations,
+#. que l'exploitation indépendante, que l'utilisateur veut faire, est représentée ici par l'affichage simple de l'état initial, de l'état optimal, de la simulation en ce point, des états intermédiaires et du nombre d'itérations d'optimisation.
Pour effectuer de manière simple cet essai de cas de calcul TUI, on se donne par
exemple les entrées suivantes, parfaitement arbitraires, en construisant les
if "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["MahalanobisConsistency"].store( float( 2.*MinJ/d.size ) )
if "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
- Qtls = self._parameters["Quantiles"]
+ Qtls = map(float, self._parameters["Quantiles"])
nech = self._parameters["NumberOfSamplesForQuantiles"]
HXa = numpy.matrix(numpy.ravel( HXa )).T
YfQ = None
default = [],
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
- listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "OMA", "OMB", "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles", "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum"]
+ listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "OMA", "OMB", "CurrentState", "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles", "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"]
)
self.defineRequiredParameter(
name = "Quantiles",
# Calcul de la fonction coût
# --------------------------
if self._parameters["StoreInternalVariables"] or \
- "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
- "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
- "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
- "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
+ "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
+ "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
+ "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
HXa = Hm * Xa
oma = Y - HXa
if self._parameters["StoreInternalVariables"] or \
#
# Calculs et/ou stockages supplémentaires
# ---------------------------------------
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
if "Innovation" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["Innovation"].store( numpy.ravel(d) )
if "BMA" in self._parameters["StoreSupplementaryCalculations"]:
if "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["MahalanobisConsistency"].store( float( 2.*J/d.size ) )
if "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
- Qtls = self._parameters["Quantiles"]
+ Qtls = map(float, self._parameters["Quantiles"])
nech = self._parameters["NumberOfSamplesForQuantiles"]
YfQ = None
for i in range(nech):
self.StoredVariables["SimulationQuantiles"].store( YQ )
if "SimulatedObservationAtBackground" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
if "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
class ElementaryAlgorithm(BasicObjects.Algorithm):
def __init__(self):
BasicObjects.Algorithm.__init__(self, "ENSEMBLEBLUE")
+ self.defineRequiredParameter(
+ name = "StoreInternalVariables",
+ default = False,
+ typecast = bool,
+ message = "Stockage des variables internes ou intermédiaires du calcul",
+ )
+ self.defineRequiredParameter(
+ name = "StoreSupplementaryCalculations",
+ default = [],
+ typecast = tuple,
+ message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
+ listval = ["CurrentState", "Innovation", "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"]
+ )
self.defineRequiredParameter(
name = "SetSeed",
typecast = numpy.random.seed,
# Calcul du BLUE pour chaque membre de l'ensemble
# -----------------------------------------------
for iens in range(nb_ens):
- d = EnsembleY[:,iens] - Hm * Xb[iens]
+ HXb = Hm * Xb[iens]
+ if "SimulatedObservationAtBackground" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ d = EnsembleY[:,iens] - HXb
+ if "Innovation" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["Innovation"].store( numpy.ravel(d) )
Xa = Xb[iens] + K*d
self.StoredVariables["CurrentState"].store( Xa )
- self.StoredVariables["Innovation"].store( d.A1 )
+ if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( Hm * Xa )
#
# Fabrication de l'analyse
# ------------------------
Members = self.StoredVariables["CurrentState"][-nb_ens:]
Xa = numpy.matrix( Members ).mean(axis=0)
self.StoredVariables["Analysis"].store( Xa.A1 )
+ if "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel( Hm * Xa ) )
#
self._post_run(HO)
return 0
default = [],
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
- listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "OMA", "OMB", "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles", "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum"]
+ listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "OMA", "OMB", "CurrentState", "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles", "SimulatedObservationAtBackground", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"]
)
self.defineRequiredParameter(
name = "Quantiles",
# Calcul de la fonction coût
# --------------------------
if self._parameters["StoreInternalVariables"] or \
- "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
- "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
- "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
- "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
+ "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
+ "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
+ "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
HXa = numpy.matrix(numpy.ravel( H( Xa ) )).T
oma = Y - HXa
if self._parameters["StoreInternalVariables"] or \
# Calcul de la covariance d'analyse
# ---------------------------------
if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
+ "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
if (Y.size <= Xb.size) and (Y.size > 100): K = B * Ha * (R + Hm * B * Ha).I
elif (Y.size > Xb.size) and (Y.size > 100): K = (BI + Ha * RI * Hm).I * Ha * RI
else: pass # K deja calcule
#
# Calculs et/ou stockages supplémentaires
# ---------------------------------------
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
if "Innovation" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["Innovation"].store( numpy.ravel(d) )
if "BMA" in self._parameters["StoreSupplementaryCalculations"]:
if "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["MahalanobisConsistency"].store( float( 2.*J/d.size ) )
if "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
- Qtls = self._parameters["Quantiles"]
+ Qtls = map(float, self._parameters["Quantiles"])
nech = self._parameters["NumberOfSamplesForQuantiles"]
HtM = HO["Tangent"].asMatrix(ValueForMethodForm = Xa)
HtM = HtM.reshape(Y.size,Xa.size) # ADAO & check shape
self.StoredVariables["SimulationQuantiles"].store( YQ )
if "SimulatedObservationAtBackground" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
if "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
default = [],
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
- listval = ["OMA", "CostFunctionJ", "SimulatedObservationAtOptimum"]
+ listval = ["OMA", "CurrentState", "CostFunctionJ", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum"]
)
def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
#
# Calculs et/ou stockages supplémentaires
# ---------------------------------------
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
if "OMA" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["OMA"].store( numpy.ravel(oma) )
+ if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
if "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
if typecast is None: __val = value
else: __val = typecast( value )
#
- if minval is not None and (numpy.array(__val) < minval).any():
+ if minval is not None and (numpy.array(__val, float) < minval).any():
raise ValueError("The parameter named \"%s\" of value \"%s\" can not be less than %s."%(name, __val, minval))
- if maxval is not None and (numpy.array(__val) > maxval).any():
+ if maxval is not None and (numpy.array(__val, float) > maxval).any():
raise ValueError("The parameter named \"%s\" of value \"%s\" can not be greater than %s."%(name, __val, maxval))
if listval is not None:
if typecast is list or typecast is tuple or type(__val) is list or type(__val) is tuple: