From 225c60fe2570a896cb9c5b783621b251905a3e4c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Ribes?= Date: Tue, 28 Feb 2012 11:10:11 +0100 Subject: [PATCH] Adding new example for observers --- configure.ac | 1 + examples/daSalome/Makefile.am | 2 + ...4_ADAO_JDC_Observers_using_scripts.comm.in | 47 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in diff --git a/configure.ac b/configure.ac index fcd747a..737babc 100644 --- a/configure.ac +++ b/configure.ac @@ -126,6 +126,7 @@ AC_CONFIG_FILES([ examples/daSalome/Makefile examples/daSalome/test003_ADAO_JDC_using_scripts.comm examples/daSalome/test004_ADAO_JDC_using_scripts.comm + examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm examples/daSalome/test005_ADAO_Operators.comm examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm examples/daSkeletons/Makefile diff --git a/examples/daSalome/Makefile.am b/examples/daSalome/Makefile.am index 981ac53..ee228af 100644 --- a/examples/daSalome/Makefile.am +++ b/examples/daSalome/Makefile.am @@ -27,6 +27,7 @@ DATA_INST = \ test003_ADAO_scripts_for_JDC.py \ test004_ADAO_JDC_using_scripts.comm \ test004_ADAO_scripts_for_JDC.py \ + test004_ADAO_JDC_Observers_using_scripts.comm \ test005_ADAO_Operators.comm \ test005_ADAO_scripts_for_JDC.py \ test003_bis_ADAO_JDC_using_user_data_init.comm \ @@ -42,6 +43,7 @@ EXTRA_DIST = \ test003_ADAO_scripts_for_JDC.py \ test004_ADAO_JDC_using_scripts.comm.in \ test004_ADAO_scripts_for_JDC.py \ + test004_ADAO_JDC_Observers_using_scripts.comm.in \ test005_ADAO_Operators.comm.in \ test005_ADAO_scripts_for_JDC.py \ test003_bis_ADAO_JDC_using_user_data_init.comm.in \ diff --git a/examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in b/examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in new file mode 100644 index 0000000..07bf1d0 --- /dev/null +++ b/examples/daSalome/test004_ADAO_JDC_Observers_using_scripts.comm.in @@ -0,0 +1,47 @@ + +ASSIMILATION_STUDY(Study_name='Test', + Study_repertory='@prefix@/share/salome/adao_examples/daSalome', + Debug=0, + Algorithm='Blue', + Background=_F(INPUT_TYPE='Vector', + data=_F(FROM='Script', + SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),), + BackgroundError=_F(INPUT_TYPE='Matrix', + data=_F(FROM='Script', + SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),), + Observation=_F(INPUT_TYPE='Vector', + data=_F(FROM='Script', + SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),), + ObservationError=_F(INPUT_TYPE='Matrix', + data=_F(FROM='Script', + SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),), + ObservationOperator=_F(INPUT_TYPE='Matrix', + data=_F(FROM='Script', + SCRIPT_FILE='test004_ADAO_scripts_for_JDC.py',),), + UserPostAnalysis=_F(FROM='String', + STRING= +"""import numpy +Xa = ADD.get("Analysis").valueserie(-1) +print +print "Size of Analysis = %i"%len(Xa) +print "Min, mean, max = %8.3f, %8.3f, %8.3f"%(min(Xa),numpy.mean(Xa),max(Xa)) +print +""",), + Observers=_F(SELECTION='Analysis', + Analysis_data=_F(NodeType='pyscript', + Value= +"""print " ---> Mise en oeuvre de l'observer : affichage de la valeur courante" + print " var =",var.valueserie(-1) + print " info =",info + # + import Gnuplot + gp = Gnuplot.Gnuplot() + gp('set style data lines') + gp('set title "'+str(info)+'"') + gp.plot( Gnuplot.Data( var.valueserie(-1) ) ) + global numero + numero += 1 + filename = "image_%02i.ps"%numero + print " sauvegarde image \"%s\""%filename + gp.hardcopy(filename=filename, color=1) +""",),),); -- 2.39.2