X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FdaComposant%2FdaCore%2FTemplates.py;h=a2f15753d9d6a7bb2b74e8d499c13b73049ad6fc;hb=bd9eda86ec988924fa98879466a94787c1bd80fe;hp=1d1880da77cca775a1b760df52fc1e98b1a80721;hpb=6fbcf0b0fb9626499c372345a4ab2ed6eb34e1b3;p=modules%2Fadao.git diff --git a/src/daComposant/daCore/Templates.py b/src/daComposant/daCore/Templates.py index 1d1880d..a2f1575 100644 --- a/src/daComposant/daCore/Templates.py +++ b/src/daComposant/daCore/Templates.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2008-2019 EDF R&D +# Copyright (C) 2008-2020 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -178,7 +178,7 @@ ObserverTemplates.store( ObserverTemplates.store( name = "ValuePrinterSaverAndGnuPlotter", content = """print(str(info)+" "+str(var[-1]))\nimport numpy, re\nv=numpy.array(var[-1], ndmin=1)\nglobal istep\ntry:\n istep += 1\nexcept:\n istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\\s','_',f)\nprint('Value saved in \"%s\"'%f)\nnumpy.savetxt(f,v)\nimport Gnuplot\nglobal ifig,gp\ntry:\n ifig += 1\n gp(' set style data lines')\nexcept:\n ifig = 0\n gp = Gnuplot.Gnuplot(persist=1)\n gp(' set style data lines')\ngp('set title \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )""", - fr_FR = "Imprime sur la sortie standard et, en même temps, enregistre dans un fichier du répertoire '/tmp' et affiche graphiquement la valeur courante de la variable ", + fr_FR = "Imprime sur la sortie standard et, en même temps, enregistre dans un fichier du répertoire '/tmp' et affiche graphiquement la valeur courante de la variable", en_EN = "Print on standard output and, in the same, time save in a file of the '/tmp' directory and graphically plot the current value of the variable", order = "next", ) @@ -225,6 +225,31 @@ ObserverTemplates.store( 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')