self.__elapsed_time = time.perf_counter() - self.__initial_elapsed_time
return self.__cpu_time, self.__elapsed_time
+ def _StopOnTimeLimit(self, X=None, withReason=False):
+ "Stop criteria on time limit: True/False [+ Reason]"
+ c, e = self._getTimeState()
+ if "MaximumCpuTime" in self._parameters and c > self._parameters["MaximumCpuTime"]:
+ __SC, __SR = True, "Reached maximum CPU time (%.1fs > %.1fs)"%(c, self._parameters["MaximumCpuTime"])
+ elif "MaximumElapsedTime" in self._parameters and e > self._parameters["MaximumElapsedTime"]:
+ __SC, __SR = True, "Reached maximum elapsed time (%.1fs > %.1fs)"%(e, self._parameters["MaximumElapsedTime"])
+ else:
+ __SC, __SR = False, ""
+ if withReason:
+ return __SC, __SR
+ else:
+ return __SC
+
# ==============================================================================
class AlgorithmAndParameters(object):
"""
backends_KO = []
backend_now = matplotlib.get_backend()
- for backend in ['bidon', 'pdf', 'pgf', 'Qt4Agg', 'GTK', 'GTKAgg', 'ps',
- 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg',
- 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg',
- 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX']:
+ for backend in ['bidon', 'MacOSX', 'Qt5Agg', 'GTK3Agg', 'TkAgg', 'WxAgg', 'Agg',
+ 'Qt5', 'Qt5Cairo', 'GTK3Cairo', 'TkCairo', 'WxCairo', 'Cairo',
+ 'ps', 'pdf', 'svg', 'Template', 'WebAgg',
+ 'Qt4', 'Qt4Agg', 'Qt4Cairo', 'Wx', 'pgf', 'GTK',
+ 'GTKAgg', 'GTKCairo', 'Cocoa', 'CocoaAgg', 'emf', 'gdk',
+ ]:
try:
matplotlib.use(backend)
backends_OK.append(backend)
except ValueError:
backends_KO.append(backend)
+ backends_OK.sort()
+ backends_KO.sort()
#
print(" Backends disponibles pour Matplotlib %s :"%mplversion)
print(" Defaut initial......: '%s'"%backend_now)