@@ -120,11 +120,6 @@ def initialize(self, modulo=None):
120120 """reset logger, overwrite original files, `modulo`: log only every modulo call"""
121121 if modulo is not None :
122122 self .modulo = modulo
123- try :
124- es = self .es # must have been registered
125- except AttributeError :
126- pass # TODO: revise usage of es... that this can pass
127- raise AttributeError ('call register() before initialize()' )
128123
129124 self .counter = 0 # number of calls of add
130125 self .last_iteration = 0 # some lines are only written if iteration>last_iteration
@@ -295,18 +290,21 @@ def add(self, es=None, more_data=(), modulo=None):
295290 1 + len (kernel ._last_offspring_f_values ) )
296291
297292
298- first_quartile_ratio_offspring_incumbent = np .percentile (es ._ratio_nondom_offspring_incumbent , 25 );
299- median_ratio_offspring_incumbent = np .percentile (es ._ratio_nondom_offspring_incumbent , 50 );
300- last_quartile_ratio_offspring_incumbent = np .percentile (es ._ratio_nondom_offspring_incumbent , 75 );
293+ first_quartile_ratio_offspring_incumbent = np .percentile (
294+ es ._ratio_nondom_offspring_incumbent , 25 )
295+ median_ratio_offspring_incumbent = np .percentile (
296+ es ._ratio_nondom_offspring_incumbent , 50 )
297+ last_quartile_ratio_offspring_incumbent = np .percentile (
298+ es ._ratio_nondom_offspring_incumbent , 75 )
301299
302300
303- median_axis_ratios = np .median ([kernel .D .max () / kernel .D .min () \
304- if not kernel .opts ['CMA_diagonal' ] or kernel .countiter > kernel .opts ['CMA_diagonal' ]
305- else max (kernel .sigma_vec * 1 ) / min (kernel .sigma_vec * 1 ) for kernel in es .kernels ])
301+ median_axis_ratios = np .median ([kernel .D .max () / kernel .D .min ()
302+ if not kernel .opts ['CMA_diagonal' ] or kernel .countiter > kernel .opts ['CMA_diagonal' ]
303+ else max (kernel .sigma_vec * 1 ) / min (kernel .sigma_vec * 1 ) for kernel in es .kernels ])
306304 median_sigmas = np .median ([kernel .sigma for kernel in es .kernels ])
307- median_min_stds = np .median ([kernel .sigma * min (kernel .sigma_vec * kernel .dC ** 0.5 ) \
305+ median_min_stds = np .median ([kernel .sigma * min (kernel .sigma_vec * kernel .dC ** 0.5 )
308306 for kernel in es .kernels ])
309- median_max_stds = np .median ([kernel .sigma * max (kernel .sigma_vec * kernel .dC ** 0.5 ) \
307+ median_max_stds = np .median ([kernel .sigma * max (kernel .sigma_vec * kernel .dC ** 0.5 )
310308 for kernel in es .kernels ])
311309 median_stds = self .es .median_stds
312310
@@ -444,6 +442,7 @@ def plot(self, filename=None, x_iteration = False):
444442
445443 Otherwise, plot all.
446444 """
445+ from matplotlib import pyplot as plt
447446 if filename :
448447 iteration , countevals , res = self .load (filename )
449448 for i in range (len (res )):
@@ -452,7 +451,6 @@ def plot(self, filename=None, x_iteration = False):
452451 else :
453452 plt .plot (iteration , res )
454453 else :
455- from matplotlib import pyplot as plt
456454 plt .figure (np .random .randint (9999999 ))
457455 self .plot_divers ()
458456 plt .figure (np .random .randint (9999999 ))
@@ -608,14 +606,14 @@ def plot_stds(self, iabscissa=1):
608606 iteration , countevals , res = self .load (filename )
609607 absciss = countevals if iabscissa else iteration
610608 self ._enter_plotting ()
611- # color = iter(pyplot.cm.plasma_r(np.linspace(0.35, 1, 3)))
609+ # color = iter(pyplot.cm.plasma_r(np.linspace(0.35, 1, 3)))
612610 self ._xlabel (iabscissa )
613611
614612 pyplot .semilogy (absciss , res [0 ])
615613 # pyplot.plot(absciss, res[i],
616614 # '-', color=next(color), label = mylabel[i])
617615 # pyplot.semilogy(absciss, res[i],
618- # '-', color=next(color), label = mylabel[i])
616+ # '-', color=next(color), label = mylabel[i])
619617 # pyplot.hold(True)
620618 pyplot .grid (True )
621619 ax = np .array (pyplot .axis ())
0 commit comments