logging.fatal("Analysis found but From is not defined in the analysis configuration !")
sys.exit(1)
else:
- if analysis_config["From"] != "string":
+ if analysis_config["From"] not in AnalysisFromList:
logging.fatal("Analysis From defined in the study configuration does not have a correct type : " + str(analysis_config["From"])
- + "\n You can have : string")
+ + "\n You can have : " + str(AnalysisFromList))
sys.exit(1)
if "Data" not in analysis_config:
logging.fatal("Analysis found but Data is not defined in the analysis configuration !")
# --
+# -- Infos pour le parser --
+
+AnalysisData = {}
+AnalysisFromList = ["string", "file"]
+
# -- Infos from daCore --
AssimData = ["Background", "BackgroundError",
"Observation", "ObservationError", "ObservationOperator", "ObservationOperatorAppliedToX",
proc.edAddCFLink(compute_bloc, analysis_node)
proc.edAddDFLink(execute_node.getOutputPort("Study"), analysis_node.getInputPort("Study"))
+ elif analysis_config["From"] == "file":
+ factory_analysis_node = catalogAd._nodeMap["SimpleUserAnalysis"]
+ analysis_node = factory_analysis_node.cloneNode("User Analysis")
+ default_script = analysis_node.getScript()
+ if not os.path.exists(analysis_config["Data"]):
+ logging.fatal("Analysis source file does not exists ! :" + str(analysis_config["Data"]))
+ sys.exit(1)
+ try:
+ analysis_file = open(analysis_config["Data"], 'r')
+ except:
+ logging.fatal("Exception in openng analysis file : " + str(analysis_config["Data"]))
+ traceback.print_exc()
+ sys.exit(1)
+ file_text = analysis_file.read()
+ final_script = default_script + file_text
+ analysis_node.setScript(final_script)
+ proc.edAddChild(analysis_node)
+ proc.edAddCFLink(compute_bloc, analysis_node)
+ proc.edAddDFLink(execute_node.getOutputPort("Study"), analysis_node.getInputPort("Study"))
+
+ pass
+
return proc
def write_yacs_proc(proc, yacs_schema_filename):
--- /dev/null
+#-*-coding:iso-8859-1-*-
+import numpy
+precision = 1.e-13
+
+Xa = ADD.get("Analysis")
+print
+print " Nombre d'analyses :",Xa.stepnumber()
+print " Analyse résultante :",Xa.valueserie(0)
+#
+# Vérification du résultat
+# ------------------------
+if max(numpy.array(Xa.valueserie(0))-numpy.array([0.25, 1.25, 2.25])) > precision:
+ raise ValueError("Résultat du test erroné")
+else:
+ print " Test correct, erreur maximale inférieure à %s"%precision
+ print
+
--- /dev/null
+#-*-coding:iso-8859-1-*-
+study_config = {}
+study_config["Name"] = "test000_Blue"
+study_config["Algorithm"] = "Blue"
+
+Background_config = {}
+Background_config["Data"] = "0,1,2"
+Background_config["Type"] = "Vector"
+Background_config["From"] = "string"
+study_config["Background"] = Background_config
+
+BackgroundError_config = {}
+BackgroundError_config["Data"] = "1 0 0;0 1 0;0 0 1"
+BackgroundError_config["Type"] = "Matrix"
+BackgroundError_config["From"] = "string"
+study_config["BackgroundError"] = BackgroundError_config
+
+Observation_config = {}
+Observation_config["Data"] = "0.5,1.5,2.5"
+Observation_config["Type"] = "Vector"
+Observation_config["From"] = "string"
+study_config["Observation"] = Observation_config
+
+ObservationError_config = {}
+ObservationError_config["Data"] = "1 0 0;0 1 0;0 0 1"
+ObservationError_config["Type"] = "Matrix"
+ObservationError_config["From"] = "string"
+study_config["ObservationError"] = ObservationError_config
+
+ObservationOperator_config = {}
+ObservationOperator_config["Data"] = "1 0 0;0 1 0;0 0 1"
+ObservationOperator_config["Type"] = "Matrix"
+ObservationOperator_config["From"] = "string"
+study_config["ObservationOperator"] = ObservationOperator_config
+
+Analysis_config = {}
+Analysis_config["Data"] = "/home/aribes/Projets/DATASSIM_SRC/src/tests/daSalome/test000_Blue_AnalysisCode.py"
+Analysis_config["From"] = "file"
+study_config["Analysis"] = Analysis_config
+