# This file is part of SALOME ADAO module
#
# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
+# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
# Author: André Ribes, andre.ribes@edf.fr, EDF R&D
import sys
# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
name = "ADAO"
-version = "V7_5_1" # Version pour catalogue, avec des "_" entre les numeros
+version = "V7_6_0" # Version pour catalogue, avec des "_" entre les numeros
date = ""
year = "2015" # Annee de copyright
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="210mm"
- height="297mm"
- id="svg2"
- version="1.1"
- inkscape:version="0.47 r22583"
- sodipodi:docname="ADAOlogo.svg">
- <defs
- id="defs4">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective10" />
- <inkscape:perspective
- id="perspective2825"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 0.5 : 1"
- sodipodi:type="inkscape:persp3d" />
- <inkscape:perspective
- id="perspective2829"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 0.5 : 1"
- sodipodi:type="inkscape:persp3d" />
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="1.6158153"
- inkscape:cx="202.61978"
- inkscape:cy="837.66928"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1254"
- inkscape:window-height="1029"
- inkscape:window-x="1"
- inkscape:window-y="25"
- inkscape:window-maximized="0" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Calque 1"
- inkscape:groupmode="layer"
- id="layer1">
- <text
- xml:space="preserve"
- style="font-size:72px;font-style:italic;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ecliptic BRK;-inkscape-font-specification:Ecliptic BRK Italic"
- x="287.29449"
- y="75.354118"
- id="text2816"
- sodipodi:linespacing="125%"
- inkscape:export-filename="/home/ahbhhjp/PERSONNEL/COURS/JPA/Sources/Assimilation/Documents/ADAO/doc/ressources/path3620.png"
- inkscape:export-xdpi="12.990827"
- inkscape:export-ydpi="12.990827"><tspan
- sodipodi:role="line"
- id="tspan3618"
- x="287.29449"
- y="75.354118">DA</tspan></text>
- <path
- sodipodi:type="spiral"
- style="fill:#ff9955;fill-opacity:1;stroke:#000000;stroke-width:1.00032222;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path2849"
- sodipodi:cx="100.91638"
- sodipodi:cy="321.9491"
- sodipodi:expansion="1"
- sodipodi:revolution="6.0214381"
- sodipodi:radius="37.473236"
- sodipodi:argument="-20.442327"
- sodipodi:t0="0"
- d="m 100.91638,321.9491 c -0.0206,-0.93586 1.25137,-0.48945 1.55545,-0.0342 0.82406,1.23372 -0.29038,2.735 -1.48707,3.14509 -2.140611,0.73355 -4.253352,-0.96239 -4.734729,-3.00834 -0.70644,-3.00252 1.636961,-5.79857 4.529599,-6.32436 3.85544,-0.70081 7.35415,2.31158 7.914,6.05086 0.70452,4.70551 -2.98602,8.91487 -7.57213,9.50364 -5.554388,0.71308 -10.478513,-3.66031 -11.09327,-9.09339 -0.724469,-6.4027 4.334506,-12.04401 10.61466,-12.68291 7.25068,-0.73765 13.61071,5.00863 14.27254,12.13591 0.75202,8.09848 -5.68272,15.17829 -13.65718,15.86219 -8.946142,0.76723 -16.746483,-6.35677 -17.45182,-15.17845 -0.783058,-9.79373 7.030805,-18.31515 16.69971,-19.04146 10.64126,-0.79935 19.88417,7.70483 20.63109,18.22098 0.816,11.48874 -8.37882,21.45348 -19.74223,22.22073 -12.336196,0.83293 -23.023024,-9.05282 -23.810371,-21.2635 -0.850083,-13.18362 9.726814,-24.59274 22.784761,-25.40001 14.03104,-0.86742 26.16262,10.4008 26.98965,24.30603 0.8849,14.87843 -11.07478,27.73262 -25.82729,28.57928 -15.725817,0.90252 -29.302728,-11.74876 -30.168922,-27.34855 -0.920242,-16.57319 12.422731,-30.87292 28.869812,-31.75856 17.42055,-0.93805 32.4432,13.09671 33.3482,30.39108 0.95594,18.26791 -13.77068,34.01354 -31.91235,34.93783 -19.115258,0.97389 -35.583936,-14.44464 -36.527463,-33.4336 -0.991904,-19.96261 15.11861,-37.1544 34.954873,-38.11711 1.67818,-0.0814 3.36179,-0.0494 5.03569,0.0954"
- transform="matrix(1.1558135,0,0,1.2320798,-44.152477,-284.63311)"
- inkscape:export-filename="/home/ahbhhjp/text2820.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <text
- xml:space="preserve"
- style="font-size:83.2216568px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0000ff;fill-opacity:1;stroke:none;font-family:'3D LET BRK';-inkscape-font-specification:'3D LET BRK'"
- x="36.218281"
- y="77.264725"
- id="text2820"
- sodipodi:linespacing="125%"
- transform="scale(0.76903058,1.3003384)"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"><tspan
- sodipodi:role="line"
- id="tspan2822"
- x="36.218281"
- y="77.264725">DA</tspan></text>
- <path
- sodipodi:type="spiral"
- style="fill:#ff9955;fill-opacity:1;stroke:#000000;stroke-width:1.00032222;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path2849-6"
- sodipodi:cx="100.91638"
- sodipodi:cy="321.9491"
- sodipodi:expansion="1"
- sodipodi:revolution="6.0214381"
- sodipodi:radius="37.473236"
- sodipodi:argument="-20.442327"
- sodipodi:t0="0"
- d="m 100.91638,321.9491 c -0.0206,-0.93586 1.25137,-0.48945 1.55545,-0.0342 0.82406,1.23372 -0.29038,2.735 -1.48707,3.14509 -2.140611,0.73355 -4.253352,-0.96239 -4.734729,-3.00834 -0.70644,-3.00252 1.636961,-5.79857 4.529599,-6.32436 3.85544,-0.70081 7.35415,2.31158 7.914,6.05086 0.70452,4.70551 -2.98602,8.91487 -7.57213,9.50364 -5.554388,0.71308 -10.478513,-3.66031 -11.09327,-9.09339 -0.724469,-6.4027 4.334506,-12.04401 10.61466,-12.68291 7.25068,-0.73765 13.61071,5.00863 14.27254,12.13591 0.75202,8.09848 -5.68272,15.17829 -13.65718,15.86219 -8.946142,0.76723 -16.746483,-6.35677 -17.45182,-15.17845 -0.783058,-9.79373 7.030805,-18.31515 16.69971,-19.04146 10.64126,-0.79935 19.88417,7.70483 20.63109,18.22098 0.816,11.48874 -8.37882,21.45348 -19.74223,22.22073 -12.336196,0.83293 -23.023024,-9.05282 -23.810371,-21.2635 -0.850083,-13.18362 9.726814,-24.59274 22.784761,-25.40001 14.03104,-0.86742 26.16262,10.4008 26.98965,24.30603 0.8849,14.87843 -11.07478,27.73262 -25.82729,28.57928 -15.725817,0.90252 -29.302728,-11.74876 -30.168922,-27.34855 -0.920242,-16.57319 12.422731,-30.87292 28.869812,-31.75856 17.42055,-0.93805 32.4432,13.09671 33.3482,30.39108 0.95594,18.26791 -13.77068,34.01354 -31.91235,34.93783 -19.115258,0.97389 -35.583936,-14.44464 -36.527463,-33.4336 -0.991904,-19.96261 15.11861,-37.1544 34.954873,-38.11711 1.67818,-0.0814 3.36179,-0.0494 5.03569,0.0954"
- transform="matrix(1.1558135,0,0,1.2320798,58.717362,-286.46093)"
- inkscape:export-filename="/home/ahbhhjp/PERSONNEL/COURS/JPA/Sources/Assimilation/Documents/ADAO/doc/ressources/text2820-9.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90" />
- <text
- xml:space="preserve"
- style="font-size:72px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Arial Black;-inkscape-font-specification:'Arial Black,'"
- x="169.98389"
- y="71.244904"
- id="text2820-7"
- sodipodi:linespacing="125%"
- transform="scale(0.76903058,1.3003384)"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90"
- inkscape:export-filename="/home/ahbhhjp/PERSONNEL/COURS/JPA/Sources/Assimilation/Documents/ADAO/doc/ressources/text2820-9.png"><tspan
- sodipodi:role="line"
- id="tspan2822-3"
- x="169.98389"
- y="71.244904">DA</tspan></text>
- <text
- xml:space="preserve"
- style="font-size:48px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Ecliptic BRK;-inkscape-font-specification:Ecliptic BRK"
- x="29.026806"
- y="228.65573"
- id="text2816-6"
- sodipodi:linespacing="125%"><tspan
- sodipodi:role="line"
- id="tspan2818-3"
- x="29.026806"
- y="228.65573">D A</tspan></text>
- <path
- style="fill:#ffe200;fill-opacity:1;stroke:#000000;stroke-width:2.66750574;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 289.28798,155.39574 18.54471,-58.365903 17.58255,54.165013 17.09456,-66.636614 19.61805,48.653494 21.10261,-8.67601 9.33238,-43.280447"
- id="path3620"
- sodipodi:nodetypes="ccccccc"
- inkscape:export-xdpi="12.990827"
- inkscape:export-ydpi="12.990827" />
- </g>
-</svg>
+#
# Copyright (C) 2008-2015 EDF R&D
#
# This file is part of SALOME ADAO module
# -*- coding: utf-8 -*-
+#
# Copyright (C) 2008-2015 EDF R&D
#
# This file is part of SALOME ADAO module
# -*- coding: utf-8 -*-
+#
# Copyright (C) 2008-2015 EDF R&D
#
# This file is part of SALOME ADAO module
# -*- coding: utf-8 -*-
+#
# Copyright (C) 2008-2015 EDF R&D
#
# This file is part of SALOME ADAO module
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# Author: André Ribes, andre.ribes@edf.fr, EDF R&D
+# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
# print "import convert_adao"
from convert.convert_python import *
def entryPoint():
- """
- Retourne les informations nécessaires pour le chargeur de plugins
- Ces informations sont retournées dans un dictionnaire
- """
- return {
+ """
+ Retourne les informations nécessaires pour le chargeur de plugins
+ Ces informations sont retournées dans un dictionnaire
+ """
+ return {
# Le nom du plugin
- 'name' : 'adao',
+ 'name' : 'ADAO',
# La factory pour créer une instance du plugin
- 'factory' : PythonParser,
- }
+ 'factory' : PythonParser,
+ }
# -*- coding: utf-8 -*-
+#
# Copyright (C) 2010-2015 EDF R&D
#
# This file is part of SALOME ADAO module
# -*- coding: utf-8 -*-
+#
# Copyright (C) 2008-2015 EDF R&D
#
# This file is part of SALOME ADAO module
check_file_name = os.path.join(repertory, os.path.basename(data_config["Data"]))
if not os.path.exists(check_file_name):
raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name))
- elif from_type == "FunctionDict":
- FunctionDict = data_config["Data"]
- for FunctionName in FunctionDict["Function"]:
- check_file_name = FunctionDict["Script"][FunctionName]
+ elif (from_type == "FunctionDict" or from_type == "ScriptWithSwitch" or from_type == "ScriptWithFunctions" or from_type == "ScriptWithOneFunction"):
+ TheData = data_config["Data"]
+ for FunctionName in TheData["Function"]:
+ check_file_name = TheData["Script"][FunctionName]
if repertory_check and not os.path.exists(check_file_name):
- check_file_name = os.path.join(repertory, os.path.basename(FunctionDict["Script"][FunctionName]))
- if not os.path.exists(check_file_name):
- raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name))
- elif from_type == "ScriptWithSwitch":
- ScriptWithSwitch = data_config["Data"]
- for FunctionName in ScriptWithSwitch["Function"]:
- check_file_name = ScriptWithSwitch["Script"][FunctionName]
- if repertory_check and not os.path.exists(check_file_name):
- check_file_name = os.path.join(repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName]))
- if not os.path.exists(check_file_name):
- raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name))
- elif from_type == "ScriptWithFunctions":
- ScriptWithFunctions = data_config["Data"]
- for FunctionName in ScriptWithFunctions["Function"]:
- check_file_name = ScriptWithFunctions["Script"][FunctionName]
- if repertory_check and not os.path.exists(check_file_name):
- check_file_name = os.path.join(repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName]))
- if not os.path.exists(check_file_name):
- raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name))
- elif from_type == "ScriptWithOneFunction":
- ScriptWithOneFunction = data_config["Data"]
- for FunctionName in ScriptWithOneFunction["Function"]:
- check_file_name = ScriptWithOneFunction["Script"][FunctionName]
- if repertory_check and not os.path.exists(check_file_name):
- check_file_name = os.path.join(repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName]))
+ check_file_name = os.path.join(repertory, os.path.basename(TheData["Script"][FunctionName]))
if not os.path.exists(check_file_name):
raise ValueError("\n\n The script file cannot be found for the \"%s\" keyword, please \n check its availability. The given user file is:\n %s\n"%(from_type,check_file_name))
ADAO_Case.edAddDFLink(back_node.getOutputPort("type"), CAS_node.getInputPort(key_type))
ADAO_Case.edAddDFLink(back_node.getOutputPort("stored"), CAS_node.getInputPort(key_stored))
- if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict" and key == "ObservationOperator":
- FunctionDict = data_config["Data"]
- for FunctionName in FunctionDict["Function"]:
- port_name = "ObservationOperator" + FunctionName
+ if data_config["Type"] == "Function" and (key == "ObservationOperator" or key == "EvolutionModel"):
+ TheData = data_config["Data"]
+ for FunctionName in TheData["Function"]:
+ port_name = key + FunctionName
CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(FunctionDict["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(FunctionDict["Script"][FunctionName])))
- elif repertory and os.path.exists(FunctionDict["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName])
+ if repertory and not os.path.exists(TheData["Script"][FunctionName]):
+ CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(TheData["Script"][FunctionName])))
+ elif repertory and os.path.exists(TheData["Script"][FunctionName]):
+ CAS_node.getInputPort(port_name).edInitPy(TheData["Script"][FunctionName])
try:
CAS_node.edAddInputPort("studydir", t_string)
CAS_node.getInputPort("studydir").edInitPy(base_repertory)
except: pass
else:
- CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict" and key == "EvolutionModel":
- FunctionDict = data_config["Data"]
- for FunctionName in FunctionDict["Function"]:
- port_name = "EvolutionModel" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(FunctionDict["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(FunctionDict["Script"][FunctionName])))
- elif repertory and os.path.exists(FunctionDict["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(FunctionDict["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch" and key == "ObservationOperator":
- ScriptWithSwitch = data_config["Data"]
- for FunctionName in ScriptWithSwitch["Function"]:
- port_name = "ObservationOperator" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithSwitch["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithSwitch["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch" and key == "EvolutionModel":
- ScriptWithSwitch = data_config["Data"]
- for FunctionName in ScriptWithSwitch["Function"]:
- port_name = "EvolutionModel" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithSwitch["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithSwitch["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithSwitch["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithSwitch["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithFunctions" and key == "ObservationOperator":
- ScriptWithFunctions = data_config["Data"]
- for FunctionName in ScriptWithFunctions["Function"]:
- port_name = "ObservationOperator" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithFunctions["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithFunctions["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithFunctions" and key == "EvolutionModel":
- ScriptWithFunctions = data_config["Data"]
- for FunctionName in ScriptWithFunctions["Function"]:
- port_name = "EvolutionModel" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithFunctions["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithFunctions["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithFunctions["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithFunctions["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithOneFunction" and key == "ObservationOperator":
- ScriptWithOneFunction = data_config["Data"]
- for FunctionName in ScriptWithOneFunction["Function"]:
- port_name = "ObservationOperator" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithOneFunction["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithOneFunction["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName])
-
- if data_config["Type"] == "Function" and data_config["From"] == "ScriptWithOneFunction" and key == "EvolutionModel":
- ScriptWithOneFunction = data_config["Data"]
- for FunctionName in ScriptWithOneFunction["Function"]:
- port_name = "EvolutionModel" + FunctionName
- CAS_node.edAddInputPort(port_name, t_string)
- if repertory and not os.path.exists(ScriptWithOneFunction["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(os.path.join(base_repertory, os.path.basename(ScriptWithOneFunction["Script"][FunctionName])))
- elif repertory and os.path.exists(ScriptWithOneFunction["Script"][FunctionName]):
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName])
- try:
- CAS_node.edAddInputPort("studydir", t_string)
- CAS_node.getInputPort("studydir").edInitPy(base_repertory)
- except: pass
- else:
- CAS_node.getInputPort(port_name).edInitPy(ScriptWithOneFunction["Script"][FunctionName])
+ CAS_node.getInputPort(port_name).edInitPy(TheData["Script"][FunctionName])
# Step 3: create compute bloc
compute_bloc = runtime.createBloc("compute_bloc")
# Check if we have a python script for OptimizerLoopNode
data_config = study_config["ObservationOperator"]
opt_script_nodeOO = None
- if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict":
+ if data_config["Type"] == "Function" and (data_config["From"] == "ScriptWithSwitch" or data_config["From"] == "FunctionDict"):
# Get script
- FunctionDict = data_config["Data"]
+ TheData = data_config["Data"]
script_filename = ""
- for FunctionName in FunctionDict["Function"]:
+ for FunctionName in TheData["Function"]:
# We currently support only one file
- script_filename = FunctionDict["Script"][FunctionName]
- break
-
- # We create a new pyscript node
- opt_script_nodeOO = runtime.createScriptNode("", "FunctionNodeOO")
- if repertory and not os.path.exists(script_filename):
- script_filename = os.path.join(base_repertory, os.path.basename(script_filename))
- try:
- script_str= open(script_filename, 'r')
- except:
- raise ValueError("Exception in opening function script file: " + script_filename)
- node_script = "#-*-coding:iso-8859-1-*-\n"
- node_script += "import sys, os \n"
- node_script += "filepath = \"" + os.path.dirname(script_filename) + "\"\n"
- node_script += "filename = \"" + os.path.basename(script_filename) + "\"\n"
- node_script += "if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):\n"
- node_script += " sys.path.insert(0,filepath)\n"
- node_script += script_str.read()
- opt_script_nodeOO.setScript(node_script)
- opt_script_nodeOO.edAddInputPort("computation", t_param_input)
- opt_script_nodeOO.edAddOutputPort("result", t_param_output)
-
- elif data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch":
- # Get script
- ScriptWithSwitch = data_config["Data"]
- script_filename = ""
- for FunctionName in ScriptWithSwitch["Function"]:
- # We currently support only one file
- script_filename = ScriptWithSwitch["Script"][FunctionName]
+ script_filename = TheData["Script"][FunctionName]
break
# We create a new pyscript node
opt_script_nodeOO = runtime.createScriptNode("", "FunctionNodeOO")
if "EvolutionModel" in study_config.keys():
data_config = study_config["EvolutionModel"]
opt_script_nodeEM = None
- if data_config["Type"] == "Function" and data_config["From"] == "FunctionDict":
+ if data_config["Type"] == "Function" and (data_config["From"] == "ScriptWithSwitch" or data_config["From"] == "FunctionDict"):
# Get script
- FunctionDict = data_config["Data"]
+ TheData = data_config["Data"]
script_filename = ""
- for FunctionName in FunctionDict["Function"]:
+ for FunctionName in TheData["Function"]:
# We currently support only one file
- script_filename = FunctionDict["Script"][FunctionName]
+ script_filename = TheData["Script"][FunctionName]
break
-
- # We create a new pyscript node
- opt_script_nodeEM = runtime.createScriptNode("", "FunctionNodeEM")
- if repertory and not os.path.exists(script_filename):
- script_filename = os.path.join(base_repertory, os.path.basename(script_filename))
- try:
- script_str= open(script_filename, 'r')
- except:
- raise ValueError("Exception in opening function script file: " + script_filename)
- node_script = "#-*-coding:iso-8859-1-*-\n"
- node_script += "import sys, os \n"
- node_script += "filepath = \"" + os.path.dirname(script_filename) + "\"\n"
- node_script += "filename = \"" + os.path.basename(script_filename) + "\"\n"
- node_script += "if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):\n"
- node_script += " sys.path.insert(0,filepath)\n"
- node_script += script_str.read()
- opt_script_nodeEM.setScript(node_script)
- opt_script_nodeEM.edAddInputPort("computation", t_param_input)
- opt_script_nodeEM.edAddOutputPort("result", t_param_output)
-
- elif data_config["Type"] == "Function" and data_config["From"] == "ScriptWithSwitch":
- # Get script
- ScriptWithSwitch = data_config["Data"]
- script_filename = ""
- for FunctionName in ScriptWithSwitch["Function"]:
- # We currently support only one file
- script_filename = ScriptWithSwitch["Script"][FunctionName]
- break
-
# We create a new pyscript node
opt_script_nodeEM = runtime.createScriptNode("", "FunctionNodeEM")
if repertory and not os.path.exists(script_filename):