From: André Ribes Date: Tue, 28 Feb 2012 10:10:11 +0000 (+0100) Subject: Adding new example for observers X-Git-Tag: V6_5_0~25^2~9 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=225c60fe2570a896cb9c5b783621b251905a3e4c;p=modules%2Fadao.git Adding new example for observers --- 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) +""",),),);