from daYacsIntegration.daStudy import *
assim_study = daStudy(Name, Algorithm)
+# Algorithm parameters
+try:
+ AlgorithmParameters
+except NameError:
+ pass
+else:
+ assim_study.setAlgorithmParameters(AlgorithmParameters)
+
# Data
print "Data entered are:"
# Background
<outport name="result" type="pyobj"/>
</inline>
+ <inline name="CreateDictFromScript">
+ <script><code><![CDATA[
+print "Entering in CreateDictFromScript"
+execfile(script)
+]]></code></script>
+ <inport name="script" type="string"/>
+ </inline>
+
</proc>
self.ADD = AssimilationStudy(name)
self.ADD.setControls()
self.algorithm = algorithm
+ self.algorithm_dict = None
self.Background = None
# Observation Management
self.ObservationOperatorType = {}
self.FunctionObservationOperator = {}
+ def setAlgorithmParameters(self, parameters):
+ self.algorithm_dict = parameters
+
def initAlgorithm(self):
+
self.ADD.setAlgorithm(choice=self.algorithm)
+ if self.algorithm_dict != None:
+ self.ADD.setAlgorithmParameters(asDico=self.algorithm_dict)
def getAssimilationStudy(self):
# -- Infos from daCore --
AssimData = ["Background", "BackgroundError",
"Observation", "ObservationError", "ObservationOperator", "ObservationOperatorAppliedToX",
- "EvolutionModel", "EvolutionError"]
+ "EvolutionModel", "EvolutionError", "AlgorithmParameters"]
AssimType = {}
AssimType["Background"] = ["Vector"]
AssimType["ObservationError"] = ["Matrix"]
AssimType["ObservationOperator"] = ["Matrix", "Function"]
AssimType["ObservationOperatorAppliedToX"] = ["List"]
+AssimType["AlgorithmParameters"] = ["Dict"]
FromNumpyList = {}
FromNumpyList["Vector"] = ["String", "Script"]
key_type = key + "Type"
+ if data_config["Type"] == "Dict" and data_config["From"] == "Script":
+ # Create node
+ factory_back_node = catalogAd._nodeMap["CreateDictFromScript"]
+ back_node = factory_back_node.cloneNode("Get" + key)
+ back_node.getInputPort("script").edInitPy(data_config["Data"])
+ back_node.edAddOutputPort(key, t_pyobj)
+ proc.edAddChild(back_node)
+ # Connect node with CreateAssimilationStudy
+ CAS_node.edAddInputPort(key, t_pyobj)
+ proc.edAddDFLink(back_node.getOutputPort(key), CAS_node.getInputPort(key))
+
if data_config["Type"] == "Vector" and data_config["From"] == "String":
# Create node
factory_back_node = catalogAd._nodeMap["CreateNumpyVectorFromString"]
Algorithm_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_init_algorithm.py"
Algorithm_config["Type"] = "Dict"
Algorithm_config["From"] = "Script"
-study_config["Algorithm"] = Algorithm_config
+study_config["AlgorithmParameters"] = Algorithm_config
Background_config = {}
Background_config["Data"] = "@prefix@/tests/daSalome/test_aster_zzzz159a_background.py"
print "Bornes = ",Bornes
print
-Algorithm = { "Minimizer" : "TNC",
- "Bounds" : Bornes,
- }
+AlgorithmParameters = { "Minimizer" : "TNC",
+ "Bounds" : Bornes,
+ }