From 21d9e7947ce5203b5f9a8745d557cee6c49ad943 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 27 Feb 2019 18:59:40 +0100 Subject: [PATCH] Update various configurations --- doc/en/conf.py | 5 +++-- doc/fr/conf.py | 5 +++-- src/daComposant/daAlgorithms/3DVAR.py | 23 ++++++++++++++++++++++- test/CTestTestfileInstall.cmake.in | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/doc/en/conf.py b/doc/en/conf.py index d8cfa7d..d1c9d94 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -57,7 +57,8 @@ except: # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.pngmath"] +extensions = ["sphinx.ext.imgmath"] +# extensions = ["sphinx.ext.pngmath"] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -201,7 +202,7 @@ htmlhelp_basename = 'ADAOdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -latex_paper_size = 'letter' +latex_elements = {'papersize':'letterpaper'} # The font size ('10pt', '11pt' or '12pt'). latex_font_size = '10pt' diff --git a/doc/fr/conf.py b/doc/fr/conf.py index b1e250f..2f76da9 100644 --- a/doc/fr/conf.py +++ b/doc/fr/conf.py @@ -57,7 +57,8 @@ except: # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ["sphinx.ext.pngmath"] +extensions = ["sphinx.ext.imgmath"] +# extensions = ["sphinx.ext.pngmath"] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -201,7 +202,7 @@ htmlhelp_basename = 'ADAOdoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -latex_paper_size = 'a4' +latex_elements = {'papersize':'a4paper'} # The font size ('10pt', '11pt' or '12pt'). latex_font_size = '10pt' diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index 0dc21b0..597352e 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -91,6 +91,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): "IndexOfOptimum", "Innovation", "InnovationAtCurrentState", + "JacobianMatrixAtBackground", + "JacobianMatrixAtOptimum", + "KalmanGainAtOptimum", "MahalanobisConsistency", "OMA", "OMB", @@ -161,6 +164,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): if max(Y.shape) != max(HXb.shape): raise ValueError("The shapes %s of observations Y and %s of observed calculation H(X) are different, they have to be identical."%(Y.shape,HXb.shape)) # + if self._toStore("JacobianMatrixAtBackground"): + HtMb = HO["Tangent"].asMatrix(ValueForMethodForm = Xb) + HtMb = HtMb.reshape(Y.size,Xb.size) # ADAO & check shape + self.StoredVariables["JacobianMatrixAtBackground"].store( HtMb ) + # # Précalcul des inversions de B et R # ---------------------------------- BI = B.getI() @@ -320,11 +328,18 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Calcul de la covariance d'analyse # --------------------------------- if self._toStore("APosterioriCovariance") or \ - self._toStore("SimulationQuantiles"): + self._toStore("SimulationQuantiles") or \ + self._toStore("JacobianMatrixAtOptimum") or \ + self._toStore("KalmanGainAtOptimum"): HtM = HO["Tangent"].asMatrix(ValueForMethodForm = Xa) HtM = HtM.reshape(Y.size,Xa.size) # ADAO & check shape + if self._toStore("APosterioriCovariance") or \ + self._toStore("SimulationQuantiles") or \ + self._toStore("KalmanGainAtOptimum"): HaM = HO["Adjoint"].asMatrix(ValueForMethodForm = Xa) HaM = HaM.reshape(Xa.size,Y.size) # ADAO & check shape + if self._toStore("APosterioriCovariance") or \ + self._toStore("SimulationQuantiles"): HessienneI = [] nb = Xa.size for i in range(nb): @@ -346,6 +361,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): raise ValueError("The %s a posteriori covariance matrix A is not symmetric positive-definite. Please check your a priori covariances and your observation operator."%(self._name,)) if self._toStore("APosterioriCovariance"): self.StoredVariables["APosterioriCovariance"].store( A ) + if self._toStore("JacobianMatrixAtOptimum"): + self.StoredVariables["JacobianMatrixAtOptimum"].store( HtM ) + if self._toStore("KalmanGainAtOptimum"): + if (Y.size <= Xb.size): KG = B * HaM * (R + numpy.dot(HtM, B * HaM)).I + elif (Y.size > Xb.size): KG = (BI + numpy.dot(HaM, RI * HtM)).I * HaM * RI + self.StoredVariables["KalmanGainAtOptimum"].store( KG ) # # Calculs et/ou stockages supplémentaires # --------------------------------------- diff --git a/test/CTestTestfileInstall.cmake.in b/test/CTestTestfileInstall.cmake.in index 618bb41..da05965 100644 --- a/test/CTestTestfileInstall.cmake.in +++ b/test/CTestTestfileInstall.cmake.in @@ -22,7 +22,7 @@ SET(SALOME_TEST_DRIVER "@CMAKE_INSTALL_PREFIX@/bin/salome/appliskel/salome_test_driver.py") SET(COMPONENT_NAME ADAO) -SET(TIMEOUT 500) +SET(TIMEOUT 500) # Add all test subdirs SUBDIRS( -- 2.39.2