def _append(self, __command=None, __keys=None, __local=None, __pre=None, __switchoff=False):
"Transformation d'une commande individuelle en un enregistrement"
if __command is not None and __keys is not None and __local is not None:
+ if "Concept" in __keys:
+ logging.debug("TUI Order processed: %s"%(__local["Concept"],))
__text = ""
if __pre is not None:
__text += "%s = "%__pre
if "self" in __keys: __keys.remove("self")
if __command not in ("set","get") and "Concept" in __keys: __keys.remove("Concept")
for k in __keys:
+ if k not in __local: continue
__v = __local[k]
if __v is None: continue
if k == "Checked" and not __v: continue
"Initialisation et enregistrement de l'entête"
GenericCaseViewer.__init__(self, __name, __objname, __content, __object)
self._addLine("# -*- coding: utf-8 -*-")
- self._addLine("#\n# Input for ADAO converter to YACS\n#")
- self._addLine("from numpy import array, matrix")
+ self._addLine("#\n# Input for ADAO converter to SCD\n#")
self._addLine("#")
self._addLine("study_config = {}")
self._addLine("study_config['StudyType'] = 'ASSIMILATION_STUDY'")
"Transformation d'une commande individuelle en un enregistrement"
if __command == "set": __command = __local["Concept"]
else: __command = __command.replace("set", "", 1)
+ logging.debug("SCD Order processed: %s"%(__command))
#
__text = None
if __command in (None, 'execute', 'executePythonScheme', 'executeYACSScheme', 'get', 'Name'):
__text += "%s_config = {}\n"%__command
__local.pop('self','')
__to_be_removed = []
+ __vectorIsDataFile = False
+ __vectorIsScript = False
for __k,__v in __local.items():
if __v is None: __to_be_removed.append(__k)
for __k in __to_be_removed:
__text += "%s_config['From'] = '%s'\n"%(__command,__f)
__text += "%s_config['Data'] = %s\n"%(__command,__v)
__text = __text.replace("''","'")
+ __vectorIsDataFile = True
elif __k == 'Script':
__k = 'Vector'
__f = 'Script'
__text += "%s_config['From'] = '%s'\n"%(__command,__f)
__text += "%s_config['Data'] = %s\n"%(__command,__v)
__text = __text.replace("''","'")
+ __vectorIsScript = True
elif __k in ('Stored', 'Checked', 'ColMajor', 'InputFunctionAsMulti', 'nextStep'):
if bool(__v):
__text += "%s_config['%s'] = '%s'\n"%(__command,__k,int(bool(__v)))
if not bool(__v):
__text += "%s_config['%s'] = '%s'\n"%(__command,__k,int(bool(__v)))
else:
+ if __k == 'Vector' and __vectorIsScript: continue
+ if __k == 'Vector' and __vectorIsDataFile: continue
if __k == 'Parameters': __k = "Dict"
if isinstance(__v,Persistence.Persistence): __v = __v.values()
if callable(__v): __text = self._missing%__v.__name__+__text
if not PlatformInfo.has_salome or \
not PlatformInfo.has_adao:
raise ImportError(
- "Unable to get SALOME or ADAO environnement variables for YACS conversion.\n"+\
- "Please load the right environnement before trying to use it.")
+ "Unable to get SALOME or ADAO environnement for YACS conversion.\n"+\
+ "Please load the right SALOME environnement before trying to use it.")
else:
from daYacsSchemaCreator.run import create_schema_from_content
# -----
order = "next",
)
+# ==============================================================================
+UserPostAnalysisTemplates = TemplateStorage()
+
+UserPostAnalysisTemplates.store(
+ name = "AnalysisPrinter",
+ content = """import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint('Analysis:',xa)""",
+ fr_FR = "Imprime sur la sortie standard la valeur optimale",
+ en_EN = "Print on standard output the optimal value",
+ order = "next",
+ )
+UserPostAnalysisTemplates.store(
+ name = "AnalysisSaver",
+ content = """import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""",
+ fr_FR = "Enregistre la valeur optimale dans un fichier du répertoire '/tmp' nommé 'analysis.txt'",
+ en_EN = "Save the optimal value in a file of the '/tmp' directory named 'analysis.txt'",
+ order = "next",
+ )
+UserPostAnalysisTemplates.store(
+ name = "AnalysisPrinterAndSaver",
+ content = """import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint('Analysis saved in \"%s\"'%f)\nnumpy.savetxt(f,xa)""",
+ fr_FR = "Imprime sur la sortie standard et, en même temps enregistre dans un fichier du répertoire '/tmp', la valeur optimale",
+ en_EN = "Print on standard output and, in the same time save in a file of the '/tmp' directory, the optimal value",
+ order = "next",
+ )
+
# ==============================================================================
if __name__ == "__main__":
print('\n AUTODIAGNOSTIC\n')