From bfe709fcc45405050eacc6472144996ddbd9cc56 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 9 Feb 2018 11:24:08 +0100 Subject: [PATCH] Minor corrections and change in example version level --- .../ADAO_Case.comm.in | 15 ++--- .../ADAO_Case.py.in | 59 +++++++++++++++++++ src/daComposant/daCore/Aidsm.py | 40 +++---------- src/daComposant/daCore/PlatformInfo.py | 1 + src/daSalome/daYacsIntegration/daStudy.py | 1 - 5 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.py.in diff --git a/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.comm.in b/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.comm.in index f4cf10f..0cb2e12 100644 --- a/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.comm.in +++ b/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.comm.in @@ -1,8 +1,10 @@ -ASSIMILATION_STUDY(Study_name='ADAO skeleton case', - Study_repertory='@prefix@/share/salome/adao_examples/daSkeletons/External_data_definition_by_scripts', - Debug=0, - Algorithm='3DVAR', +ASSIMILATION_STUDY(StudyName='ADAO skeleton case', + StudyRepertory='@prefix@/share/salome/adao_examples/daSkeletons/External_data_definition_by_scripts', + AlgorithmParameters=_F(Algorithm='3DVAR', + Parameters='Dict', + data=_F(FROM='Script', + SCRIPT_FILE='Script_AlgorithmParameters.py',),), Background=_F(Stored=1, INPUT_TYPE='Vector', data=_F(FROM='Script', @@ -23,8 +25,7 @@ ASSIMILATION_STUDY(Study_name='ADAO skeleton case', INPUT_TYPE='Function', data=_F(FROM='FunctionDict', FUNCTIONDICT_FILE='Script_ObservationOperator_H.py',),), - AlgorithmParameters=_F(INPUT_TYPE='Dict', - data=_F(FROM='Script', - SCRIPT_FILE='Script_AlgorithmParameters.py',),), UserPostAnalysis=_F(FROM='Script', SCRIPT_FILE='Script_UserPostAnalysis.py',),); +#VERSION_CATALOGUE:V7_6_0:FIN VERSION_CATALOGUE + diff --git a/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.py.in b/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.py.in new file mode 100644 index 0000000..223111b --- /dev/null +++ b/examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.py.in @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'ADAO skeleton case' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +AlgorithmParameters_config = {} +AlgorithmParameters_config['Type'] = 'Dict' +AlgorithmParameters_config['From'] = 'Script' +AlgorithmParameters_config['Data'] = 'Script_AlgorithmParameters.py' +study_config['AlgorithmParameters'] = AlgorithmParameters_config +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'Script' +Background_config['Data'] = 'Script_Background_xb.py' +Background_config['Stored'] = '1' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'Script' +BackgroundError_config['Data'] = 'Script_BackgroundError_B.py' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'Script' +Observation_config['Data'] = 'Script_Observation_yo.py' +Observation_config['Stored'] = '1' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'Script' +ObservationError_config['Data'] = 'Script_ObservationError_R.py' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_FunctionDict = {} +ObservationOperator_FunctionDict['Function'] = ['Direct', 'Tangent', 'Adjoint'] +ObservationOperator_FunctionDict['Script'] = {} +ObservationOperator_FunctionDict['Script']['Direct'] = 'Script_ObservationOperator_H.py' +ObservationOperator_FunctionDict['Script']['Tangent'] = 'Script_ObservationOperator_H.py' +ObservationOperator_FunctionDict['Script']['Adjoint'] = 'Script_ObservationOperator_H.py' +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Function' +ObservationOperator_config['From'] = 'FunctionDict' +ObservationOperator_config['Data'] = ObservationOperator_FunctionDict +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSkeletons/External_data_definition_by_scripts' +Analysis_config = {} +Analysis_config['From'] = 'Script' +Analysis_config['Data'] = 'Script_UserPostAnalysis.py' +study_config['UserPostAnalysis'] = Analysis_config diff --git a/src/daComposant/daCore/Aidsm.py b/src/daComposant/daCore/Aidsm.py index 15cbb83..5fcbbc1 100644 --- a/src/daComposant/daCore/Aidsm.py +++ b/src/daComposant/daCore/Aidsm.py @@ -42,6 +42,7 @@ class Aidsm(object): """ ADAO Internal Data Structure Model """ def __init__(self, name = "", addViewers=None): self.__name = str(name) + self.__directory = None self.__case = CaseLogger(self.__name, "case", addViewers) # self.__adaoObject = {} @@ -137,10 +138,10 @@ class Aidsm(object): except Exception as e: if isinstance(e, SyntaxError): msg = "at %s: %s"%(e.offset, e.text) else: msg = "" - raise ValueError("during settings, the following error occurs:\n"+\ - "\n%s %s\n\nSee also the potential messages, "+\ - "which can show the origin of the above error, "+\ - "in the launching terminal."%(str(e),msg)) + raise ValueError(("during settings, the following error occurs:\n"+\ + "\n%s %s\n\nSee also the potential messages, "+\ + "which can show the origin of the above error, "+\ + "in the launching terminal.")%(str(e),msg)) # ----------------------------------------------------------- @@ -224,29 +225,7 @@ class Aidsm(object): name = Concept, asVector = Vector, asPersistentVector = VectorSerie, - asScript = Script, - scheduledBy = Scheduler, - toBeChecked = Checked, - ) - if Stored: - self.__StoredInputs[Concept] = self.__adaoObject[Concept].getO() - return 0 - - def setControls(self, - Vector = (), # Valeur par defaut pour un vecteur vide - VectorSerie = None, - Script = None, - Stored = False, - Scheduler = None, - Checked = False): - "Definition d'un concept de calcul" - Concept = "Controls" - self.__case.register("set"+Concept, dir(), locals()) - self.__adaoObject[Concept] = State( - name = Concept, - asVector = Vector, - asPersistentVector = VectorSerie, - asScript = Script, + asScript = self.with_directory(Script), scheduledBy = Scheduler, toBeChecked = Checked, ) @@ -413,12 +392,12 @@ class Aidsm(object): self.__StoredInputs[Concept] = self.__adaoObject[Concept].getO() return 0 - def setDebug(self, level = 10): + def setDebug(self, __level = 10): "NOTSET=0 < DEBUG=10 < INFO=20 < WARNING=30 < ERROR=40 < CRITICAL=50" self.__case.register("setDebug",dir(),locals()) log = logging.getLogger() - log.setLevel( level ) - self.__StoredInputs["Debug"] = level + log.setLevel( __level ) + self.__StoredInputs["Debug"] = __level self.__StoredInputs["NoDebug"] = False return 0 @@ -579,7 +558,6 @@ class Aidsm(object): files.sort() return files - # ----------------------------------------------------------- def get_algorithms_main_path(self): """ diff --git a/src/daComposant/daCore/PlatformInfo.py b/src/daComposant/daCore/PlatformInfo.py index f401ab7..6192753 100644 --- a/src/daComposant/daCore/PlatformInfo.py +++ b/src/daComposant/daCore/PlatformInfo.py @@ -186,6 +186,7 @@ except ImportError: has_salome = bool( "ROOT_SALOME" in os.environ ) has_yacs = bool( "YACS_ROOT_DIR" in os.environ ) has_adao = bool( "ADAO_ROOT_DIR" in os.environ ) +has_eficas = bool( "EFICAS_ROOT_DIR" in os.environ ) # ============================================================================== def uniq(sequence): diff --git a/src/daSalome/daYacsIntegration/daStudy.py b/src/daSalome/daYacsIntegration/daStudy.py index 8993a98..730952b 100644 --- a/src/daSalome/daYacsIntegration/daStudy.py +++ b/src/daSalome/daYacsIntegration/daStudy.py @@ -37,7 +37,6 @@ class daStudy: def __init__(self, name, algorithm, debug): self.ADD = AssimilationStudy(name) - self.ADD.setControls() self.algorithm = algorithm self.algorithm_dict = None self.Background = None -- 2.39.2