]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
OpenTURNS: Remove graphic display in study scripts since they cause errors in SALOME...
authorRenaud Barate <renaud.barate@edf.fr>
Wed, 27 May 2015 12:26:28 +0000 (14:26 +0200)
committerRenaud Barate <renaud.barate@edf.fr>
Wed, 27 May 2015 12:26:28 +0000 (14:26 +0200)
generator/OpenturnsSTD.py

index c56e742e2bea1b8f5b314442ce5af4322a9efaed..12f79930fc1973fa08edc0756694125ce91f659e 100644 (file)
@@ -599,11 +599,11 @@ class STDGenerateur :
         txt += "%s = %s.drawImportanceFactors()\n" % (self.variable["importanceFactorsGraph"], self.variable["myQuadraticCumul"])
         txt += "%s = '%s'\n" % (self.variable["importanceFactorsDrawing"], self.DictMCVal[ 'ImportanceFactorDrawingFilename' ])
         txt += "%s.draw( %s )\n" % (self.variable["importanceFactorsGraph"], self.variable["importanceFactorsDrawing"])
-        txt += "if is_xserver_available():\n"
-        txt += "  view = View(%s)\n" % self.variable["importanceFactorsGraph"]
-        txt += "  view.show(block=True)\n"
-        txt += "else:\n"
-        txt += "  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["importanceFactorsGraph"]
+        txt += "#if is_xserver_available():\n"
+        txt += "#  view = View(%s)\n" % self.variable["importanceFactorsGraph"]
+        txt += "#  view.show(block=True)\n"
+        txt += "#else:\n"
+        txt += "#  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["importanceFactorsGraph"]
         txt += "print 'bitmap =', %s.getBitmap()\n"  % self.variable["importanceFactorsGraph"]
         txt += "print 'postscript =', %s.getPostscript()\n"  % self.variable["importanceFactorsGraph"]
         txt += "\n"
@@ -682,11 +682,11 @@ class STDGenerateur :
         txt += "  %s = %s.drawPDF()\n" % (self.variable["kernelSmoothedGraph"], self.variable["kernelSmoothedDist"])
         txt += "  %s = '%s'\n" % (self.variable["kernelSmoothedPDFDrawing"], self.DictMCVal[ 'KernelSmoothingDrawingFilename' ])
         txt += "  %s.draw( %s )\n" % (self.variable["kernelSmoothedGraph"], self.variable["kernelSmoothedPDFDrawing"])
-        txt += "  if is_xserver_available():\n"
-        txt += "    view = View(%s)\n" % self.variable["kernelSmoothedGraph"]
-        txt += "    view.show(block=True)\n"
-        txt += "  else:\n"
-        txt += "    print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["kernelSmoothedGraph"]
+        txt += "  #if is_xserver_available():\n"
+        txt += "  #  view = View(%s)\n" % self.variable["kernelSmoothedGraph"]
+        txt += "  #  view.show(block=True)\n"
+        txt += "  #else:\n"
+        txt += "  #  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["kernelSmoothedGraph"]
         txt += "  print 'bitmap =', %s.getBitmap()\n"  % self.variable["kernelSmoothedGraph"]
         txt += "  print 'postscript =', %s.getPostscript()\n"  % self.variable["kernelSmoothedGraph"]
         txt += "\n"
@@ -794,11 +794,11 @@ class STDGenerateur :
         txt += "%s = %s.drawProbabilityConvergence( %s )\n" % (self.variable["convergenceGraph"], self.variable["myAlgo"], self.variable["alpha"])
         txt += "%s = '%s'\n" % (self.variable["convergenceDrawing"], self.DictMCVal[ 'ConvergenceDrawingFilename' ])
         txt += "%s.draw( %s )\n" % (self.variable["convergenceGraph"], self.variable["convergenceDrawing"])
-        txt += "if is_xserver_available():\n"
-        txt += "  view = View(%s)\n" % self.variable["convergenceGraph"]
-        txt += "  view.show(block=True)\n"
-        txt += "else:\n"
-        txt += "  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["convergenceGraph"]
+        txt += "#if is_xserver_available():\n"
+        txt += "#  view = View(%s)\n" % self.variable["convergenceGraph"]
+        txt += "#  view.show(block=True)\n"
+        txt += "#else:\n"
+        txt += "#  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["convergenceGraph"]
         txt += "\n"
 
     return txt
@@ -930,11 +930,11 @@ class STDGenerateur :
         txt += "%s = %s.drawImportanceFactors()\n" % (self.variable["importanceFactorsGraph"], self.variable["myResult"])
         txt += "%s = '%s'\n" % (self.variable["importanceFactorsDrawing"], self.DictMCVal[ 'ImportanceFactorDrawingFilename' ])
         txt += "%s.draw( %s )\n" % (self.variable["importanceFactorsGraph"], self.variable["importanceFactorsDrawing"])
-        txt += "if is_xserver_available():\n"
-        txt += "  view = View(%s)\n" % self.variable["importanceFactorsGraph"]
-        txt += "  view.show(block=True)\n"
-        txt += "else:\n"
-        txt += "  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["importanceFactorsGraph"]
+        txt += "#if is_xserver_available():\n"
+        txt += "#  view = View(%s)\n" % self.variable["importanceFactorsGraph"]
+        txt += "#  view.show(block=True)\n"
+        txt += "#else:\n"
+        txt += "#  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["importanceFactorsGraph"]
         txt += "print 'bitmap =', %s.getBitmap()\n"  % self.variable["importanceFactorsGraph"]
         txt += "print 'postscript =', %s.getPostscript()\n"  % self.variable["importanceFactorsGraph"]
         txt += "\n"
@@ -951,11 +951,11 @@ class STDGenerateur :
         txt += "%s = %s.drawEventProbabilitySensitivity()[0]\n" % (self.variable["eventProbabilitySensitivityGraph"], self.variable["myResult"])
         txt += "%s = '%s'\n" % (self.variable["eventProbabilitySensitivityDrawing"], self.DictMCVal[ 'FORMEventProbabilitySensitivityDrawingFilename' ])
         txt += "%s.draw( %s )\n" % (self.variable["eventProbabilitySensitivityGraph"], self.variable["eventProbabilitySensitivityDrawing"])
-        txt += "if is_xserver_available():\n"
-        txt += "  view = View(%s)\n" % self.variable["eventProbabilitySensitivityGraph"]
-        txt += "  view.show(block=True)\n"
-        txt += "else:\n"
-        txt += "  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["eventProbabilitySensitivityGraph"]
+        txt += "#if is_xserver_available():\n"
+        txt += "#  view = View(%s)\n" % self.variable["eventProbabilitySensitivityGraph"]
+        txt += "#  view.show(block=True)\n"
+        txt += "#else:\n"
+        txt += "#  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["eventProbabilitySensitivityGraph"]
         txt += "print 'bitmap =', %s.getBitmap()\n"  % self.variable["eventProbabilitySensitivityGraph"]
         txt += "print 'postscript =', %s.getPostscript()\n"  % self.variable["eventProbabilitySensitivityGraph"]
         txt += "\n"
@@ -972,11 +972,11 @@ class STDGenerateur :
         txt += "%s = %s.drawHasoferReliabilityIndexSensitivity()[0]\n" % (self.variable["hasoferReliabilityIndexSensitivityGraph"], self.variable["myResult"])
         txt += "%s = '%s'\n" % (self.variable["hasoferReliabilityIndexSensitivityDrawing"], self.DictMCVal[ 'HasoferReliabilityIndexSensitivityDrawingFilename' ])
         txt += "%s.draw( %s )\n" % (self.variable["hasoferReliabilityIndexSensitivityGraph"], self.variable["hasoferReliabilityIndexSensitivityDrawing"])
-        txt += "if is_xserver_available():\n"
-        txt += "  view = View(%s)\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
-        txt += "  view.show(block=True)\n"
-        txt += "else:\n"
-        txt += "  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+        txt += "#if is_xserver_available():\n"
+        txt += "#  view = View(%s)\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+        txt += "#  view.show(block=True)\n"
+        txt += "#else:\n"
+        txt += "#  print 'Warning: cannot display image', %s.getBitmap(), '(probably because no X server was found)'\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
         txt += "print 'bitmap =', %s.getBitmap()\n"  % self.variable["hasoferReliabilityIndexSensitivityGraph"]
         txt += "print 'postscript =', %s.getPostscript()\n"  % self.variable["hasoferReliabilityIndexSensitivityGraph"]
         txt += "\n"