${var_name}_data = FACT(statut = "o",
Scheduler = SIMP(statut = "f", typ = "TXM"),
Info = SIMP(statut = "f", typ = "TXM"),
- NodeType = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "", into=("pyscript", "userfile")),
- PythonScript = BLOC (condition = " NodeType == 'pyscript' ",
+ NodeType = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "", into=("String", "Script")),
+ PythonScript = BLOC (condition = " NodeType == 'String' ",
Value = SIMP(statut = "o", typ = "TXM")
),
- UserFile = BLOC (condition = " NodeType == 'userfile' ",
+ UserFile = BLOC (condition = " NodeType == 'Script' ",
Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=(OnlyStr()))
)
),
observers_method = """
def F_Observers(statut) : return FACT(statut=statut,
- SELECTION = SIMP(statut="o", defaut=[], typ="TXM", max="**", validators=NoRepeat(), into=(${choices})),
+ SELECTION = SIMP(statut="o", defaut=[], typ="TXM", min=0, max="**", validators=NoRepeat(), into=(${choices})),
${decl_choices}
)
"""
('Background','BackgroundError','Observation',
'ObservationError','AlgorithmParameters',),),
Observers=_F(SELECTION=('CurrentState','CostFunctionJ',),
- CostFunctionJ_data=_F(NodeType='pyscript',
+ CostFunctionJ_data=_F(NodeType='String',
Value=
"""print " ---> observerCost"
print " var =",var.valueserie()
gp.hardcopy(filename=filename, color=1)
numero += 1
""",),
- CurrentState_data=_F(NodeType='userfile',
+ CurrentState_data=_F(NodeType='Script',
Value='test006_Observers_observer_with_file.py',),),);
self.text_da += "observers[\"" + observer + "\"] = {}\n"
self.text_da += "observers[\"" + observer + "\"][\"number\"] = " + str(number) + "\n"
self.text_da += "observers[\"" + observer + "\"][\"nodetype\"] = \"" + observers[observer]["nodetype"] + "\"\n"
- if observers[observer]["nodetype"] == "pyscript":
- self.text_da += "observers[\"" + observer + "\"][\"pyscript\"] = \"\"\"" + observers[observer]["script"] + "\"\"\"\n"
+ if observers[observer]["nodetype"] == "String":
+ self.text_da += "observers[\"" + observer + "\"][\"String\"] = \"\"\"" + observers[observer]["script"] + "\"\"\"\n"
else:
- self.text_da += "observers[\"" + observer + "\"][\"userfile\"] = \"" + observers[observer]["file"] + "\"\n"
+ self.text_da += "observers[\"" + observer + "\"][\"Script\"] = \"" + observers[observer]["file"] + "\"\n"
if "scheduler" in observers[observer].keys():
self.text_da += "observers[\"" + observer + "\"][\"scheduler\"] = \"\"\"" + observers[observer]["scheduler"] + "\"\"\"\n"
self.text_da += "study_config['Observers'] = observers\n"
observers[observer]["nodetype"] = self.dictMCVal[node_type_key_name]
# NodeType script/file
- if observers[observer]["nodetype"] == "pyscript":
+ if observers[observer]["nodetype"] == "String":
observers[observer]["script"] = self.dictMCVal[observer_eficas_name + "PythonScript__Value"]
else:
observers[observer]["file"] = self.dictMCVal[observer_eficas_name + "UserFile__Value"]
itemValue = adaoCase.filename
else:
itemName = salomeStudyItem.GetName()
- itemValue = adaoCase.get_filename()
+ itemValue = adaoCase.filename
icon = adaoModuleHelper.studyItemPixmapNOk()
if adaoCase.isOk():
logging.fatal("An observer nodetype description must be a string")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
- if nodetype != "pyscript" and nodetype != "userfile":
- logging.fatal("An observer nodetype must be equal to 'pyscript' or 'userfile'")
+ if nodetype != "String" and nodetype != "Script":
+ logging.fatal("An observer nodetype must be equal to 'String' or 'Script'")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
- if nodetype == "pyscript":
- if "pyscript" not in study_config["Observers"][obs_var].keys():
- logging.fatal("An observer with nodetype pyscript must provide a pyscript")
+ if nodetype == "String":
+ if "String" not in study_config["Observers"][obs_var].keys():
+ logging.fatal("An observer with nodetype String must provide a String")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
- if not isinstance(study_config["Observers"][obs_var]["pyscript"], type("")):
- logging.fatal("An observer pyscript description must be a string")
+ if not isinstance(study_config["Observers"][obs_var]["String"], type("")):
+ logging.fatal("An observer String description must be a string")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
- if nodetype == "userfile":
- if "userfile" not in study_config["Observers"][obs_var].keys():
- logging.fatal("An observer with nodetype userfileuserfilemust provide a pyscript")
+ if nodetype == "Script":
+ if "Script" not in study_config["Observers"][obs_var].keys():
+ logging.fatal("An observer with nodetype Script provide a Script")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
- if not isinstance(study_config["Observers"][obs_var]["userfile"], type("")):
- logging.fatal("An observer userfile description must be a string")
+ if not isinstance(study_config["Observers"][obs_var]["Script"], type("")):
+ logging.fatal("An observer Script description must be a string")
logging.fatal("Observer is %s" % obs_var)
sys.exit(1)
if "scheduler" in study_config["Observers"][obs_var].keys():
proc.edAddDFLink(read_for_switch_node.getOutputPort("data"), extract_data_node.getInputPort("data"))
observation_node = None
- if observer_cfg["nodetype"] == "pyscript":
+ if observer_cfg["nodetype"] == "String":
factory_observation_node = catalogAd.getNodeFromNodeMap("ObservationNodeString")
observation_node = factory_observation_node.cloneNode("Observation")
node_script = observation_node.getScript()
- node_script += observer_cfg["pyscript"]
+ node_script += observer_cfg["String"]
observation_node.setScript(node_script)
else:
factory_observation_node = catalogAd.getNodeFromNodeMap("ObservationNodeFile")
observation_node = factory_observation_node.cloneNode("Observation")
if repertory:
- observation_node.getInputPort("script").edInitPy(os.path.join(base_repertory, os.path.basename(observer_cfg["userfile"])))
+ observation_node.getInputPort("script").edInitPy(os.path.join(base_repertory, os.path.basename(observer_cfg["Script"])))
else:
- observation_node.getInputPort("script").edInitPy(observer_cfg["userfile"])
+ observation_node.getInputPort("script").edInitPy(observer_cfg["Script"])
observer_bloc.edAddChild(observation_node)
proc.edAddDFLink(extract_data_node.getOutputPort("var"), observation_node.getInputPort("var"))
proc.edAddDFLink(extract_data_node.getOutputPort("info"), observation_node.getInputPort("info"))