From: Jean-Philippe ARGAUD Date: Wed, 9 Oct 2013 10:53:43 +0000 (+0200) Subject: Updating and extending examples X-Git-Tag: V7_3_0~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=57606f93425796ebe6342682144079e9413d05ca;p=modules%2Fadao.git Updating and extending examples --- diff --git a/configure.ac b/configure.ac index 6916b58..1cadb70 100644 --- a/configure.ac +++ b/configure.ac @@ -125,10 +125,15 @@ AC_CONFIG_FILES([ examples/Makefile examples/daSalome/Makefile examples/daSalome/test003_ADAO_JDC_using_scripts.comm + examples/daSalome/test003_ADAO_JDC_using_scripts.py + examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm + examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.py examples/daSalome/test004_ADAO_JDC_using_scripts.comm + examples/daSalome/test004_ADAO_JDC_using_scripts.py examples/daSalome/test005_ADAO_Operators.comm - examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm + examples/daSalome/test005_ADAO_Operators.py examples/daSalome/test006_Observers.comm + examples/daSalome/test006_Observers.py examples/daSkeletons/Makefile examples/daSkeletons/External_data_definition_by_scripts/Makefile examples/daSkeletons/External_data_definition_by_scripts/ADAO_Case.comm diff --git a/examples/daSalome/Makefile.am b/examples/daSalome/Makefile.am index ef667f0..7593714 100644 --- a/examples/daSalome/Makefile.am +++ b/examples/daSalome/Makefile.am @@ -21,45 +21,65 @@ include $(top_srcdir)/adm_local/make_common_starter.am DATA_INST = \ - test001_ADAO_JDC_using_strings.comm \ - test002_ADAO_JDC_using_strings.comm \ - test003_ADAO_JDC_using_scripts.comm \ - test003_ADAO_scripts_for_JDC.py \ - test004_ADAO_JDC_using_scripts.comm \ - test004_ADAO_scripts_for_JDC.py \ - test005_ADAO_Operators.comm \ - test005_ADAO_scripts_for_JDC.py \ - test003_bis_ADAO_JDC_using_user_data_init.comm \ - test003_bis_ADAO_user_data_init.py \ - test003_bis_ADAO_scripts_for_JDC.py \ - test006_Observers.comm \ - test006_Observers_observer_with_file.py \ - test006_Observers_init.py \ - test006_Observers_Observation_Operator.py \ - test006_Observers_var.py \ + test001_ADAO_JDC_using_strings.comm \ + test001_ADAO_JDC_using_strings.py \ + test002_ADAO_JDC_using_strings.comm \ + test002_ADAO_JDC_using_strings.py \ + test003_ADAO_JDC_using_scripts.comm \ + test003_ADAO_JDC_using_scripts.py \ + test003_ADAO_scripts_for_JDC.py \ + test003_bis_ADAO_JDC_using_user_data_init.comm \ + test003_bis_ADAO_JDC_using_user_data_init.py \ + test003_bis_ADAO_scripts_for_JDC.py \ + test003_bis_ADAO_user_data_init.py \ + test004_ADAO_JDC_using_scripts.comm \ + test004_ADAO_JDC_using_scripts.py \ + test004_ADAO_scripts_for_JDC.py \ + test005_ADAO_Operators.comm\ + test005_ADAO_Operators.py \ + test005_ADAO_scripts_for_JDC.py \ + test006_Observers.comm \ + test006_Observers_init.py \ + test006_Observers_Observation_Operator.py \ + test006_Observers_observer_with_file.py \ + test006_Observers.py \ + test006_Observers_var.py \ test008_ADAO_Elementary_GradientTest.comm \ - test009_ADAO_Simple_GradientTest.comm \ - test010_ADAO_Simple_AdjointTest.comm + test008_ADAO_Elementary_GradientTest.py \ + test009_ADAO_Simple_GradientTest.comm \ + test009_ADAO_Simple_GradientTest.py \ + test010_ADAO_Simple_AdjointTest.comm \ + test010_ADAO_Simple_AdjointTest.py examplesdasalome_DATA = ${DATA_INST} EXTRA_DIST = \ - test001_ADAO_JDC_using_strings.comm \ - test002_ADAO_JDC_using_strings.comm \ - 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 \ - test005_ADAO_Operators.comm.in \ - test005_ADAO_scripts_for_JDC.py \ - test003_bis_ADAO_JDC_using_user_data_init.comm.in \ - test003_bis_ADAO_user_data_init.py \ - test003_bis_ADAO_scripts_for_JDC.py \ - test006_Observers.comm.in \ - test006_Observers_observer_with_file.py \ - test006_Observers_init.py \ - test006_Observers_Observation_Operator.py \ - test006_Observers_var.py \ + test001_ADAO_JDC_using_strings.comm \ + test001_ADAO_JDC_using_strings.py \ + test002_ADAO_JDC_using_strings.comm \ + test002_ADAO_JDC_using_strings.py \ + test003_ADAO_JDC_using_scripts.comm.in \ + test003_ADAO_JDC_using_scripts.py.in \ + test003_ADAO_scripts_for_JDC.py \ + test003_bis_ADAO_JDC_using_user_data_init.comm.in \ + test003_bis_ADAO_JDC_using_user_data_init.py.in \ + test003_bis_ADAO_scripts_for_JDC.py \ + test003_bis_ADAO_user_data_init.py \ + test004_ADAO_JDC_using_scripts.comm.in \ + test004_ADAO_JDC_using_scripts.py.in \ + test004_ADAO_scripts_for_JDC.py \ + test005_ADAO_Operators.comm.in \ + test005_ADAO_Operators.py.in \ + test005_ADAO_scripts_for_JDC.py \ + test006_Observers.comm.in \ + test006_Observers_init.py \ + test006_Observers_Observation_Operator.py \ + test006_Observers_observer_with_file.py \ + test006_Observers.py.in \ + test006_Observers_var.py \ test008_ADAO_Elementary_GradientTest.comm \ - test009_ADAO_Simple_GradientTest.comm \ - test010_ADAO_Simple_AdjointTest.comm + test008_ADAO_Elementary_GradientTest.py \ + test009_ADAO_Simple_GradientTest.comm \ + test009_ADAO_Simple_GradientTest.py \ + test010_ADAO_Simple_AdjointTest.comm \ + test010_ADAO_Simple_AdjointTest.py diff --git a/examples/daSalome/test001_ADAO_JDC_using_strings.comm b/examples/daSalome/test001_ADAO_JDC_using_strings.comm index 4196350..81133f3 100644 --- a/examples/daSalome/test001_ADAO_JDC_using_strings.comm +++ b/examples/daSalome/test001_ADAO_JDC_using_strings.comm @@ -28,4 +28,3 @@ ASSIMILATION_STUDY(Study_name='Test', """import numpy xa=numpy.ravel(ADD.get('Analysis')[-1]) print 'Analysis:',xa""",),); -#CHECKSUM:05af4155253fa5540d31e30d50b2b2b3 -:FIN CHECKSUM \ No newline at end of file diff --git a/examples/daSalome/test001_ADAO_JDC_using_strings.py b/examples/daSalome/test001_ADAO_JDC_using_strings.py new file mode 100644 index 0000000..2bd9acf --- /dev/null +++ b/examples/daSalome/test001_ADAO_JDC_using_strings.py @@ -0,0 +1,50 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = 'Blue' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'String' +Background_config['Data'] = '0 0 0' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'String' +BackgroundError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'String' +Observation_config['Data'] = '1 1 1' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'String' +ObservationError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'String' +ObservationOperator_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""" +study_config['UserPostAnalysis'] = Analysis_config diff --git a/examples/daSalome/test002_ADAO_JDC_using_strings.comm b/examples/daSalome/test002_ADAO_JDC_using_strings.comm index efb2bbd..010f40f 100644 --- a/examples/daSalome/test002_ADAO_JDC_using_strings.comm +++ b/examples/daSalome/test002_ADAO_JDC_using_strings.comm @@ -28,4 +28,3 @@ ASSIMILATION_STUDY(Study_name='Test', """import numpy xa=numpy.ravel(ADD.get('Analysis')[-1]) print 'Analysis:',xa""",),); -#CHECKSUM:17bc9d8f671d897f163b094a1e21d53f -:FIN CHECKSUM \ No newline at end of file diff --git a/examples/daSalome/test002_ADAO_JDC_using_strings.py b/examples/daSalome/test002_ADAO_JDC_using_strings.py new file mode 100644 index 0000000..57d8adc --- /dev/null +++ b/examples/daSalome/test002_ADAO_JDC_using_strings.py @@ -0,0 +1,50 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'String' +Background_config['Data'] = '0 0 0' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'String' +BackgroundError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'String' +Observation_config['Data'] = '1 1 1' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'String' +ObservationError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'String' +ObservationOperator_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""" +study_config['UserPostAnalysis'] = Analysis_config diff --git a/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in b/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in index 16513f1..c41dcd7 100644 --- a/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in +++ b/examples/daSalome/test003_ADAO_JDC_using_scripts.comm.in @@ -16,10 +16,16 @@ ASSIMILATION_STUDY(Study_name='Test', data=_F(FROM='Script', SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),), ObservationError=_F(Stored=0, - INPUT_TYPE='Matrix', + INPUT_TYPE='Matrix', data=_F(FROM='Script', SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),), ObservationOperator=_F(Stored=0, INPUT_TYPE='Matrix', data=_F(FROM='Script', - SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),),); + SCRIPT_FILE='test003_ADAO_scripts_for_JDC.py',),), + UserPostAnalysis=_F(FROM='Template', + Template='AnalysisPrinter', + ValueTemplate= + """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""",),); diff --git a/examples/daSalome/test003_ADAO_JDC_using_scripts.py.in b/examples/daSalome/test003_ADAO_JDC_using_scripts.py.in new file mode 100644 index 0000000..3e75605 --- /dev/null +++ b/examples/daSalome/test003_ADAO_JDC_using_scripts.py.in @@ -0,0 +1,51 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'Script' +Background_config['Data'] = 'test003_ADAO_scripts_for_JDC.py' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'Script' +BackgroundError_config['Data'] = 'test003_ADAO_scripts_for_JDC.py' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'Script' +Observation_config['Data'] = 'test003_ADAO_scripts_for_JDC.py' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'Script' +ObservationError_config['Data'] = 'test003_ADAO_scripts_for_JDC.py' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'Script' +ObservationOperator_config['Data'] = 'test003_ADAO_scripts_for_JDC.py' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSalome' +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""" +study_config['UserPostAnalysis'] = Analysis_config diff --git a/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm.in b/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm.in index 152277e..bc03a7b 100644 --- a/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm.in +++ b/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.comm.in @@ -20,10 +20,16 @@ ASSIMILATION_STUDY(Study_name='Test', data=_F(FROM='Script', SCRIPT_FILE='test003_bis_ADAO_scripts_for_JDC.py',),), ObservationOperator=_F(Stored=0, - INPUT_TYPE='Matrix', + INPUT_TYPE='Matrix', data=_F(FROM='Script', SCRIPT_FILE='test003_bis_ADAO_scripts_for_JDC.py',),), UserDataInit=_F(INIT_FILE='test003_bis_ADAO_user_data_init.py', TARGET_LIST= ('Background','BackgroundError','Observation', - 'ObservationError','ObservationOperator',),),); + 'ObservationError','ObservationOperator',),), + UserPostAnalysis=_F(FROM='Template', + Template='AnalysisPrinter', + ValueTemplate= + """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""",),); diff --git a/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.py.in b/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.py.in new file mode 100644 index 0000000..cf4afcd --- /dev/null +++ b/examples/daSalome/test003_bis_ADAO_JDC_using_user_data_init.py.in @@ -0,0 +1,57 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'Script' +Background_config['Data'] = 'test003_bis_ADAO_scripts_for_JDC.py' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'Script' +BackgroundError_config['Data'] = 'test003_bis_ADAO_scripts_for_JDC.py' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'Script' +Observation_config['Data'] = 'test003_bis_ADAO_scripts_for_JDC.py' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'Script' +ObservationError_config['Data'] = 'test003_bis_ADAO_scripts_for_JDC.py' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'Script' +ObservationOperator_config['Data'] = 'test003_bis_ADAO_scripts_for_JDC.py' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSalome' +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +xa=numpy.ravel(ADD.get('Analysis')[-1]) +print 'Analysis:',xa""" +study_config['UserPostAnalysis'] = Analysis_config +Init_config = {} +Init_config['Type'] = 'Dict' +Init_config['From'] = 'Script' +Init_config['Data'] = 'test003_bis_ADAO_user_data_init.py' +Init_config['Target'] = ['Background','BackgroundError','Observation','ObservationError','ObservationOperator',] +study_config['UserDataInit'] = Init_config diff --git a/examples/daSalome/test004_ADAO_JDC_using_scripts.py.in b/examples/daSalome/test004_ADAO_JDC_using_scripts.py.in new file mode 100644 index 0000000..bd6f8a0 --- /dev/null +++ b/examples/daSalome/test004_ADAO_JDC_using_scripts.py.in @@ -0,0 +1,55 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = 'Blue' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'Script' +Background_config['Data'] = 'test004_ADAO_scripts_for_JDC.py' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'Script' +BackgroundError_config['Data'] = 'test004_ADAO_scripts_for_JDC.py' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'Script' +Observation_config['Data'] = 'test004_ADAO_scripts_for_JDC.py' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'Script' +ObservationError_config['Data'] = 'test004_ADAO_scripts_for_JDC.py' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'Script' +ObservationOperator_config['Data'] = 'test004_ADAO_scripts_for_JDC.py' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSalome' +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +Xa = ADD.get("Analysis")[-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 +""" +study_config['UserPostAnalysis'] = Analysis_config diff --git a/examples/daSalome/test005_ADAO_Operators.py.in b/examples/daSalome/test005_ADAO_Operators.py.in new file mode 100644 index 0000000..3005493 --- /dev/null +++ b/examples/daSalome/test005_ADAO_Operators.py.in @@ -0,0 +1,62 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'String' +Background_config['Data'] = '0 0 0' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'String' +BackgroundError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'String' +Observation_config['Data'] = '1 1 1' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'String' +ObservationError_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_FunctionDict = {} +ObservationOperator_FunctionDict['Function'] = ['Direct', 'Tangent', 'Adjoint'] +ObservationOperator_FunctionDict['Script'] = {} +ObservationOperator_FunctionDict['Script']['Direct'] = 'test005_ADAO_scripts_for_JDC.py' +ObservationOperator_FunctionDict['Script']['Tangent'] = 'test005_ADAO_scripts_for_JDC.py' +ObservationOperator_FunctionDict['Script']['Adjoint'] = 'test005_ADAO_scripts_for_JDC.py' +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Function' +ObservationOperator_config['From'] = 'FunctionDict' +ObservationOperator_config['Data'] = ObservationOperator_FunctionDict +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSalome' +Analysis_config = {} +Analysis_config['From'] = 'String' +Analysis_config['Data'] = """import numpy +Xb = Study.getBackground() +Xa = ADD.get("Analysis")[-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 +""" +study_config['UserPostAnalysis'] = Analysis_config diff --git a/examples/daSalome/test006_Observers.comm.in b/examples/daSalome/test006_Observers.comm.in index 26d95db..97bcd4e 100644 --- a/examples/daSalome/test006_Observers.comm.in +++ b/examples/daSalome/test006_Observers.comm.in @@ -16,7 +16,7 @@ ASSIMILATION_STUDY(Study_name='test_observers', data=_F(FROM='Script', SCRIPT_FILE='test006_Observers_var.py',),), ObservationError=_F(Stored=0, - INPUT_TYPE='Matrix', + INPUT_TYPE='Matrix', data=_F(FROM='Script', SCRIPT_FILE='test006_Observers_var.py',),), ObservationOperator=_F(Stored=0, @@ -31,7 +31,11 @@ ASSIMILATION_STUDY(Study_name='test_observers', ('Background','BackgroundError','Observation', 'ObservationError','AlgorithmParameters',),), Observers=_F(SELECTION=('CurrentState','CostFunctionJ',), - CostFunctionJ_data=_F(NodeType='String', + CurrentState_data=_F(Info='CurrentState', + NodeType='Script', + Value='test006_Observers_observer_with_file.py',), + CostFunctionJ_data=_F(Info='CostFunctionJ', + NodeType='String', Value= """print " ---> observerCost" print " var =",var[:] @@ -51,6 +55,4 @@ filename = os.path.join("/tmp", "imageCost_%02i.ps"%numero) print " imageCost %s"%filename gp.hardcopy(filename=filename, color=1) numero += 1 -""",), - CurrentState_data=_F(NodeType='Script', - Value='test006_Observers_observer_with_file.py',),),); +""",),),); diff --git a/examples/daSalome/test006_Observers.py.in b/examples/daSalome/test006_Observers.py.in new file mode 100644 index 0000000..da76ded --- /dev/null +++ b/examples/daSalome/test006_Observers.py.in @@ -0,0 +1,91 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'ASSIMILATION_STUDY' +study_config['Name'] = 'test_observers' +study_config['Debug'] = '0' +study_config['Algorithm'] = '3DVAR' +Background_config = {} +Background_config['Type'] = 'Vector' +Background_config['From'] = 'Script' +Background_config['Data'] = 'test006_Observers_var.py' +Background_config['Stored'] = '0' +study_config['Background'] = Background_config +BackgroundError_config = {} +BackgroundError_config['Type'] = 'Matrix' +BackgroundError_config['From'] = 'Script' +BackgroundError_config['Data'] = 'test006_Observers_var.py' +BackgroundError_config['Stored'] = '0' +study_config['BackgroundError'] = BackgroundError_config +Observation_config = {} +Observation_config['Type'] = 'Vector' +Observation_config['From'] = 'Script' +Observation_config['Data'] = 'test006_Observers_var.py' +Observation_config['Stored'] = '0' +study_config['Observation'] = Observation_config +ObservationError_config = {} +ObservationError_config['Type'] = 'Matrix' +ObservationError_config['From'] = 'Script' +ObservationError_config['Data'] = 'test006_Observers_var.py' +ObservationError_config['Stored'] = '0' +study_config['ObservationError'] = ObservationError_config +ObservationOperator_FunctionDict = {} +ObservationOperator_FunctionDict['Function'] = ['Direct', 'Tangent', 'Adjoint'] +ObservationOperator_FunctionDict['Script'] = {} +ObservationOperator_FunctionDict['Script']['Direct'] = 'test006_Observers_Observation_Operator.py' +ObservationOperator_FunctionDict['Script']['Tangent'] = 'test006_Observers_Observation_Operator.py' +ObservationOperator_FunctionDict['Script']['Adjoint'] = 'test006_Observers_Observation_Operator.py' +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Function' +ObservationOperator_config['From'] = 'FunctionDict' +ObservationOperator_config['Data'] = ObservationOperator_FunctionDict +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +study_config['Repertory'] = '@prefix@/share/salome/adao_examples/daSalome' +AlgorithmParameters_config = {} +AlgorithmParameters_config['Type'] = 'Dict' +AlgorithmParameters_config['From'] = 'Script' +AlgorithmParameters_config['Data'] = 'test006_Observers_var.py' +study_config['AlgorithmParameters'] = AlgorithmParameters_config +Init_config = {} +Init_config['Type'] = 'Dict' +Init_config['From'] = 'Script' +Init_config['Data'] = 'test006_Observers_init.py' +Init_config['Target'] = ['Background','BackgroundError','Observation','ObservationError','AlgorithmParameters',] +study_config['UserDataInit'] = Init_config +observers = {} +observers["CostFunctionJ"] = {} +observers["CostFunctionJ"]["number"] = 3 +observers["CostFunctionJ"]["nodetype"] = "String" +observers["CostFunctionJ"]["String"] = """print " ---> observerCost" +print " var =",var[:] +print " info =",info +# +import Gnuplot +import os +try: + numero +except NameError: + numero = 0 +gp = Gnuplot.Gnuplot() +gp('set style data lines') +gp('set title "'+str(info)+'"') +gp.plot( Gnuplot.Data( var[:] ) ) +filename = os.path.join("/tmp", "imageCost_%02i.ps"%numero) +print " imageCost %s"%filename +gp.hardcopy(filename=filename, color=1) +numero += 1 +""" +observers["CostFunctionJ"]["info"] = """CostFunctionJ""" +observers["CurrentState"] = {} +observers["CurrentState"]["number"] = 4 +observers["CurrentState"]["nodetype"] = "Script" +observers["CurrentState"]["Script"] = "test006_Observers_observer_with_file.py" +observers["CurrentState"]["info"] = """CurrentState""" +study_config['Observers'] = observers diff --git a/examples/daSalome/test008_ADAO_Elementary_GradientTest.comm b/examples/daSalome/test008_ADAO_Elementary_GradientTest.comm index b70cc22..73973a0 100644 --- a/examples/daSalome/test008_ADAO_Elementary_GradientTest.comm +++ b/examples/daSalome/test008_ADAO_Elementary_GradientTest.comm @@ -1,6 +1,5 @@ CHECKING_STUDY(Study_name='Elementary gradient test', - Study_repertory='/home/ahbhhjp/ADAO', Debug=0, Algorithm='GradientTest', CheckingPoint=_F(Stored=0, @@ -14,4 +13,3 @@ CHECKING_STUDY(Study_name='Elementary gradient test', AlgorithmParameters=_F(INPUT_TYPE='Dict', data=_F(FROM='String', STRING='{ "SetSeed" : 1000 }',),),); -#CHECKSUM:195fb2032d0dcb0cb5668d4084352fb0 -:FIN CHECKSUM \ No newline at end of file diff --git a/examples/daSalome/test008_ADAO_Elementary_GradientTest.py b/examples/daSalome/test008_ADAO_Elementary_GradientTest.py new file mode 100644 index 0000000..4d15507 --- /dev/null +++ b/examples/daSalome/test008_ADAO_Elementary_GradientTest.py @@ -0,0 +1,31 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'CHECKING_STUDY' +study_config['Name'] = 'Elementary gradient test' +study_config['Debug'] = '0' +study_config['Algorithm'] = 'GradientTest' +CheckingPoint_config = {} +CheckingPoint_config['Type'] = 'Vector' +CheckingPoint_config['From'] = 'String' +CheckingPoint_config['Data'] = '1 1 1' +CheckingPoint_config['Stored'] = '0' +study_config['CheckingPoint'] = CheckingPoint_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'String' +ObservationOperator_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +AlgorithmParameters_config = {} +AlgorithmParameters_config['Type'] = 'Dict' +AlgorithmParameters_config['From'] = 'String' +AlgorithmParameters_config['Data'] = '{ "SetSeed" : 1000 }' +study_config['AlgorithmParameters'] = AlgorithmParameters_config diff --git a/examples/daSalome/test009_ADAO_Simple_GradientTest.comm b/examples/daSalome/test009_ADAO_Simple_GradientTest.comm index 3cc522e..56da492 100644 --- a/examples/daSalome/test009_ADAO_Simple_GradientTest.comm +++ b/examples/daSalome/test009_ADAO_Simple_GradientTest.comm @@ -13,4 +13,3 @@ CHECKING_STUDY(Study_name='Test', AlgorithmParameters=_F(INPUT_TYPE='Dict', data=_F(FROM='String', STRING='{ "SetSeed" : 1000 }',),),); -#CHECKSUM:b61b9cb1c617749ecfcf3fbfa3fadde1 -:FIN CHECKSUM \ No newline at end of file diff --git a/examples/daSalome/test009_ADAO_Simple_GradientTest.py b/examples/daSalome/test009_ADAO_Simple_GradientTest.py new file mode 100644 index 0000000..4349c4e --- /dev/null +++ b/examples/daSalome/test009_ADAO_Simple_GradientTest.py @@ -0,0 +1,31 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'CHECKING_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = 'GradientTest' +CheckingPoint_config = {} +CheckingPoint_config['Type'] = 'Vector' +CheckingPoint_config['From'] = 'String' +CheckingPoint_config['Data'] = '1 1 1' +CheckingPoint_config['Stored'] = '0' +study_config['CheckingPoint'] = CheckingPoint_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'String' +ObservationOperator_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1 ; 1 0 0 ; 0 1 0 ; 0 0 1' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +AlgorithmParameters_config = {} +AlgorithmParameters_config['Type'] = 'Dict' +AlgorithmParameters_config['From'] = 'String' +AlgorithmParameters_config['Data'] = '{ "SetSeed" : 1000 }' +study_config['AlgorithmParameters'] = AlgorithmParameters_config diff --git a/examples/daSalome/test010_ADAO_Simple_AdjointTest.comm b/examples/daSalome/test010_ADAO_Simple_AdjointTest.comm index 07f4668..af87379 100644 --- a/examples/daSalome/test010_ADAO_Simple_AdjointTest.comm +++ b/examples/daSalome/test010_ADAO_Simple_AdjointTest.comm @@ -13,4 +13,3 @@ CHECKING_STUDY(Study_name='Test', AlgorithmParameters=_F(INPUT_TYPE='Dict', data=_F(FROM='String', STRING='{ "SetSeed" : 1000 }',),),); -#CHECKSUM:66b339da11b97e97e44e775a4cdb1824 -:FIN CHECKSUM \ No newline at end of file diff --git a/examples/daSalome/test010_ADAO_Simple_AdjointTest.py b/examples/daSalome/test010_ADAO_Simple_AdjointTest.py new file mode 100644 index 0000000..1d60dc8 --- /dev/null +++ b/examples/daSalome/test010_ADAO_Simple_AdjointTest.py @@ -0,0 +1,31 @@ +#-*-coding:iso-8859-1-*- +study_config = {} +study_config['StudyType'] = 'CHECKING_STUDY' +study_config['Name'] = 'Test' +study_config['Debug'] = '0' +study_config['Algorithm'] = 'AdjointTest' +CheckingPoint_config = {} +CheckingPoint_config['Type'] = 'Vector' +CheckingPoint_config['From'] = 'String' +CheckingPoint_config['Data'] = '1 1 1' +CheckingPoint_config['Stored'] = '0' +study_config['CheckingPoint'] = CheckingPoint_config +ObservationOperator_config = {} +ObservationOperator_config['Type'] = 'Matrix' +ObservationOperator_config['From'] = 'String' +ObservationOperator_config['Data'] = '1 0 0 ; 0 1 0 ; 0 0 1 ; 1 0 0 ; 0 1 0 ; 0 0 1' +ObservationOperator_config['Stored'] = '0' +study_config['ObservationOperator'] = ObservationOperator_config +inputvariables_config = {} +inputvariables_config['Order'] =['adao_default'] +inputvariables_config['adao_default'] = -1 +study_config['InputVariables'] = inputvariables_config +outputvariables_config = {} +outputvariables_config['Order'] = ['adao_default'] +outputvariables_config['adao_default'] = -1 +study_config['OutputVariables'] = outputvariables_config +AlgorithmParameters_config = {} +AlgorithmParameters_config['Type'] = 'Dict' +AlgorithmParameters_config['From'] = 'String' +AlgorithmParameters_config['Data'] = '{ "SetSeed" : 1000 }' +study_config['AlgorithmParameters'] = AlgorithmParameters_config