src/tests/daSalome/test017_3DVAR_par_fonction.py
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/zzzz159a.export.esclave
src/tests/daComposant/Makefile
src/tests/daComposant/Plateforme/Makefile
else:
proc.edAddDFLink(execute_node.getOutputPort("Study"), analysis_node.getInputPort("Study"))
+ # Connect node with InitUserData
+ if "Analysis" in init_config["Target"]:
+ analysis_node.edAddInputPort("init_data", t_pyobj)
+ proc.edAddDFLink(init_node.getOutputPort("init_data"), analysis_node.getInputPort("init_data"))
+
elif analysis_config["From"] == "File":
factory_analysis_node = catalogAd._nodeMap["SimpleUserAnalysis"]
analysis_node = factory_analysis_node.cloneNode("User Analysis")
proc.edAddDFLink(optimizer_node.edGetAlgoResultPort(), analysis_node.getInputPort("Study"))
else:
proc.edAddDFLink(execute_node.getOutputPort("Study"), analysis_node.getInputPort("Study"))
+ # Connect node with InitUserData
+ if "Analysis" in init_config["Target"]:
+ analysis_node.edAddInputPort("init_data", t_pyobj)
+ proc.edAddDFLink(init_node.getOutputPort("init_data"), analysis_node.getInputPort("init_data"))
pass
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
testsdasalome_DATA = ${DATA_INST}
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
Init_config["Type"] = "Dict"
Init_config["From"] = "Script"
Init_config["Target"] = ["AlgorithmParameters", "Background", "BackgroundError",
- "Observation", "ObservationError", "ObservationOperator"]
+ "Observation", "ObservationError", "ObservationOperator", "Analysis"]
study_config["Init"] = Init_config
Algorithm_config = {}
Analysis_config["Data"] = """
import numpy
-Xa = ADD.get("Analysis").valueserie(0)
-print "Analyse = ",Xa
+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
--- /dev/null
+#-*-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"] = "Dict"
+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
--- /dev/null
+debug = init_data["debug"]
+parametres = init_data["parametres"]
+
+Bornes = []
+for parametre in parametres:
+ Bornes.append(parametre[2:4])
+
+if debug:
+ print
+ print "Bornes = ",Bornes
+ print
+
+AlgorithmParameters = { "Minimizer" : "LBFSGB",
+ "Bounds" : Bornes,
+ }