examples/daSalome/Makefile
examples/daSalome/test003_ADAO_JDC_using_scripts.comm
examples/daSalome/test004_ADAO_JDC_using_scripts.comm
+ examples/daSalome/test005_ADAO_Operators.comm
bin/Makefile
bin/qtEficas_adao_study.py
doc/Makefile
test003_ADAO_JDC_using_scripts.comm \
test003_ADAO_scripts_for_JDC.py \
test004_ADAO_JDC_using_scripts.comm \
- test004_ADAO_scripts_for_JDC.py
+ test004_ADAO_scripts_for_JDC.py \
+ test005_ADAO_Operators.comm \
+ test005_ADAO_scripts_for_JDC.py
examplesdasalome_DATA = ${DATA_INST}
test003_ADAO_JDC_using_scripts.comm.in \
test003_ADAO_scripts_for_JDC.py \
test004_ADAO_JDC_using_scripts.comm.in \
- test004_ADAO_scripts_for_JDC.py
+ test004_ADAO_scripts_for_JDC.py \
+ test005_ADAO_Operators.comm.in \
+ test005_ADAO_scripts_for_JDC.py
--- /dev/null
+
+ASSIMILATION_STUDY(Study_name='Test',
+ Study_repertory='@prefix@/share/salome/adao_examples/daSalome',
+ Debug=0,
+ Algorithm='3DVAR',
+ Background=_F(INPUT_TYPE='Vector',
+ data=_F(FROM='String',
+ STRING='0 0 0',),),
+ BackgroundError=_F(INPUT_TYPE='Matrix',
+ data=_F(FROM='String',
+ STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+ Observation=_F(INPUT_TYPE='Vector',
+ data=_F(FROM='String',
+ STRING='1 1 1',),),
+ ObservationError=_F(INPUT_TYPE='Matrix',
+ data=_F(FROM='String',
+ STRING='1 0 0 ; 0 1 0 ; 0 0 1',),),
+ ObservationOperator=_F(INPUT_TYPE='Function',
+ data=_F(FROM='FunctionDict',
+ FUNCTIONDICT_FILE='test005_ADAO_scripts_for_JDC.py',),),
+ UserPostAnalysis=_F(FROM='String',
+ STRING=
+"""import numpy
+Xb = Study.getBackground()
+Xa = ADD.get("Analysis").valueserie(-1)
+print
+print "Size of Background...........= %i"%len(Xb.A1)
+print "Size of Analysis.............= %i"%len(Xa)
+print "Min, mean, max of Analysis...= %8.3f, %8.3f, %8.3f"%(min(Xa),numpy.mean(Xa),max(Xa))
+print
+""",),);
--- /dev/null
+#-*-coding:iso-8859-1-*-
+import numpy
+import logging
+logging.info("ComputationFunctionNode: Begin")
+# ==============================================================================
+# Input data and parameters: all is in the required input variable
+# "computation", containing for example:
+# {'inputValues': [[[[0.0, 0.0, 0.0]]]],
+# 'inputVarList': ['adao_default'],
+# 'outputVarList': ['adao_default'],
+# 'specificParameters': [{'name': 'method', 'value': 'Direct'}]}
+# ==============================================================================
+#
+# Recovering the type of computation: "Direct", "Tangent" or "Adjoint"
+# --------------------------------------------------------------------
+method = ""
+for param in computation["specificParameters"]:
+ if param["name"] == "method":
+ method = param["value"]
+logging.info("ComputationFunctionNode: Found method is \'%s\'"%method)
+#
+# Recovering the current control state X
+# --------------------------------------
+Xcurrent = computation["inputValues"][0][0][0]
+#
+# Building explicit calculation or requiring external ones
+# --------------------------------------------------------
+dimension = len( Xcurrent )
+H = numpy.matrix(numpy.core.identity(dimension))
+#
+def FunctionH( X ):
+ return H * X
+#
+def AdjointH( (X, Y) ):
+ return H.T * Y
+#
+# The possible computations
+# -------------------------
+if method == "Direct":
+ logging.info("ComputationFunctionNode: Direct computation")
+ data = FunctionH(numpy.matrix( Xcurrent ).T)
+#
+if method == "Tangent":
+ logging.info("ComputationFunctionNode: Tangent computation")
+ data = FunctionH(numpy.matrix( Xcurrent ).T)
+#
+if method == "Adjoint":
+ logging.info("ComputationFunctionNode: Adjoint computation")
+ Ycurrent = computation["inputValues"][0][0][1]
+ data = AdjointH((numpy.matrix( Xcurrent ).T, numpy.matrix( Ycurrent ).T))
+#
+# Formatting the output
+# ---------------------
+logging.info("ComputationFunctionNode: Formatting the output")
+it = data.flat
+outputValues = [[[[]]]]
+for val in it:
+ outputValues[0][0][0].append(val)
+#
+result = {}
+result["outputValues"] = outputValues
+result["specificOutputInfos"] = []
+result["returnCode"] = 0
+result["errorMessage"] = ""
+#
+logging.info("ComputationFunctionNode: End")