Salome HOME
Minor documentation and code review corrections (39)
[modules/adao.git] / resources / ADAOSchemaCatalog.xml
1 <?xml version='1.0' encoding='utf-8' ?>
2 <!--
3   Copyright (C) 2008-2023 EDF R&D
4
5   This file is part of SALOME ADAO module
6
7   This library is free software; you can redistribute it and/or
8   modify it under the terms of the GNU Lesser General Public
9   License as published by the Free Software Foundation; either
10   version 2.1 of the License.
11
12   This library is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   Lesser General Public License for more details.
16
17   You should have received a copy of the GNU Lesser General Public
18   License along with this library; if not, write to the Free Software
19   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20
21   See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22
23   Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 -->
25 <proc>
26
27   <objref name="computeAD" id="python:computeAD:1.0">
28     <base>pyobj</base>
29   </objref>
30
31   <!-- Types for parametric computations -->
32   <!-- TODO On devrait pouvoir le lire depuis le KERNEL !!!-->
33   <type name="long" kind="int"/>
34   <struct name="SALOME_TYPES/Parameter">
35     <member type="string" name="name"></member>
36     <member type="string" name="value"></member>
37   </struct>
38   <sequence content="SALOME_TYPES/Parameter" name="SALOME_TYPES/ParameterList"></sequence>
39   <sequence content="double" name="SALOME_TYPES/Variable"></sequence>
40   <sequence content="SALOME_TYPES/Variable" name="SALOME_TYPES/VariableSequence"></sequence>
41   <sequence content="SALOME_TYPES/VariableSequence" name="SALOME_TYPES/StateSequence"></sequence>
42   <sequence content="SALOME_TYPES/StateSequence" name="SALOME_TYPES/TimeSequence"></sequence>
43   <sequence content="string" name="SALOME_TYPES/VarList"></sequence>
44   <struct name="SALOME_TYPES/ParametricInput">
45     <member type="SALOME_TYPES/VarList" name="inputVarList"></member>
46     <member type="SALOME_TYPES/VarList" name="outputVarList"></member>
47     <member type="SALOME_TYPES/TimeSequence" name="inputValues"></member>
48     <member type="SALOME_TYPES/ParameterList" name="specificParameters"></member>
49   </struct>
50   <struct name="SALOME_TYPES/ParametricOutput">
51     <member type="SALOME_TYPES/TimeSequence" name="outputValues"></member>
52     <member type="SALOME_TYPES/ParameterList" name="specificOutputInfos"></member>
53     <member type="long" name="returnCode"></member>
54     <member type="string" name="errorMessage"></member>
55   </struct>
56
57
58   <inline name="CreateAssimilationStudy">
59     <script><code>
60
61 <![CDATA[
62 import sys, numpy, logging
63 logging.debug("CREATE YI Entering in CreateAssimilationStudy")
64 print("Entering in the assimilation study")
65 print("Name is set to........:", Name)
66 print("Algorithm is set to...:", Algorithm)
67
68 try:
69     # Create Assimilation study
70     if sys.version_info.major > 2: import adao
71     from daYacsIntegration.daStudy import *
72     assim_study = daStudy(Name, Algorithm, Debug)
73
74     logging.debug("CREATE YI Data entered are:")
75
76     # Algorithm parameters
77     if "AlgorithmParameters" in locals():
78       logging.debug("CREATE YI AlgorithmParameters is %s"%AlgorithmParameters)
79       assim_study.setYIAlgorithmParameters(AlgorithmParameters)
80
81     # Background
82     if "Background" in locals():
83       logging.debug("CREATE YI Background is set")
84       logging.debug("CREATE YI BackgroundType is %s"%BackgroundType)
85       logging.debug("CREATE YI BackgroundStored is %s"%BackgroundStored)
86       assim_study.setYIBackgroundType(BackgroundType)
87       assim_study.setYIBackgroundStored(BackgroundStored)
88       assim_study.setYIBackground(Background)
89
90     # CheckingPoint
91     if "CheckingPoint" in locals():
92       logging.debug("CREATE YI CheckingPoint is set")
93       logging.debug("CREATE YI CheckingPointType is %s"%CheckingPointType)
94       logging.debug("CREATE YI CheckingPointStored is %s"%CheckingPointStored)
95       assim_study.setYICheckingPointType(CheckingPointType)
96       assim_study.setYICheckingPointStored(CheckingPointStored)
97       assim_study.setYICheckingPoint(CheckingPoint)
98
99     # ControlInput
100     if "ControlInput" in locals():
101       logging.debug("CREATE YI ControlInput is set")
102       logging.debug("CREATE YI ControlInputType is %s"%ControlInputType)
103       logging.debug("CREATE YI ControlInputStored is %s"%ControlInputStored)
104       assim_study.setYIControlInputType(ControlInputType)
105       assim_study.setYIControlInputStored(ControlInputStored)
106       assim_study.setYIControlInput(ControlInput)
107
108     # Observation
109     if "Observation" in locals():
110       logging.debug("CREATE YI Observation is set")
111       logging.debug("CREATE YI ObservationType is %s"%ObservationType)
112       logging.debug("CREATE YI ObservationStored is %s"%ObservationStored)
113       assim_study.setYIObservationType(ObservationType)
114       assim_study.setYIObservationStored(ObservationStored)
115       assim_study.setYIObservation(Observation)
116
117     # BackgroundError
118     if "BackgroundError" in locals():
119       logging.debug("CREATE YI BackgroundError is set")
120       logging.debug("CREATE YI BackgroundErrorType is %s"%BackgroundErrorType)
121       logging.debug("CREATE YI BackgroundErrorStored is %s"%BackgroundErrorStored)
122       assim_study.setYIBackgroundErrorType(BackgroundErrorType)
123       assim_study.setYIBackgroundErrorStored(BackgroundErrorStored)
124       assim_study.setYIBackgroundError(BackgroundError)
125
126     # ObservationError
127     if "ObservationError" in locals():
128       logging.debug("CREATE YI ObservationError is set")
129       logging.debug("CREATE YI ObservationErrorType is %s"%ObservationErrorType)
130       logging.debug("CREATE YI ObservationErrorStored is %s"%ObservationErrorStored)
131       assim_study.setYIObservationErrorType(ObservationErrorType)
132       assim_study.setYIObservationErrorStored(ObservationErrorStored)
133       assim_study.setYIObservationError(ObservationError)
134
135     # EvolutionError
136     if "EvolutionError" in locals():
137       logging.debug("CREATE YI EvolutionError is set")
138       logging.debug("CREATE YI EvolutionErrorType is %s"%EvolutionErrorType)
139       logging.debug("CREATE YI EvolutionErrorStored is %s"%EvolutionErrorStored)
140       assim_study.setYIEvolutionErrorType(EvolutionErrorType)
141       assim_study.setYIEvolutionErrorStored(EvolutionErrorStored)
142       assim_study.setYIEvolutionError(EvolutionError)
143
144     # ObservationOperator
145     ObservationOperatorOk = 0
146     if "ObservationOperator" in locals():
147       logging.debug("CREATE YI ObservationOperator is set")
148       logging.debug("CREATE YI ObservationOperatorType is %s"%ObservationOperatorType)
149       assim_study.setYIObservationOperatorType("Matrix", ObservationOperatorType)
150       assim_study.setYIObservationOperator("Matrix", ObservationOperator)
151       ObservationOperatorOk = 1
152
153     if ObservationOperatorOk == 0:
154       if "ObservationOperatorDirect" in locals():
155         logging.debug("CREATE YI ObservationOperatorDirect is %s"%ObservationOperatorDirect)
156         assim_study.setYIObservationOperatorType("Direct", "Function")
157         assim_study.setYIObservationOperator("Direct", ObservationOperatorDirect)
158       if "ObservationOperatorTangent" in locals():
159         logging.debug("CREATE YI ObservationOperatorTangent is %s"%ObservationOperatorTangent)
160         assim_study.setYIObservationOperatorType("Tangent", "Function")
161         assim_study.setYIObservationOperator("Tangent", ObservationOperatorTangent)
162       if "ObservationOperatorAdjoint" in locals():
163         logging.debug("CREATE YI ObservationOperatorAdjoint is %s"%ObservationOperatorAdjoint)
164         assim_study.setYIObservationOperatorType("Adjoint", "Function")
165         assim_study.setYIObservationOperator("Adjoint", ObservationOperatorAdjoint)
166
167     # EvolutionModel
168     EvolutionModelOk = 0
169     if "EvolutionModel" in locals():
170       logging.debug("CREATE YI EvolutionModel is set")
171       logging.debug("CREATE YI EvolutionModelType is %s"%EvolutionModelType)
172       assim_study.setYIEvolutionModelType("Matrix", EvolutionModelType)
173       assim_study.setYIEvolutionModel("Matrix", EvolutionModel)
174       EvolutionModelOk = 1
175
176     if EvolutionModelOk == 0:
177       if "EvolutionModelDirect" in locals():
178         logging.debug("CREATE YI EvolutionModelDirect is %s"%EvolutionModelDirect)
179         assim_study.setYIEvolutionModelType("Direct", "Function")
180         assim_study.setYIEvolutionModel("Direct", EvolutionModelDirect)
181       if "EvolutionModelTangent" in locals():
182         logging.debug("CREATE YI EvolutionModelTangent is %s"%EvolutionModelTangent)
183         assim_study.setYIEvolutionModelType("Tangent", "Function")
184         assim_study.setYIEvolutionModel("Tangent", EvolutionModelTangent)
185       if "EvolutionModelAdjoint" in locals():
186         logging.debug("CREATE YI EvolutionModelAdjoint is %s"%EvolutionModelAdjoint)
187         assim_study.setYIEvolutionModelType("Adjoint", "Function")
188         assim_study.setYIEvolutionModel("Adjoint", EvolutionModelAdjoint)
189
190     # Variables
191     for name, size in zip(InputVariablesNames, InputVariablesSizes):
192       assim_study.setYIInputVariable(name, size)
193     for name, size in zip(OutputVariablesNames, OutputVariablesSizes):
194       assim_study.setYIOutputVariable(name, size)
195
196     if has_observers:
197       logging.debug("CREATE YI Observers keys are %s"%observers.keys())
198       # Adding observers to the study
199       for observer_name in observers.keys():
200         scheduler = ""
201         info = ""
202         number = str(observers[observer_name]["number"])
203         if "scheduler" in observers[observer_name].keys():
204           scheduler = observers[observer_name]["scheduler"]
205         if "info" in observers[observer_name].keys():
206           info = observers[observer_name]["info"]
207         assim_study.addYIObserver(observer_name, scheduler, info, number)
208
209 except Exception as e:
210     if isinstance(e, SyntaxError): msg = "at %s: %s"%(e.offset, e.text)
211     else: msg = ""
212     raise ValueError("during execution, the following error occurs:\n\n%s %s\n\nSee also the potential messages, which can show the origin of the above error, in the launching terminal."%(str(e),msg))
213
214 Study = assim_study
215 ]]>
216
217 </code></script>
218     <inport name="Name" type="string"/>
219     <inport name="Algorithm" type="string"/>
220     <inport name="Debug" type="bool"/>
221     <inport name="InputVariablesNames" type="stringvec"/>
222     <inport name="InputVariablesSizes" type="intvec"/>
223     <inport name="OutputVariablesNames" type="stringvec"/>
224     <inport name="OutputVariablesSizes" type="intvec"/>
225     <inport name="has_observers" type="bool"/>
226     <inport name="observers" type="pyobj"/>
227     <outport name="Study" type="pyobj"/>
228   </inline>
229
230   <inline name="CreateNumpyMatrixFromString">
231     <script><code><![CDATA[
232 import numpy, logging
233 logging.debug("CREATE YI Entering in CreateNumpyMatrixFromString")
234 if (matrix_in_string.find("array")>-1) or (matrix_in_string.find("matrix")>-1):
235     matrix_in_string=matrix_in_string.replace("array","numpy.array")
236     matrix_in_string=matrix_in_string.replace("matrix","numpy.matrix")
237     exec("matrix="+matrix_in_string)
238     matrix = numpy.matrix(matrix)
239 else:
240     matrix_in_string=matrix_in_string.replace("'","").replace('"','')
241     matrix = numpy.matrix(matrix_in_string)
242 type = "Matrix"
243 logging.debug("CREATE YI Matrix is %s"%matrix)
244 ]]></code></script>
245     <inport name="matrix_in_string" type="string"/>
246     <outport name="matrix" type="pyobj"/>
247     <outport name="type" type="string"/>
248     <outport name="stored" type="bool"/>
249   </inline>
250
251   <inline name="CreateNumpyScalarSparseMatrixFromString">
252     <script><code><![CDATA[
253 import numpy, logging
254 logging.debug("CREATE YI Entering in CreateNumpyScalarSparseMatrixFromString")
255 if (matrix_in_string.find("array")>-1) or (matrix_in_string.find("matrix")>-1):
256     matrix_in_string=matrix_in_string.replace("array","numpy.array")
257     matrix_in_string=matrix_in_string.replace("matrix","numpy.matrix")
258     exec("matrix="+matrix_in_string)
259     matrix = numpy.matrix(matrix)
260 else:
261     matrix_in_string=matrix_in_string.replace("'","").replace('"','')
262     matrix = numpy.matrix(matrix_in_string)
263 type = "ScalarSparseMatrix"
264 logging.debug("CREATE YI ScalarSparseMatrix is %s"%matrix)
265 ]]></code></script>
266     <inport name="matrix_in_string" type="string"/>
267     <outport name="matrix" type="pyobj"/>
268     <outport name="type" type="string"/>
269     <outport name="stored" type="bool"/>
270   </inline>
271
272   <inline name="CreateNumpyDiagonalSparseMatrixFromString">
273     <script><code><![CDATA[
274 import numpy, logging
275 logging.debug("CREATE YI Entering in CreateNumpyDiagonalSparseMatrixFromString")
276 if (matrix_in_string.find("array")>-1) or (matrix_in_string.find("matrix")>-1):
277     matrix_in_string=matrix_in_string.replace("array","numpy.array")
278     matrix_in_string=matrix_in_string.replace("matrix","numpy.matrix")
279     exec("matrix="+matrix_in_string)
280     matrix = numpy.matrix(matrix)
281 else:
282     matrix_in_string=matrix_in_string.replace("'","").replace('"','')
283     matrix = numpy.matrix(matrix_in_string)
284 type = "DiagonalSparseMatrix"
285 logging.debug("CREATE YI DiagonalSparseMatrix is %s"%matrix)
286 ]]></code></script>
287     <inport name="matrix_in_string" type="string"/>
288     <outport name="matrix" type="pyobj"/>
289     <outport name="type" type="string"/>
290     <outport name="stored" type="bool"/>
291   </inline>
292
293   <inline name="CreateNumpyMatrixFromScript">
294     <script><code><![CDATA[
295 import logging, sys, os
296 logging.debug("CREATE YI Entering in CreateNumpyMatrixFromScript")
297 type = "Matrix"
298
299 # Get file path and filename
300 try:
301     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
302         sys.path.insert(0,studydir)
303 except:
304     pass
305 filepath = os.path.dirname(script)
306 filename = os.path.basename(script)
307 module_name = os.path.splitext(filename)[0]
308 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
309     sys.path.insert(0,filepath)
310
311 ]]></code></script>
312     <inport name="script" type="string"/>
313     <outport name="type" type="string"/>
314     <outport name="stored" type="bool"/>
315   </inline>
316
317   <inline name="CreateNumpyScalarSparseMatrixFromScript">
318     <script><code><![CDATA[
319 import logging, sys, os
320 logging.debug("CREATE YI Entering in CreateNumpyScalarSparseMatrixFromScript")
321 type = "ScalarSparseMatrix"
322
323 # Get file path and filename
324 try:
325     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
326         sys.path.insert(0,studydir)
327 except:
328     pass
329 filepath = os.path.dirname(script)
330 filename = os.path.basename(script)
331 module_name = os.path.splitext(filename)[0]
332 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
333     sys.path.insert(0,filepath)
334
335 ]]></code></script>
336     <inport name="script" type="string"/>
337     <outport name="type" type="string"/>
338     <outport name="stored" type="bool"/>
339   </inline>
340
341   <inline name="CreateNumpyDiagonalSparseMatrixFromScript">
342     <script><code><![CDATA[
343 import logging, sys, os
344 logging.debug("CREATE YI Entering in CreateNumpyDiagonalSparseMatrixFromScript")
345 type = "DiagonalSparseMatrix"
346
347 # Get file path and filename
348 try:
349     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
350         sys.path.insert(0,studydir)
351 except:
352     pass
353 filepath = os.path.dirname(script)
354 filename = os.path.basename(script)
355 module_name = os.path.splitext(filename)[0]
356 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
357     sys.path.insert(0,filepath)
358
359 ]]></code></script>
360     <inport name="script" type="string"/>
361     <outport name="type" type="string"/>
362     <outport name="stored" type="bool"/>
363   </inline>
364
365   <inline name="CreateNumpyVectorFromString">
366     <script><code><![CDATA[
367 import numpy, logging
368 logging.debug("CREATE YI Entering in CreateNumpyVectorFromString")
369 if (vector_in_string.find("array")>-1) or (vector_in_string.find("matrix")>-1):
370     vector_in_string=vector_in_string.replace("array","numpy.array")
371     vector_in_string=vector_in_string.replace("matrix","numpy.matrix")
372     exec("vector="+vector_in_string)
373     vector = numpy.matrix(vector)
374 else:
375     vector_in_string=vector_in_string.replace("'","").replace('"','')
376     vector = numpy.matrix(vector_in_string)
377 type = "Vector"
378 logging.debug("Vector is %s"%vector)
379 ]]></code></script>
380     <inport name="vector_in_string" type="string"/>
381     <outport name="vector" type="pyobj"/>
382     <outport name="type" type="string"/>
383     <outport name="stored" type="bool"/>
384   </inline>
385
386   <inline name="CreateNumpyVectorFromScript">
387     <script><code><![CDATA[
388 import logging, sys, os
389 logging.debug("CREATE YI Entering in CreateNumpyVectorFromScript")
390 type = "Vector"
391
392 # Get file path and filename
393 try:
394     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
395         sys.path.insert(0,studydir)
396 except:
397     pass
398 filepath = os.path.dirname(script)
399 filename = os.path.basename(script)
400 module_name = os.path.splitext(filename)[0]
401 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
402     sys.path.insert(0,filepath)
403
404 ]]></code></script>
405     <inport name="script" type="string"/>
406     <outport name="type" type="string"/>
407     <outport name="stored" type="bool"/>
408   </inline>
409
410   <inline name="CreateNumpyVectorFromDataFile">
411     <script><code><![CDATA[
412 import logging, sys, numpy
413 logging.debug("CREATE YI Entering in CreateNumpyVectorFromDataFile")
414 type = "Vector"
415
416 if sys.version_info.major > 2: import adao
417 from daCore.Interfaces import ImportFromFile as aif
418 if colmajor:
419     vector = numpy.ravel( numpy.transpose( aif(script).getvalue(columns)[1] ) )
420 else:
421     vector = numpy.ravel( aif(script).getvalue(columns)[1] )
422 ]]></code></script>
423     <inport name="script" type="string"/>
424     <inport name="columns" type="stringvec"/>
425     <inport name="colmajor" type="bool"/>
426     <outport name="vector" type="pyobj"/>
427     <outport name="type" type="string"/>
428     <outport name="stored" type="bool"/>
429   </inline>
430
431   <inline name="CreateNumpyVectorSerieFromString">
432     <script><code><![CDATA[
433 import numpy, logging
434 logging.debug("CREATE YI Entering in CreateNumpyVectorSerieFromString")
435 # vector_in_list = eval(str(vector_in_string),{},{})
436 # vector = numpy.matrix(vector_in_list)
437 if (vector_in_string.find("array")>-1) or (vector_in_string.find("matrix")>-1):
438     vector_in_string=vector_in_string.replace("array","numpy.array")
439     vector_in_string=vector_in_string.replace("matrix","numpy.matrix")
440     exec("vector="+vector_in_string)
441     vector = numpy.array(vector)
442 else:
443     vector_in_string=vector_in_string.replace("'","").replace('"','')
444     vector_in_list = eval(str(vector_in_string),{},{})
445     vector = numpy.array(vector_in_list)
446 type = "VectorSerie"
447 logging.debug("VectorSerie is %s"%vector)
448 ]]></code></script>
449     <inport name="vector_in_string" type="string"/>
450     <outport name="vector" type="pyobj"/>
451     <outport name="type" type="string"/>
452     <outport name="stored" type="bool"/>
453   </inline>
454
455   <inline name="CreateNumpyVectorSerieFromScript">
456     <script><code><![CDATA[
457 import logging, sys, os
458 logging.debug("CREATE YI Entering in CreateNumpyVectorSerieFromScript")
459 type = "VectorSerie"
460
461 # Get file path and filename
462 try:
463     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
464         sys.path.insert(0,studydir)
465 except:
466     pass
467 filepath = os.path.dirname(script)
468 filename = os.path.basename(script)
469 module_name = os.path.splitext(filename)[0]
470 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
471     sys.path.insert(0,filepath)
472
473 ]]></code></script>
474     <inport name="script" type="string"/>
475     <outport name="type" type="string"/>
476     <outport name="stored" type="bool"/>
477   </inline>
478
479   <inline name="CreateNumpyVectorSerieFromDataFile">
480     <script><code><![CDATA[
481 import logging, sys, numpy
482 logging.debug("CREATE YI Entering in CreateNumpyVectorSerieFromDataFile")
483 type = "VectorSerie"
484
485 if sys.version_info.major > 2: import adao
486 from daCore.Interfaces import ImportFromFile as aif
487 if len(columns) == 0: columns = None
488 if colmajor:
489     aif(script).getvalue(columns)[1]
490 else:
491     vector = numpy.transpose( aif(script).getvalue(columns)[1] )
492 ]]></code></script>
493     <inport name="script" type="string"/>
494     <inport name="columns" type="stringvec"/>
495     <inport name="colmajor" type="bool"/>
496     <outport name="vector" type="pyobj"/>
497     <outport name="type" type="string"/>
498     <outport name="stored" type="bool"/>
499   </inline>
500
501   <inline name="SimpleExecuteDirectAlgorithm">
502     <script><code><![CDATA[
503 import logging
504 logging.debug("EXECUTE Entering in SimpleExecuteDirectAlgorithm")
505 from daYacsIntegration.daStudy import *
506 ADD = Study.getResults()
507 ADD.analyze()
508 ]]></code></script>
509     <inport name="Study" type="pyobj"/>
510     <outport name="Study" type="pyobj"/>
511   </inline>
512
513   <inline name="SimpleUserAnalysis">
514     <script><code><![CDATA[
515 #-*- coding: utf-8 -*-
516 import sys, logging
517 logging.debug("TERMINATE Entering in SimpleUserAnalysis")
518 if sys.version_info.major < 3:
519     ADD = Study.getResults()
520 else:
521     ADD = Study
522 # User code is below
523
524 ]]></code></script>
525     <inport name="Study" type="pyobj"/>
526   </inline>
527
528   <inline name="FakeOptimizerLoopNode">
529     <script><code><![CDATA[
530 import logging
531 logging.debug("EXECUTE Entering in FakeOptimizerLoopNode")
532 result = None
533 ]]></code></script>
534     <inport name="computation" type="SALOME_TYPES/ParametricInput"/>
535     <outport name="result" type="SALOME_TYPES/ParametricOutput"/>
536   </inline>
537
538   <inline name="CreateDictFromString">
539     <script><code><![CDATA[
540 import logging, sys, os
541 logging.debug("CREATE YI Entering in CreateDictFromString")
542 dico = eval(dict_in_string)
543 ]]></code></script>
544     <inport name="dict_in_string" type="string"/>
545   </inline>
546
547   <inline name="CreateDictFromScript">
548     <script><code><![CDATA[
549 import logging, sys, os
550 logging.debug("CREATE YI Entering in CreateDictFromScript")
551
552 # Get file path and filename
553 try:
554     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
555         sys.path.insert(0,studydir)
556 except:
557     pass
558 filepath = os.path.dirname(script)
559 filename = os.path.basename(script)
560 module_name = os.path.splitext(filename)[0]
561 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
562     sys.path.insert(0,filepath)
563
564 ]]></code></script>
565     <inport name="script" type="string"/>
566   </inline>
567
568   <inline name="UserDataInitFromScript">
569     <script><code><![CDATA[
570 import logging, sys, os
571 logging.debug("CREATE YI Entering in UserDataInitFromScript")
572
573 # Get file path and filename
574 try:
575     if sys.path.count(studydir)==0 or (sys.path.count(studydir)>0 and sys.path.index(studydir)>0):
576         sys.path.insert(0,studydir)
577 except:
578     pass
579 filepath = os.path.dirname(script)
580 filename = os.path.basename(script)
581 module_name = os.path.splitext(filename)[0]
582 if sys.path.count(filepath)==0 or (sys.path.count(filepath)>0 and sys.path.index(filepath)>0):
583     sys.path.insert(0,filepath)
584
585 ]]></code></script>
586     <inport name="script" type="string"/>
587     <outport name="init_data" type="pyobj"/>
588   </inline>
589
590   <inline name="ReadForSwitchNode">
591     <script><code><![CDATA[import sys, logging, codecs, pickle
592 if sys.version_info.major > 2: import adao
593 def loads( data ):
594   return pickle.loads(codecs.decode(data.encode(), "base64"))
595 logging.debug("CREATE YI Entering in ReadForSwitchNode")
596 # logging.debug("       with input data : ",list(data["specificParameters"]))
597 switch_value = -1
598 for param in data["specificParameters"]:
599   # logging.debug("       ReadForSwitchNode specificParameters : ",param)
600   if param["name"] == "switch_value":
601     switch_value = int(loads(param["value"]))
602 logging.debug("       switching to value : "+str(switch_value))
603 ]]></code></script>
604     <inport name="data" type="SALOME_TYPES/ParametricInput"/>
605     <outport name="data" type="SALOME_TYPES/ParametricInput"/>
606     <outport name="switch_value" type="int"/>
607   </inline>
608
609   <inline name="ExtractDataNode">
610     <script><code><![CDATA[import sys, logging, codecs, pickle
611 if sys.version_info.major > 2: import adao
612 def loads( data ):
613   return pickle.loads(codecs.decode(data.encode(), "base64"))
614 logging.debug("TERMINATE Entering in ExtractData/Node")
615 from daCore.Aidsm import Aidsm
616 var = None
617 info = None
618 for param in data["specificParameters"]:
619   if param["name"] == "var":
620     var = loads(param["value"])
621   if param["name"] == "info":
622     info = loads(param["value"])
623 ]]></code></script>
624     <inport name="data" type="SALOME_TYPES/ParametricInput"/>
625     <outport name="var" type="pyobj"/>
626     <outport name="info" type="pyobj"/>
627   </inline>
628
629   <inline name="ObservationNodeString">
630     <script><code><![CDATA[]]></code></script>
631     <inport name="var" type="pyobj"/>
632     <inport name="info" type="pyobj"/>
633   </inline>
634
635   <inline name="ObservationNodeFile">
636     <script><code><![CDATA[with open(script, 'rb') as file: exec(file.read())]]></code></script>
637     <inport name="var"    type="pyobj"/>
638     <inport name="info"   type="pyobj"/>
639     <inport name="script" type="string"/>
640   </inline>
641
642   <inline name="EndObservationNode">
643     <script><code><![CDATA[
644 # Create a fake output object.
645 # An observer is always successful.
646 output = {}
647 output["outputValues"]        = [[[[]]]]
648 output["specificOutputInfos"] = []
649 output["returnCode"]          = 0
650 output["errorMessage"]        = ""
651 ]]></code></script>
652     <outport name="output" type="SALOME_TYPES/ParametricOutput"/>
653   </inline>
654
655   <inline name="SetObserversNode">
656     <script><code><![CDATA[
657 #print("Setting observers")
658 ]]></code></script>
659     <outport name="has_observers" type="bool"/>
660     <outport name="observers" type="pyobj"/>
661   </inline>
662 </proc>