From: Jean-Philippe ARGAUD Date: Wed, 31 Aug 2016 11:44:53 +0000 (+0200) Subject: Add or correct tests for salome test X-Git-Tag: V8_1_0~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6175d47c8751de70cb8c0cf6f08d53cae008534c;p=modules%2Fadao.git Add or correct tests for salome test --- diff --git a/doc/en/bibliography.rst b/doc/en/bibliography.rst index 20c6e11..912237f 100644 --- a/doc/en/bibliography.rst +++ b/doc/en/bibliography.rst @@ -29,6 +29,8 @@ Bibliography .. [Argaud09] Argaud J.-P., Bouriquet B., Hunt J., *Data Assimilation from Operational and Industrial Applications to Complex Systems*, Mathematics Today, pp.150-152, October 2009 +.. [GilBellosta15] Gil Bellosta C. J., *rPython: Package Allowing R to Call Python*, CRAN, 2015, https://cran.r-project.org/web/packages/rPython/ and http://rpython.r-forge.r-project.org/ + .. [Bouttier99] Bouttier B., Courtier P., *Data assimilation concepts and methods*, Meteorological Training Course Lecture Series, ECMWF, 1999, http://www.ecmwf.int/sites/default/files/Data%20assimilation%20concepts%20and%20methods.pdf .. [Bocquet04] Bocquet M., *Introduction aux principes et méthodes de l'assimilation de données en géophysique*, Lecture Notes, 2014, http://cerea.enpc.fr/HomePages/bocquet/Doc/assim-mb.pdf @@ -43,7 +45,7 @@ Bibliography .. [Kalnay03] Kalnay E., *Atmospheric Modeling, Data Assimilation and Predictability*, Cambridge University Press, 2003 -.. [Koenker00] Koenker R., Hallock K. F., *Quantile Regression: an Introduction*, 2000, available at http://www.econ.uiuc.edu/~roger/research/intro/intro.html +.. [Koenker00] Koenker R., Hallock K. F., *Quantile Regression: an Introduction*, 2000, http://www.econ.uiuc.edu/~roger/research/intro/intro.html .. [Koenker01] Koenker R., Hallock K. F., *Quantile Regression*, Journal of Economic Perspectives, 15(4), pp.143-156, 2001 @@ -53,6 +55,8 @@ Bibliography .. [Powell] Powell M.J.D., *An efficient method for finding the minimum of a function of several variables without calculating derivatives*, Computer Journal, 7(2), pp.155-162, 1964 +.. [R] *The R Project for Statistical Computing*, http://www.r-project.org/ + .. [Salome] *SALOME The Open Source Integration Platform for Numerical Simulation*, http://www.salome-platform.org/ .. [SalomeMeca] *Salome_Meca and Code_Aster, Analysis of Structures and Thermomechanics for Studies & Research*, http://www.code-aster.org/ diff --git a/doc/en/tui.rst b/doc/en/tui.rst index bc34aac..8114394 100644 --- a/doc/en/tui.rst +++ b/doc/en/tui.rst @@ -30,11 +30,6 @@ **[DocR]** Textual Application Programming Interface for the user (API/TUI) ================================================================================ -.. warning:: - - in its present version, this text programming interface (TUI) is experimental, - and so changes can be required in forthcoming versions. - This section presents advanced usage of the ADAO module using its text programming interface (API/TUI). This interface gives ability to create a calculation object in a similar way than the case building obtained through the @@ -516,6 +511,8 @@ Get the calculation results separately :ref:`section_ref_output_variables` and to the individual documentations of the algorithms. +.. _subsection_tui_advanced: + More advanced examples of ADAO TUI calculation case --------------------------------------------------- diff --git a/doc/fr/bibliography.rst b/doc/fr/bibliography.rst index ca4497a..f8e4351 100644 --- a/doc/fr/bibliography.rst +++ b/doc/fr/bibliography.rst @@ -29,6 +29,8 @@ Bibliographie .. [Argaud09] Argaud J.-P., Bouriquet B., Hunt J., *Data Assimilation from Operational and Industrial Applications to Complex Systems*, Mathematics Today, pp.150-152, October 2009 +.. [GilBellosta15] Gil Bellosta C. J., *rPython: Package Allowing R to Call Python*, CRAN, 2015, https://cran.r-project.org/web/packages/rPython/ and http://rpython.r-forge.r-project.org/ + .. [Bouttier99] Bouttier B., Courtier P., *Data assimilation concepts and methods*, Meteorological Training Course Lecture Series, ECMWF, 1999, http://www.ecmwf.int/sites/default/files/Data%20assimilation%20concepts%20and%20methods.pdf .. [Bocquet04] Bocquet M., *Introduction aux principes et méthodes de l'assimilation de données en géophysique*, Lecture Notes, 2014, http://cerea.enpc.fr/HomePages/bocquet/Doc/assim-mb.pdf @@ -43,7 +45,7 @@ Bibliographie .. [Kalnay03] Kalnay E., *Atmospheric Modeling, Data Assimilation and Predictability*, Cambridge University Press, 2003 -.. [Koenker00] Koenker R., Hallock K. F., *Quantile Regression: an Introduction*, 2000, available at http://www.econ.uiuc.edu/~roger/research/intro/intro.html +.. [Koenker00] Koenker R., Hallock K. F., *Quantile Regression: an Introduction*, 2000, http://www.econ.uiuc.edu/~roger/research/intro/intro.html .. [Koenker01] Koenker R., Hallock K. F., *Quantile Regression*, Journal of Economic Perspectives, 15(4), pp.143-156, 2001 @@ -53,6 +55,8 @@ Bibliographie .. [Powell] Powell M.J.D., *An efficient method for finding the minimum of a function of several variables without calculating derivatives*, Computer Journal, 7(2), pp.155-162, 1964 +.. [R] *The R Project for Statistical Computing*, http://www.r-project.org/ + .. [Salome] *SALOME The Open Source Integration Platform for Numerical Simulation*, http://www.salome-platform.org/ .. [SalomeMeca] *Salome_Meca et Code_Aster, Analyse des Structures et Thermomécanique pour les Etudes et la Recherche*, http://www.code-aster.org/ diff --git a/doc/fr/tui.rst b/doc/fr/tui.rst index 5d1ddbd..412a823 100644 --- a/doc/fr/tui.rst +++ b/doc/fr/tui.rst @@ -30,12 +30,6 @@ **[DocR]** Interface de programmation textuelle pour l'utilisateur (API/TUI) ================================================================================ -.. warning:: - - dans sa présente version, cette interface de programmation textuelle (TUI) est - expérimentale, et reste donc susceptible de changements dans les prochaines - versions. - Cette section présente des méthodes avancées d'usage du module ADAO à l'aide de son interface de programmation textuelle (API/TUI). Cette interface permet de créer un objet de calcul de manière similaire à la construction d'un cas par @@ -549,6 +543,8 @@ Obtenir s fois aux :ref:`section_ref_output_variables` et aux documentations individuelles des algorithmes. +.. _subsection_tui_advanced: + Exemples plus avancés de cas de calcul TUI ADAO ----------------------------------------------- diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py index 8e2116e..94dfeb4 100644 --- a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -68,7 +68,6 @@ class AdaoEficasWrapper(eficasSalome.MyEficas): def addJdcInSalome(self, jdcPath): debug("addJdcInSalome is called " + str(jdcPath)) # On gere nous meme l'etude - pass ####### # diff --git a/test/CTestTestfileInstall.cmake.in b/test/CTestTestfileInstall.cmake.in index ecc955c..da9c473 100644 --- a/test/CTestTestfileInstall.cmake.in +++ b/test/CTestTestfileInstall.cmake.in @@ -31,4 +31,5 @@ SUBDIRS( test6701 test6702 test6703 + test6901 ) diff --git a/test/Makefile.am b/test/Makefile.am index 03009fc..05e954f 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -34,6 +34,7 @@ install-data-local: cp -R $(DIR)test6701 $(SALOMETESTDIR) cp -R $(DIR)test6702 $(SALOMETESTDIR) cp -R $(DIR)test6703 $(SALOMETESTDIR) + cp -R $(DIR)test6901 $(SALOMETESTDIR) cp $(DIR)CTestTestfileInstall.cmake.in $(SALOMETESTDIR)/CTestTestfile.cmake uninstall-local: @@ -43,4 +44,5 @@ uninstall-local: rm -rf $(SALOMETESTDIR)/test6701 rm -rf $(SALOMETESTDIR)/test6702 rm -rf $(SALOMETESTDIR)/test6703 + rm -rf $(SALOMETESTDIR)/test6901 rm $(SALOMETESTDIR)/CTestTestfile.cmake diff --git a/test/test1001/Versions.py b/test/test1001/Versions.py index b37bf38..0fac33c 100644 --- a/test/test1001/Versions.py +++ b/test/test1001/Versions.py @@ -1,8 +1,30 @@ -#!/usr/bin/env python #-*-coding:iso-8859-1-*- -"""Test des versions de modules""" +# +# Copyright (C) 2008-2016 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D +"Test des versions de modules" -# Versions Calibre9/Jessie +# ============================================================================== +# +# Versions minimales Calibre9/Jessie +# ---------------------------------- minimal_python_version = "2.7.9" minimal_numpy_version = "1.8.2" minimal_scipy_version = "0.14.0" @@ -86,11 +108,9 @@ def testSysteme(): # return 0 -#=============================================================================== +# ============================================================================== if __name__ == "__main__": - - print '\nAUTODIAGNOSTIC\n==============\n' - + print '\n AUTODIAGNOSTIC \n' minimalVersion() sys.exit(testSysteme()) diff --git a/test/test1002/CTestTestfile.cmake b/test/test1002/CTestTestfile.cmake index 43a079a..71189e9 100644 --- a/test/test1002/CTestTestfile.cmake +++ b/test/test1002/CTestTestfile.cmake @@ -19,8 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py") - SET(TEST_NAMES HelloWorld ) diff --git a/test/test6701/CTestTestfile.cmake b/test/test6701/CTestTestfile.cmake index ab76b31..a9b9af1 100644 --- a/test/test6701/CTestTestfile.cmake +++ b/test/test6701/CTestTestfile.cmake @@ -19,8 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py") - SET(TEST_NAMES Doc_TUI_Exemple_01 ) diff --git a/test/test6701/Doc_TUI_Exemple_01.py b/test/test6701/Doc_TUI_Exemple_01.py index de51e7e..b5efd97 100644 --- a/test/test6701/Doc_TUI_Exemple_01.py +++ b/test/test6701/Doc_TUI_Exemple_01.py @@ -23,7 +23,7 @@ # ============================================================================== def test1(): - + """Exemple""" from numpy import array, matrix import adaoBuilder case = adaoBuilder.New() @@ -35,6 +35,8 @@ def test1(): case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) case.execute() + # + return 0 # ============================================================================== if __name__ == "__main__": diff --git a/test/test6702/CTestTestfile.cmake b/test/test6702/CTestTestfile.cmake index 1a76e0e..61e052e 100644 --- a/test/test6702/CTestTestfile.cmake +++ b/test/test6702/CTestTestfile.cmake @@ -19,8 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py") - SET(TEST_NAMES Doc_TUI_Exemple_02 ) diff --git a/test/test6702/Doc_TUI_Exemple_02.py b/test/test6702/Doc_TUI_Exemple_02.py index 1ca65e0..3cfe935 100644 --- a/test/test6702/Doc_TUI_Exemple_02.py +++ b/test/test6702/Doc_TUI_Exemple_02.py @@ -23,7 +23,7 @@ # ============================================================================== def test1(): - + """Exemple""" from numpy import array, matrix import adaoBuilder case = adaoBuilder.New() @@ -39,7 +39,7 @@ def test1(): return case.get("Analysis")[-1] def test2(): - + """Exemple""" from numpy import array, matrix import adaoBuilder case = adaoBuilder.New() @@ -64,6 +64,7 @@ def test2(): return case.get("Analysis")[-1] def almost_equal_vectors(v1, v2): + """Comparaison de deux vecteurs""" print "\nMaximum of differences between the two :",max(abs(v2 - v1)) return max(abs(v2 - v1)) < 1.e-15 diff --git a/test/test6703/CTestTestfile.cmake b/test/test6703/CTestTestfile.cmake index 7c6544a..038ce27 100644 --- a/test/test6703/CTestTestfile.cmake +++ b/test/test6703/CTestTestfile.cmake @@ -19,8 +19,6 @@ # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # -#FILE(GLOB ADAO_TEST1001_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.py") - SET(TEST_NAMES Doc_TUI_Exemple_03 ) diff --git a/test/test6703/Doc_TUI_Exemple_03.py b/test/test6703/Doc_TUI_Exemple_03.py index 44beceb..b89e381 100644 --- a/test/test6703/Doc_TUI_Exemple_03.py +++ b/test/test6703/Doc_TUI_Exemple_03.py @@ -22,7 +22,6 @@ "Verification d'un exemple de la documentation" # ============================================================================== - # # Construction artificielle d'un exemple de donnees utilisateur # ------------------------------------------------------------- @@ -47,7 +46,7 @@ observations = simulation((2, 3, 4)) # ============================================================================== def test1(): - "Test" + "Exemple" import numpy import adaoBuilder # @@ -99,6 +98,8 @@ def test1(): print "Optimal state...................:",numpy.ravel(Xoptimum) print "Simulation at optimal state.....:",numpy.ravel(FX_at_optimum) print + # + return 0 # ============================================================================== if __name__ == "__main__": diff --git a/test/test6901/CTestTestfile.cmake b/test/test6901/CTestTestfile.cmake new file mode 100644 index 0000000..67000d0 --- /dev/null +++ b/test/test6901/CTestTestfile.cmake @@ -0,0 +1,31 @@ +# Copyright (C) 2008-2016 EDF R&D +# +# This file is part of SALOME ADAO module +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +SET(TEST_NAMES + Verification_des_Assimilation_Algorithms + ) + +FOREACH(tfile ${TEST_NAMES}) + SET(TEST_NAME ADAO_${tfile}) + ADD_TEST(${TEST_NAME} python ${tfile}.py) + #ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} ${tfile}.py) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}") +ENDFOREACH() diff --git a/test/test6901/Verification_des_Assimilation_Algorithms.py b/test/test6901/Verification_des_Assimilation_Algorithms.py new file mode 100644 index 0000000..17ae290 --- /dev/null +++ b/test/test6901/Verification_des_Assimilation_Algorithms.py @@ -0,0 +1,103 @@ +#-*-coding:iso-8859-1-*- +# +# Copyright (C) 2008-2016 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D +"Verification de la disponibilite de l'ensemble des algorithmes" + +# ============================================================================== +import adaoBuilder, numpy +def test1(): + """Verification de la disponibilite de l'ensemble des algorithmes""" + for algo in ("3DVAR", "Blue", "ExtendedBlue", "LinearLeastSquares", "NonLinearLeastSquares", ): + print + msg = "Algorithme en test : %s"%algo + print msg+"\n"+"="*len(msg) + # + adaopy = adaoBuilder.New() + adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"EpsilonMinimumExponent":-10, }) + adaopy.setBackground (Vector = [0,1,2]) + adaopy.setBackgroundError (ScalarSparseMatrix = 1.) + adaopy.setObservation (Vector = [0.5,1.5,2.5]) + adaopy.setObservationError (DiagonalSparseMatrix = "1 1 1") + adaopy.setObservationOperator(Matrix = "1 0 0;0 2 0;0 0 3") + adaopy.setObserver("Analysis",Template="ValuePrinter") + adaopy.execute() + del adaopy + # + for algo in ("ExtendedKalmanFilter", "KalmanFilter", "UnscentedKalmanFilter", "4DVAR"): + print + msg = "Algorithme en test : %s"%algo + print msg+"\n"+"="*len(msg) + # + adaopy = adaoBuilder.New() + adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"EpsilonMinimumExponent":-10, }) + adaopy.setBackground (Vector = [0,1,2]) + adaopy.setBackgroundError (ScalarSparseMatrix = 1.) + adaopy.setObservation (Vector = [0.5,1.5,2.5]) + adaopy.setObservationError (DiagonalSparseMatrix = "1 1 1") + adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionModel (Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionError (ScalarSparseMatrix = 1.) + adaopy.setObserver("Analysis",Template="ValuePrinter") + adaopy.execute() + del adaopy + # + for algo in ("ParticleSwarmOptimization", "QuantileRegression", ): + print + msg = "Algorithme en test : %s"%algo + print msg+"\n"+"="*len(msg) + # + adaopy = adaoBuilder.New() + adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"BoxBounds":3*[[-1,3]], "SetSeed":1000, }) + adaopy.setBackground (Vector = [0,1,2]) + adaopy.setBackgroundError (ScalarSparseMatrix = 1.) + adaopy.setObservation (Vector = [0.5,1.5,2.5]) + adaopy.setObservationError (DiagonalSparseMatrix = "1 1 1") + adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionModel (Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionError (ScalarSparseMatrix = 1.) + adaopy.setObserver("Analysis",Template="ValuePrinter") + adaopy.execute() + del adaopy + # + for algo in ("EnsembleBlue", ): + print + msg = "Algorithme en test : %s"%algo + print msg+"\n"+"="*len(msg) + # + adaopy = adaoBuilder.New() + adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"SetSeed":1000, }) + adaopy.setBackground (VectorSerie = 100*[[0,1,2]]) + adaopy.setBackgroundError (ScalarSparseMatrix = 1.) + adaopy.setObservation (Vector = [0.5,1.5,2.5]) + adaopy.setObservationError (DiagonalSparseMatrix = "1 1 1") + adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionModel (Matrix = "1 0 0;0 1 0;0 0 1") + adaopy.setEvolutionError (ScalarSparseMatrix = 1.) + adaopy.setObserver("Analysis",Template="ValuePrinter") + adaopy.execute() + del adaopy + # + return 0 + +#=============================================================================== +if __name__ == "__main__": + print '\n AUTODIAGNOSTIC \n' + test1()