From cb1d6b8122da1817e8e0aea5d8e977f73949ee1d Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sat, 6 Oct 2018 20:56:46 +0200 Subject: [PATCH] Correcting installation details --- README | 89 ++++++++++++++----- bin/Makefile.am | 4 +- src/daSalome/__init__.py | 7 +- .../daGUI/daGuiImpl/adaoGuiManager.py | 14 +-- 4 files changed, 82 insertions(+), 32 deletions(-) diff --git a/README b/README index 7e48f2e..33cca0d 100644 --- a/README +++ b/README @@ -1,24 +1,71 @@ -================================================================================ -ADAO, a module for Data Assimilation and Optimization -================================================================================ +===================================================== +ADAO: A module for Data Assimilation and Optimization +===================================================== About -===== +----- -The ADAO module provides data assimilation and optimization features in SALOME -context or alone. Briefly stated, Data Assimilation is a methodological -framework to compute the optimal estimate of the inaccessible true value of a -system state over time. It uses information coming from experimental -measurements or observations, and from numerical *a priori* models, including -information about their errors. Parts of the framework are also known under the -names of *parameter estimation*, *inverse problems*, *Bayesian estimation*, -*optimal interpolation*, etc. +**The ADAO module provides data assimilation and optimization** +features in Python or SALOME context (see +http://www.salome-platform.org/). Briefly stated, Data Assimilation is +a methodological framework to compute the optimal estimate of the +inaccessible true value of a system state, eventually over time. It +uses information coming from experimental measurements or observations, +and from numerical *a priori* models, including information about their +errors. Parts of the framework are also known under the names of +*parameter estimation*, *inverse problems*, *Bayesian estimation*, +*optimal interpolation*, etc. More details can be found in the full +ADAO documentation (see http://www.salome-platform.org/). + +Only the use of ADAO text programming interface (API/TUI) is introduced +here. This interface gives ability to create a calculation object in a +similar way than the case building obtained through the graphical +interface (GUI). When one wants to elaborate "by hand" the TUI +calculation case, it is recommended to extensively use all the ADAO +module documentation, and to go back if necessary to the graphical +interface (GUI), to get all the elements allowing to correctly set the +commands. + +A simple setup example of an ADAO TUI calculation case +------------------------------------------------------ + +To introduce the TUI interface, lets begin by a simple but complete +example of ADAO calculation case. All the data are explicitly defined +inside the script in order to make the reading easier. The whole set of +commands is the following one:: + + from numpy import array, matrix + from adao import adaoBuilder + case = adaoBuilder.New() + case.set( 'AlgorithmParameters', Algorithm='3DVAR' ) + case.set( 'Background', Vector=[0, 1, 2] ) + case.set( 'BackgroundError', ScalarSparseMatrix=1.0 ) + case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) ) + case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' ) + case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' ) + case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" ) + case.execute() + +The result of running these commands in SALOME (either as a SALOME +"*shell*" command, in the Python command window of the interface, or by +the script execution entry of the menu) is the following:: + + Analysis [ 0.25000264 0.79999797 0.94999939] + +More advanced examples of ADAO TUI calculation case +--------------------------------------------------- + +Real cases involves observations loaded from files, operators +explicitly defined as generic functions including physical simulators, +time dependant information in order to deal with forecast analysis in +addition to calibration or re-analysis. More details can be found in +the full ADAO documentation (see http://www.salome-platform.org/). License and requirements -======================== +------------------------ -The license for this module is the GNU Lesser General Public License (Lesser -GPL), as stated here and in the source files:: +The license for this module is the GNU Lesser General Public License +(Lesser GPL), as stated here and in the source files:: @@ -31,18 +78,18 @@ GPL), as stated here and in the source files:: 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 + 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 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com + See http://www.salome-platform.org/ -In addition, we require that all publication or presentation describing work -using this software, or all commercial or not products using it, quote at least -one of the references given below: +In addition, we require that all publication or presentation describing +work using this software, or all commercial or not products using it, +quote at least one of the references given below: * *ADAO, a module for Data Assimilation and Optimization*, http://www.salome-platform.org/ diff --git a/bin/Makefile.am b/bin/Makefile.am index 5c9e60b..31b3487 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -29,7 +29,7 @@ EXTRA_DIST = AdaoYacsSchemaCreator.py qtEficas_adao_study.py.in # AdaoCatalogGen ADAODIR = $(DESTDIR)$(salomepythondir)/adao install-data-hook: - @export PYTHONPATH=$(DESTDIR)${salomepythondir}:${PYTHONPATH} && python $(top_srcdir)/bin/AdaoCatalogGenerator.py $(ADAODIR)/daEficas ADAO_Cata_V0.py + @export PYTHONPATH="$(DESTDIR)${salomepythondir}:${PYTHONPATH}" && python $(top_srcdir)/bin/AdaoCatalogGenerator.py $(ADAODIR)/daEficas ADAO_Cata_V0.py uninstall-hook: - @rm $(ADAODIR)/daEficas/ADAO_Cata_V0.py + @rm $(ADAODIR)/daEficas/ADAO_Cata_V0.py diff --git a/src/daSalome/__init__.py b/src/daSalome/__init__.py index 50fbc2f..1a0db58 100644 --- a/src/daSalome/__init__.py +++ b/src/daSalome/__init__.py @@ -123,8 +123,11 @@ The documentation of the module is also covered by the license and the requirement of quoting. """ -import os, sys +import os, sys, logging sys.path.insert(0, os.path.abspath(os.path.dirname(__file__))) from daCore.version import name, version, year, date -from daYacsIntegration.daOptimizerLoop import * +try: + from daYacsIntegration.daOptimizerLoop import * +except: + logging.debug("INIT Pas de chargement initial de daOptimizerLoop") diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py index 5dbb739..7a0cefc 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py @@ -147,7 +147,7 @@ class AdaoCaseManager(EficasObserver): salomeStudyItem = adaoGuiHelper.getSelectedItem() if salomeStudyItem is not None: for case_editor, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): self.eficas_manager.selectCase(adao_case.eficas_editor) break @@ -238,7 +238,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): if not adao_case.isOk(): adaoLogger.debug("Cas invalide, donc il est sauvegarde, mais il ne peut pas etre exporte vers YACS ensuite") self.eficas_manager.adaoFileSave(adao_case) @@ -251,7 +251,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): if not adao_case.isOk(): adaoLogger.debug("Cas invalide, donc il est sauvegarde, mais il ne peut pas etre exporte vers YACS ensuite") self.eficas_manager.adaoFileSaveAs(adao_case) @@ -282,7 +282,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): self.eficas_manager.adaoFileClose(adao_case) break @@ -312,7 +312,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): msg = adao_case.validationReportforJDC() adaoGuiHelper.gui_information(SalomePyQt.SalomePyQt().getDesktop(), msg) break @@ -329,7 +329,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): msg = adao_case.showTreeAdaoCase() break @@ -347,7 +347,7 @@ class AdaoCaseManager(EficasObserver): self.harmonizeSelectionFromEficas() salomeStudyItem = adaoGuiHelper.getSelectedItem() for case_name, adao_case in self.cases.items(): - if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): + if hasattr(salomeStudyItem,"GetID") and adao_case.salome_study_item.GetID() == salomeStudyItem.GetID(): if adao_case.isOk(): msg = adao_case.exportCaseToYACS() # If msg is not empty -> error found -- 2.39.2