]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
ASTER Ok
authorAndré Ribes <andre.ribes@edf.fr>
Mon, 4 Apr 2011 13:53:32 +0000 (15:53 +0200)
committerAndré Ribes <andre.ribes@edf.fr>
Mon, 4 Apr 2011 13:53:32 +0000 (15:53 +0200)
Il semble que la sortie soit différente selon le code direct ou
adjoint. J'ai donc pris le parti de ne pas utiliser les informations
sur les sorties de l'utilisateur et de tout prendre.

13 files changed:
configure.ac
resources/ADAOSchemaCatalog.xml
src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py
src/daSalome/daYacsIntegration/daOptimizerLoop.py
src/daSalome/daYacsIntegration/daStudy.py
src/daSalome/daYacsSchemaCreator/methods.py
src/tests/daSalome/Makefile.am
src/tests/daSalome/test017.comm.in [new file with mode: 0644]
src/tests/daSalome/test017_3DVAR_par_fonction.py.in [deleted file]
src/tests/daSalome/test_aster_zzzz159a.py.in [deleted file]
src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in [new file with mode: 0644]
src/tests/daSalome/test_aster_zzzz159a_LBFGSB.py.in [deleted file]
src/tests/daSalome/test_aster_zzzz159a_functions.py

index c26893909b8ddea68b3f0954a49624fd27e88f29..b7c5314a2c9c604c157f29e54f9778a0cc8df339 100644 (file)
@@ -121,11 +121,9 @@ AC_CONFIG_FILES([
         src/tests/Makefile
         src/tests/daSalome/Makefile
         src/tests/daSalome/test000_Blue_AnalysisFile.py
-        src/tests/daSalome/test017_3DVAR_par_fonction.py
         src/tests/daSalome/test017.comm
         src/tests/daSalome/test_aster_zzzz159a_init_parameters.py
-        src/tests/daSalome/test_aster_zzzz159a.py
-        src/tests/daSalome/test_aster_zzzz159a_LBFGSB.py
+        src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm
         src/tests/daSalome/zzzz159a.export.esclave
         bin/Makefile
         bin/qtEficas_adao_study.py
index e6883b31e05a4c672e846951fb79024904d48ea9..9190aea11df0b1a2c755063cd6f5bd0912e09fb6 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version='1.0' encoding='iso-8859-1' ?>
 <proc>
-  
+
   <objref name="computeAD" id="python:computeAD:1.0">
     <base>pyobj</base>
   </objref>
@@ -136,6 +136,11 @@ if ObservationOperatorOk == 0:
     assim_study.setObservationOperatorType("Adjoint", "Function")
     assim_study.setObservationOperator("Adjoint", ObservationOperatorAdjoint)
 
+# Variables
+for name, size in zip(InputVariablesNames, InputVariablesSizes):
+  assim_study.setInputVariable(name, size)
+for name, size in zip(OutputVariablesNames, OutputVariablesSizes):
+  assim_study.setOutputVariable(name, size)
 
 Study = assim_study
 ]]>
@@ -144,6 +149,10 @@ Study = assim_study
     <inport name="Name" type="string"/>
     <inport name="Algorithm" type="string"/>
     <inport name="Debug" type="bool"/>
+    <inport name="InputVariablesNames" type="stringvec"/>
+    <inport name="InputVariablesSizes" type="intvec"/>
+    <inport name="OutputVariablesNames" type="stringvec"/>
+    <inport name="OutputVariablesSizes" type="intvec"/>
     <outport name="Study" type="pyobj"/>
   </inline>
 
index 766903af581657839925f487d75ced53b43509ff..45c0f661e6f9acb22e91a00186c327974a7f010b 100644 (file)
@@ -138,10 +138,11 @@ class AdaoCaseManager(EficasObserver):
     """
     adaoLogger.debug("currentSelectionChanged")
     salomeStudyItem = adaoGuiHelper.getSelectedItem()
-    for case_editor, adao_case in self.cases.iteritems():
-      if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID():
-        self.eficas_manager.selectCase(adao_case.eficas_editor)
-        break
+    if salomeStudyItem is not None:
+      for case_editor, adao_case in self.cases.iteritems():
+        if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID():
+          self.eficas_manager.selectCase(adao_case.eficas_editor)
+          break
 
   # Depuis Eficas
   def _processEficasTabChanged(self, eficasWrapper, eficasEvent):
index 7487d9d8ff179499a6bc7f56e8ff6e79ae4541cc..e29795b9f5e715167f8c1946a1fa4acf4359f054 100644 (file)
@@ -24,8 +24,10 @@ class OptimizerHooks:
     # TODO Input, Output VarList
     inputVarList  = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("string"))
     outputVarList = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("string"))
-    inputVarList.pushBack("adao_default")
-    outputVarList.pushBack("adao_default")
+    for var in self.optim_algo.da_study.InputVariables:
+      inputVarList.pushBack(var)
+    for var in self.optim_algo.da_study.OutputVariables:
+      outputVarList.pushBack(var)
     sample.setEltAtRank("inputVarList", inputVarList)
     sample.setEltAtRank("outputVarList", outputVarList)
 
@@ -49,24 +51,50 @@ class OptimizerHooks:
     parameter_1D = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("double"))
     parameter_2D = pilot.SequenceAny_New(parameter_1D.getType())
     parameters_3D = pilot.SequenceAny_New(parameter_2D.getType())
+
+    print "Input Data", data
     if isinstance(data, type((1,2))):
-      for dat in data:
-        param = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("double"))
-        it = dat.flat
-        for val in it:
-          param.pushBack(val)
-        parameter_2D.pushBack(param)
+      self.add_parameters(data[0], parameter_2D)
+      self.add_parameters(data[1], parameter_2D, Output=True)
     else:
-      param = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("double"))
-      it = data.flat
-      for val in it:
-        param.pushBack(val)
-      parameter_2D.pushBack(param)
+      self.add_parameters(data, parameter_2D)
     parameters_3D.pushBack(parameter_2D)
     sample.setEltAtRank("inputValues", parameters_3D)
-
     return sample
 
+  def add_parameters(self, data, parameter_2D, Output=False):
+    param = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("double"))
+    elt_list = 0 # index dans la liste des arguments
+    val_number = 0 # nbre dans l'argument courant
+    if not Output:
+      val_end = self.optim_algo.da_study.InputVariables[self.optim_algo.da_study.InputVariablesOrder[elt_list]] # nbr de l'argument courant (-1 == tout)
+    else:
+      val_end = self.optim_algo.da_study.OutputVariables[self.optim_algo.da_study.OutputVariablesOrder[elt_list]] # nbr de l'argument courant (-1 == tout)
+
+    it = data.flat
+    for val in it:
+      param.pushBack(val)
+      val_number += 1
+      # Test si l'argument est ok
+      if val_end != -1:
+        if val_number == val_end:
+          parameter_2D.pushBack(param)
+          param = pilot.SequenceAny_New(self.optim_algo.runtime.getTypeCode("double"))
+          val_number = 0
+          elt_list += 1
+          if not Output:
+            if elt_list < len(self.optim_algo.da_study.InputVariablesOrder):
+              val_end = self.optim_algo.da_study.InputVariables[self.optim_algo.da_study.InputVariablesOrder[elt_list]]
+            else:
+              break
+          else:
+            if elt_list < len(self.optim_algo.da_study.OutputVariablesOrder):
+              val_end = self.optim_algo.da_study.OutputVariables[self.optim_algo.da_study.OutputVariablesOrder[elt_list]]
+            else:
+              break
+    if val_end == -1:
+      parameter_2D.pushBack(param)
+
   def get_data_from_any(self, any_data):
     error = any_data["returnCode"].getIntValue()
     if error != 0:
index bc630737032448c1b2eb8909ed5c849adb3c218e..f48ee26156e55b14070df3916053f527b927c692 100644 (file)
@@ -2,6 +2,7 @@
 
 from daCore.AssimilationStudy import AssimilationStudy
 from daCore import Logging
+import logging
 
 class daError(Exception):
   def __init__(self, value):
@@ -18,19 +19,29 @@ class daStudy:
     self.algorithm = algorithm
     self.algorithm_dict = None
     self.Background = None
+    self.InputVariables = {}
+    self.OutputVariables = {}
+    self.InputVariablesOrder = []
+    self.OutputVariablesOrder = []
 
     self.debug = debug
-    import logging
     if self.debug:
       logging.getLogger().setLevel(logging.DEBUG)
     else:
       logging.getLogger().setLevel(logging.INFO)
 
-
     # Observation Management
     self.ObservationOperatorType = {}
     self.FunctionObservationOperator = {}
 
+  def setInputVariable(self, name, size):
+    self.InputVariables[name] = size
+    self.InputVariablesOrder.append(name)
+
+  def setOutputVariable(self, name, size):
+    self.OutputVariables[name] = size
+    self.OutputVariablesOrder.append(name)
+
   def setAlgorithmParameters(self, parameters):
     self.algorithm_dict = parameters
 
index bc58afc8f4a49c65de9076e6f99c5f4321db9b4f..f1f2983a221396fcac95a61ba77c0c437eafc47d 100644 (file)
@@ -70,6 +70,23 @@ def create_yacs_proc(study_config):
     CAS_node.getInputPort("Debug").edInitPy(False)
   else:
     CAS_node.getInputPort("Debug").edInitPy(True)
+
+  # Ajout des Variables
+  InputVariablesNames = []
+  InputVariablesSizes = []
+  for var in study_config["InputVariables"]["Order"]:
+    InputVariablesNames.append(var)
+    InputVariablesSizes.append(int(study_config["InputVariables"][var]))
+  CAS_node.getInputPort("InputVariablesNames").edInitPy(InputVariablesNames)
+  CAS_node.getInputPort("InputVariablesSizes").edInitPy(InputVariablesSizes)
+  OutputVariablesNames = []
+  OutputVariablesSizes = []
+  for var in study_config["OutputVariables"]["Order"]:
+    OutputVariablesNames.append(var)
+    OutputVariablesSizes.append(int(study_config["OutputVariables"][var]))
+  CAS_node.getInputPort("OutputVariablesNames").edInitPy(OutputVariablesNames)
+  CAS_node.getInputPort("OutputVariablesSizes").edInitPy(OutputVariablesSizes)
+
   proc.edAddChild(CAS_node)
 
   # Step 0.5: Find if there is a user init node
index 8c2fcee8b19ba44a6050bc4ed479992b389f2ede..76b32686db72d58501b6a95763966ede6635d5f9 100644 (file)
@@ -2,7 +2,7 @@ include $(top_srcdir)/adm_local/make_common_starter.am
 
 DATA_INST = \
            test000_Blue_AnalysisCode.py test000_Blue_AnalysisFile.py test000_Blue.py \
-           test017_3DVAR_par_fonction.py test017_3DVAR_function_script.py test017_3DVAR_init_data.py \
+           test017_3DVAR_function_script.py test017_3DVAR_init_data.py \
            test017.comm \
            test_aster_zzzz159a_background_error.py \
            test_aster_zzzz159a_background.py \
@@ -12,15 +12,14 @@ DATA_INST = \
            test_aster_zzzz159a_aster_functions.py \
            test_aster_zzzz159a_init_algorithm.py \
            test_aster_zzzz159a_init_parameters.py \
-           test_aster_zzzz159a.py \
-           test_aster_zzzz159a_LBFGSB.py \
            test_aster_zzzz159a_init_algorithm_LBFGSB.py \
-           zzzz159a.3  zzzz159a.export.esclave  zzzz159a.mail
+           zzzz159a.3  zzzz159a.export.esclave  zzzz159a.mail \
+           test_aster_zzzz159a_LBFGSB.comm
 
 testsdasalome_DATA = ${DATA_INST}
 
 EXTRA_DIST = test000_Blue_AnalysisCode.py test000_Blue_AnalysisFile.py.in test000_Blue.py \
-            test017_3DVAR_par_fonction.py.in test017_3DVAR_function_script.py test017_3DVAR_init_data.py \
+            test017_3DVAR_function_script.py test017_3DVAR_init_data.py \
             test017.comm.in \
             test_aster_zzzz159a_background_error.py \
             test_aster_zzzz159a_background.py \
@@ -31,6 +30,6 @@ EXTRA_DIST = test000_Blue_AnalysisCode.py test000_Blue_AnalysisFile.py.in test00
             test_aster_zzzz159a_init_algorithm.py \
             test_aster_zzzz159a_init_parameters.py.in \
             test_aster_zzzz159a.py.in \
-            test_aster_zzzz159a_LBFGSB.py.in \
             test_aster_zzzz159a_init_algorithm_LBFGSB.py \
-            zzzz159a.3  zzzz159a.export.esclave.in  zzzz159a.mail
+            zzzz159a.3  zzzz159a.export.esclave.in  zzzz159a.mail \
+            test_aster_zzzz159a_LBFGSB.comm.in
diff --git a/src/tests/daSalome/test017.comm.in b/src/tests/daSalome/test017.comm.in
new file mode 100644 (file)
index 0000000..2a56c7d
--- /dev/null
@@ -0,0 +1,42 @@
+
+ASSIMILATION_STUDY(Study_name='test017',
+                   Study_repertory='@prefix@/tests/daSalome',
+                   Debug=0,
+                   Algorithm='3DVAR',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='Script',
+                                         SCRIPT_FILE=
+                           'test017_3DVAR_init_data.py',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='Script',
+                                              SCRIPT_FILE=
+                           'test017_3DVAR_init_data.py',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='Script',
+                                          SCRIPT_FILE=
+                           'test017_3DVAR_init_data.py',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='Script',
+                                               SCRIPT_FILE=
+                           'test017_3DVAR_init_data.py',),),
+                   ObservationOperator=_F(INPUT_TYPE='Function',
+                                          data=_F(FROM='FunctionDict',
+                                                  FUNCTIONDICT_FILE=
+                     'test017_3DVAR_function_script.py',),),
+                   UserPostAnalysis=_F(FROM='String',
+                                       STRING=
+"""import numpy
+dimension = 300
+precision = 1.e-10
+xt = numpy.matrix(numpy.arange(dimension)).T
+xb = Study.getBackground()
+xa = numpy.array(ADD.get("Analysis").valueserie(0))
+d  = numpy.array(ADD.get("Innovation").valueserie(0))
+#
+# Verification du resultat
+# ------------------------
+if max(abs(xa - (xb+xt.A1)/2)) > precision:
+    raise ValueError("Resultat du test errone (1)")
+else:
+    print "    Test correct, erreur maximale inferieure à %s"%precision
+""",),);
diff --git a/src/tests/daSalome/test017_3DVAR_par_fonction.py.in b/src/tests/daSalome/test017_3DVAR_par_fonction.py.in
deleted file mode 100644 (file)
index 90a75fd..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#-*-coding:iso-8859-1-*-
-study_config = {}
-study_config["Name"] = "test017_3DVAR"
-study_config["Algorithm"] = "3DVAR"
-
-Background_config = {}
-Background_config["Data"] = "@prefix@/tests/daSalome/test017_3DVAR_init_data.py"
-Background_config["Type"] = "Vector"
-Background_config["From"] = "Script"
-study_config["Background"] = Background_config
-
-BackgroundError_config = {}
-BackgroundError_config["Data"] = "@prefix@/tests/daSalome/test017_3DVAR_init_data.py"
-BackgroundError_config["Type"] = "Matrix"
-BackgroundError_config["From"] = "Script"
-study_config["BackgroundError"] = BackgroundError_config
-
-Observation_config = {}
-Observation_config["Data"] = "@prefix@/tests/daSalome/test017_3DVAR_init_data.py"
-Observation_config["Type"] = "Vector"
-Observation_config["From"] = "Script"
-study_config["Observation"] = Observation_config
-
-ObservationError_config = {}
-ObservationError_config["Data"] = "@prefix@/tests/daSalome/test017_3DVAR_init_data.py"
-ObservationError_config["Type"] = "Matrix"
-ObservationError_config["From"] = "Script"
-study_config["ObservationError"] = ObservationError_config
-
-FunctionDict = {}
-FunctionDict["Function"] = ["Direct", "Tangent", "Adjoint"]
-FunctionDict["Script"] = {}
-FunctionDict["Script"]["Direct"] = "@prefix@/tests/daSalome/test017_3DVAR_function_script.py"
-FunctionDict["Script"]["Tangent"] = "@prefix@/tests/daSalome/test017_3DVAR_function_script.py"
-FunctionDict["Script"]["Adjoint"] = "@prefix@/tests/daSalome/test017_3DVAR_function_script.py"
-ObservationOperator_config = {}
-ObservationOperator_config["Data"] = FunctionDict
-ObservationOperator_config["Type"] = "Function"
-ObservationOperator_config["From"] = "FunctionDict"
-study_config["ObservationOperator"] = ObservationOperator_config
-
-Analysis_config = {}
-Analysis_config["Data"] = """
-import numpy
-
-dimension = 300
-precision = 1.e-10
-xt = numpy.matrix(numpy.arange(dimension)).T
-xb = Study.getBackground()
-
-xa = numpy.array(ADD.get("Analysis").valueserie(0))
-d  = numpy.array(ADD.get("Innovation").valueserie(0))
-#
-# Verification du resultat
-# ------------------------
-if max(abs(xa - (xb+xt.A1)/2)) > precision:
-    raise ValueError("Resultat du test errone (1)")
-else:
-    print "    Test correct, erreur maximale inferieure à %s"%precision
-"""
-Analysis_config["From"] = "String"
-study_config["Analysis"] = Analysis_config
diff --git a/src/tests/daSalome/test_aster_zzzz159a.py.in b/src/tests/daSalome/test_aster_zzzz159a.py.in
deleted file mode 100644 (file)
index 3aa8f8d..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#-*-coding:iso-8859-1-*-
-study_config = {}
-study_config["Name"] = "test_aster_zzzz159a"
-study_config["Algorithm"] = "3DVAR"
-
-Init_config = {}
-Init_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_parameters.py"
-Init_config["Type"] = "Dict"
-Init_config["From"] = "Script"
-Init_config["Target"] = ["AlgorithmParameters", "Background", "BackgroundError",
-    "Observation", "ObservationError", "ObservationOperator", "Analysis"]
-study_config["Init"] = Init_config
-
-Algorithm_config = {}
-Algorithm_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_algorithm.py"
-Algorithm_config["Type"] = "Dict"
-Algorithm_config["From"] = "Script"
-study_config["AlgorithmParameters"] = Algorithm_config
-
-Background_config = {}
-Background_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background.py"
-Background_config["Type"] = "Vector"
-Background_config["From"] = "Script"
-study_config["Background"] = Background_config
-
-BackgroundError_config = {}
-BackgroundError_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background_error.py"
-BackgroundError_config["Type"] = "Matrix"
-BackgroundError_config["From"] = "Script"
-study_config["BackgroundError"] = BackgroundError_config
-
-Observation_config = {}
-Observation_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_observation.py"
-Observation_config["Type"] = "Vector"
-Observation_config["From"] = "Script"
-study_config["Observation"] = Observation_config
-
-ObservationError_config = {}
-ObservationError_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_observation_error.py"
-ObservationError_config["Type"] = "Matrix"
-ObservationError_config["From"] = "Script"
-study_config["ObservationError"] = ObservationError_config
-
-FunctionDict = {}
-FunctionDict["Function"] = ["Direct", "Tangent", "Adjoint"]
-FunctionDict["Script"] = {}
-FunctionDict["Script"]["Direct"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-FunctionDict["Script"]["Tangent"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-FunctionDict["Script"]["Adjoint"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-ObservationOperator_config = {}
-ObservationOperator_config["Data"] = FunctionDict
-ObservationOperator_config["Type"] = "Function"
-ObservationOperator_config["From"] = "FunctionDict"
-study_config["ObservationOperator"] = ObservationOperator_config
-
-Analysis_config = {}
-Analysis_config["Data"] = """
-import numpy
-
-xa = ADD.get("Analysis").valueserie(0)
-Innovation = ADD.get("Innovation").valueserie(0)
-A = []
-J = ADD.get("CostFunctionJ").valueserie()
-#
-ADD.setDiagnostic("PlotVectors", "J")
-MonPlot = ADD.get("J")
-MonPlot.calculate([J,ADD.get("CostFunctionJb").valueserie(),ADD.get("CostFunctionJo").valueserie()],
-    title = "Fonctionnelles J, Jb et Jo",
-    ltitle = ["J","Jb","Jo"],
-    xlabel = "Pas", ylabel = "Valeur",
-    filename = "recherche_xx_Fonctionnelles.ps",
-    pause = False )
-
-
-nbmesures = 11 # De 0 à 1 par pas de 0.1
-instants = numpy.array([0.1*i for i in range(nbmesures)])
-yo = []
-for reponse in init_data['experience']:
-    for t,v in list(reponse):
-        if min(abs(t - instants)) < 1.e-8:
-            yo.append(v)
-xb = []
-Bornes = []
-for parametre in init_data['parametres']:
-    xb.append( parametre[1] )
-    Bornes.append( parametre[2:4] )
-B  = numpy.matrix(numpy.core.identity(len(xb)))
-alpha  = 1.e14
-B[0,0] = alpha * 100
-B[1,1] = alpha * 10
-B[2,2] = alpha * 1
-
-# Calcul de la RMS
-# ----------------
-import test_aster_zzzz159a_aster_functions as Code_Aster
-Hxa = Code_Aster.Calcul_Aster_Ponctuel( xa )
-V1 = numpy.array(Hxa)
-V2 = numpy.array(yo)
-import math
-rms = math.sqrt( ((V2 - V1)**2).sum() / float(V1.size) )
-
-print
-print "========="
-print "Ebauche = ",xb
-print "Analyse = ",xa
-print "RMS     = ",rms
-print
-print "NbSteps = ",len(J)
-print "J       = ",J
-print
-print "B[0,0]  = ",B[0,0]
-print "B[1,1]  = ",B[1,1]
-print "B[2,2]  = ",B[2,2]
-print "Bornes  = ",Bornes
-print "========="
-print
-"""
-Analysis_config["From"] = "String"
-study_config["Analysis"] = Analysis_config
diff --git a/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in b/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.comm.in
new file mode 100644 (file)
index 0000000..fcfe703
--- /dev/null
@@ -0,0 +1,98 @@
+
+ASSIMILATION_STUDY(Study_name='aster_zzzz159a_LBFGSB',
+                   Study_repertory='@prefix@/tests/daSalome',
+                   Debug=0,
+                   Algorithm='3DVAR',
+                   Background=_F(INPUT_TYPE='Vector',
+                                 data=_F(FROM='Script',
+                                         SCRIPT_FILE=
+                            'test_aster_zzzz159a_background.py',),),
+                   BackgroundError=_F(INPUT_TYPE='Matrix',
+                                      data=_F(FROM='Script',
+                                              SCRIPT_FILE=
+                      'test_aster_zzzz159a_background_error.py',),),
+                   Observation=_F(INPUT_TYPE='Vector',
+                                  data=_F(FROM='Script',
+                                          SCRIPT_FILE=
+                           'test_aster_zzzz159a_observation.py',),),
+                   ObservationError=_F(INPUT_TYPE='Matrix',
+                                       data=_F(FROM='Script',
+                                               SCRIPT_FILE=
+                     'test_aster_zzzz159a_observation_error.py',),),
+                   ObservationOperator=_F(INPUT_TYPE='Function',
+                                          data=_F(FROM='FunctionDict',
+                                                  FUNCTIONDICT_FILE=
+                             'test_aster_zzzz159a_functions.py',),),
+                   AlgorithmParameters=_F(INPUT_TYPE='Dict',
+                                          data=_F(FROM='Script',
+                                                  SCRIPT_FILE=
+                 'test_aster_zzzz159a_init_algorithm_LBFGSB.py',),),
+                   UserDataInit=_F(INIT_FILE=
+                       'test_aster_zzzz159a_init_parameters.py',
+                                   TARGET_LIST=
+                                   ('BackgroundError','Observation',
+                                                 'ObservationError','ObservationOperator','AlgorithmParameters',
+                                                 'UserPostAnalysis','Background',),),
+                   UserPostAnalysis=_F(FROM='String',
+                                       STRING=
+"""import numpy
+import os
+xa = ADD.get("Analysis").valueserie(0)
+Innovation = ADD.get("Innovation").valueserie(0)
+A = []
+J = ADD.get("CostFunctionJ").valueserie()
+ADD.setDiagnostic("PlotVectors", "J")
+MonPlot = ADD.get("J")
+if os.path.isfile("recherche_xx_Fonctionnelles.ps"):
+  os.remove("recherche_xx_Fonctionnelles.ps")
+MonPlot.calculate([J,ADD.get("CostFunctionJb").valueserie(),ADD.get("CostFunctionJo").valueserie()],
+    title = "Fonctionnelles J, Jb et Jo",
+    ltitle = ["J","Jb","Jo"],
+    xlabel = "Pas", ylabel = "Valeur",
+    filename = "recherche_xx_Fonctionnelles.ps",
+    pause = False )
+nbmesures = 11 # De 0 vers 1 par pas de 0.1
+instants = numpy.array([0.1*i for i in range(nbmesures)])
+yo = []
+for reponse in init_data['experience']:
+    for t,v in list(reponse):
+        if min(abs(t - instants)) < 1.e-8:
+            yo.append(v)
+xb = []
+Bornes = []
+for parametre in init_data['parametres']:
+    xb.append( parametre[1] )
+    Bornes.append( parametre[2:4] )
+B  = numpy.matrix(numpy.core.identity(len(xb)))
+alpha  = 1.e14
+B[0,0] = alpha * 100
+B[1,1] = alpha * 10
+B[2,2] = alpha * 1
+# Calcul de la RMS
+# ----------------
+import test_aster_zzzz159a_aster_functions as Code_Aster
+Hxa = Code_Aster.Calcul_Aster_Ponctuel( xa )
+V1 = numpy.array(Hxa)
+V2 = numpy.array(yo)
+import math
+rms = math.sqrt( ((V2 - V1)**2).sum() / float(V1.size) )
+print
+print "========="
+print "Ebauche = ",xb
+print "Analyse = ",xa
+print "RMS     = ",rms
+print
+print "NbSteps = ",len(J)
+print "J       = ",J
+print
+print "B[0,0]  = ",B[0,0]
+print "B[1,1]  = ",B[1,1]
+print "B[2,2]  = ",B[2,2]
+print "Bornes  = ",Bornes
+print "========="
+print
+""",),
+                   InputVariables=_F(NAMES=('YOUN__','DSDE__','SIGY__',),
+                                     SIZES=(1,1,1,),),
+                   OutputVariables=_F(NAMES=('REPONSE1','REPONSE2',),
+                                      SIZES=(11,11,),),);
diff --git a/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.py.in b/src/tests/daSalome/test_aster_zzzz159a_LBFGSB.py.in
deleted file mode 100644 (file)
index 8e58ed1..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#-*-coding:iso-8859-1-*-
-study_config = {}
-study_config["Name"] = "test_aster_zzzz159a"
-study_config["Algorithm"] = "3DVAR"
-
-Init_config = {}
-Init_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_parameters.py"
-Init_config["Type"] = "Dict"
-Init_config["From"] = "Script"
-Init_config["Target"] = ["AlgorithmParameters", "Background", "BackgroundError",
-    "Observation", "ObservationError", "ObservationOperator", "Analysis"]
-study_config["Init"] = Init_config
-
-Algorithm_config = {}
-Algorithm_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_algorithm_LBFGSB.py"
-Algorithm_config["Type"] = "Dict"
-Algorithm_config["From"] = "Script"
-study_config["AlgorithmParameters"] = Algorithm_config
-
-Background_config = {}
-Background_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background.py"
-Background_config["Type"] = "Vector"
-Background_config["From"] = "Script"
-study_config["Background"] = Background_config
-
-BackgroundError_config = {}
-BackgroundError_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background_error.py"
-BackgroundError_config["Type"] = "Matrix"
-BackgroundError_config["From"] = "Script"
-study_config["BackgroundError"] = BackgroundError_config
-
-Observation_config = {}
-Observation_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_observation.py"
-Observation_config["Type"] = "Vector"
-Observation_config["From"] = "Script"
-study_config["Observation"] = Observation_config
-
-ObservationError_config = {}
-ObservationError_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_observation_error.py"
-ObservationError_config["Type"] = "Matrix"
-ObservationError_config["From"] = "Script"
-study_config["ObservationError"] = ObservationError_config
-
-FunctionDict = {}
-FunctionDict["Function"] = ["Direct", "Tangent", "Adjoint"]
-FunctionDict["Script"] = {}
-FunctionDict["Script"]["Direct"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-FunctionDict["Script"]["Tangent"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-FunctionDict["Script"]["Adjoint"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_functions.py"
-ObservationOperator_config = {}
-ObservationOperator_config["Data"] = FunctionDict
-ObservationOperator_config["Type"] = "Function"
-ObservationOperator_config["From"] = "FunctionDict"
-study_config["ObservationOperator"] = ObservationOperator_config
-
-Analysis_config = {}
-Analysis_config["Data"] = """
-import numpy
-
-xa = ADD.get("Analysis").valueserie(0)
-Innovation = ADD.get("Innovation").valueserie(0)
-A = []
-J = ADD.get("CostFunctionJ").valueserie()
-#
-ADD.setDiagnostic("PlotVectors", "J")
-MonPlot = ADD.get("J")
-MonPlot.calculate([J,ADD.get("CostFunctionJb").valueserie(),ADD.get("CostFunctionJo").valueserie()],
-    title = "Fonctionnelles J, Jb et Jo",
-    ltitle = ["J","Jb","Jo"],
-    xlabel = "Pas", ylabel = "Valeur",
-    filename = "recherche_xx_Fonctionnelles.ps",
-    pause = False )
-
-
-nbmesures = 11 # De 0 à 1 par pas de 0.1
-instants = numpy.array([0.1*i for i in range(nbmesures)])
-yo = []
-for reponse in init_data['experience']:
-    for t,v in list(reponse):
-        if min(abs(t - instants)) < 1.e-8:
-            yo.append(v)
-xb = []
-Bornes = []
-for parametre in init_data['parametres']:
-    xb.append( parametre[1] )
-    Bornes.append( parametre[2:4] )
-B  = numpy.matrix(numpy.core.identity(len(xb)))
-alpha  = 1.e14
-B[0,0] = alpha * 100
-B[1,1] = alpha * 10
-B[2,2] = alpha * 1
-
-# Calcul de la RMS
-# ----------------
-import test_aster_zzzz159a_aster_functions as Code_Aster
-Hxa = Code_Aster.Calcul_Aster_Ponctuel( xa )
-V1 = numpy.array(Hxa)
-V2 = numpy.array(yo)
-import math
-rms = math.sqrt( ((V2 - V1)**2).sum() / float(V1.size) )
-
-print
-print "========="
-print "Ebauche = ",xb
-print "Analyse = ",xa
-print "RMS     = ",rms
-print
-print "NbSteps = ",len(J)
-print "J       = ",J
-print
-print "B[0,0]  = ",B[0,0]
-print "B[1,1]  = ",B[1,1]
-print "B[2,2]  = ",B[2,2]
-print "Bornes  = ",Bornes
-print "========="
-print
-"""
-Analysis_config["From"] = "String"
-study_config["Analysis"] = Analysis_config
index aa95b2980213fd21411664b13e62c2a9324b7f89..ca37753d9fff05fb8b00ec7187d72be3344e1942 100644 (file)
@@ -14,16 +14,43 @@ Code_Aster.calcul = init_data["calcul"]
 Code_Aster.parametres = init_data["parametres"]
 Code_Aster.python_version = init_data["python_version"]
 
-print computation["method"]
-
-if computation["method"] == "Direct":
-  result = Code_Aster.Calcul_Aster_Ponctuel(computation["data"])
-
-if computation["method"] == "Tangent":
-  result = Code_Aster.Calcul_Aster_Ponctuel(computation["data"])
-
-if computation["method"] == "Adjoint":
-  result = Code_Aster.Calcul_Aster_Adjoint(computation["data"])
-
+print computation
+method = ""
+for param in computation["specificParameters"]:
+  if param["name"] == "method":
+    method = param["value"]
+
+# Extraction des données et remise en forme (normalement à faire
+# dans le code
+# On sait qu'on a trois variables
+input_data = []
+for i in range(3):
+  input_data.append(computation["inputValues"][0][i][0])
+
+if method == "Adjoint":
+  input_data = (input_data, [])
+  for i in range(22):
+    if i < 11:
+      input_data[1].append(computation["inputValues"][0][3][i])
+    else:
+      input_data[1].append(computation["inputValues"][0][4][i-11])
+
+if method == "Direct":
+  output_data = Code_Aster.Calcul_Aster_Ponctuel(input_data)
+
+if method == "Tangent":
+  output_data = Code_Aster.Calcul_Aster_Ponctuel(input_data)
+
+if method == "Adjoint":
+  output_data = Code_Aster.Calcul_Aster_Adjoint(input_data)
+
+outputValues = [[[]]]
+for val in output_data:
+  outputValues[0][0].append(val)
+
+result = {}
+result["outputValues"] = outputValues
+result["specificOutputInfos"] = []
+result["returnCode"] = 0
+result["errorMessage"] = ""
 print "Computation end"
-