21 Plots data for two dimensional sweeps    23 from __future__ 
import division
    25 from builtins 
import range
    26 from past.utils 
import old_div
    29 parser = argparse.ArgumentParser(description=
'Plot two-dimensional images')
    32 parser.add_argument(
"--zmin", type=float, help=
"minimal z-value")
    33 parser.add_argument(
"--zmax", type=float, help=
"maximal z-value")
    35     "-nl", type=int, help=
"Number of levels/ticks in z", default=11)
    36 parser.add_argument(
"-q", help=
"qualitative Colormap",  action=
"store_true")
    37 parser.add_argument(
"-c", help=
"draw contour lines",  action=
"store_true")
    41 parser.add_argument(
"-z", type=int, required=
True, help=
"Column of z-values")
    42 parser.add_argument(
"files", metavar=
"Files", nargs=
'+',  help=
"files to plot")
    44 args = parser.parse_args()
    47 import matplotlib.pyplot 
as plt
    48 import matplotlib.colorbar
    51 from dim_labels 
import *
    63     while temp < divisable:
    66     if temp % divisable == 0:
    68     res = old_div((temp - (temp % divisable) + divisable), (10.0**a))
    74 def plot_measure2d(xs, ys, zs, xlabel, ylabel, zlabel="", zmin=None,
    75                    zmax=
None, qualitative=
False, contour=
True, title=
None):
    78     ax1 = fig.add_axes([0.0, 0.25, 1.0, 0.85])
    81     ax2 = fig.add_axes([0.0, 0.0, 1.0, 0.05])
    84     _, steps_x = np.unique(xs, return_counts=
True)
    85     _, steps_y = np.unique(ys, return_counts=
True)
    86     steps_x = np.max(steps_x)
    87     steps_y = np.max(steps_y)
    88     xs = xs.reshape((steps_y, steps_x))
    89     ys = ys.reshape((steps_y, steps_x))
    90     zs = zs.reshape((steps_y, steps_x))
    94     idcs = np.isfinite(zs)
    98         zmin = np.min(zs[idcs])
   112         cmap = plt.cm.rainbow
   117     cmap.set_bad(
'black', 1.)
   119     extent = (np.min(xs), np.max(xs), np.min(ys), np.max(ys))
   120     ax1.imshow(zs, aspect=
'auto', origin=
'lower', extent=extent, cmap=cmap,
   121                vmin=zmin, vmax=zmax, interpolation=
"none")
   123     levels = np.linspace(zmin, zmax, args.nl)
   126         CS2 = ax1.contour(xs, ys, zs, levels, linewidths=0.25,
   127                           colors=
'k', vmin=zmin, vmax=zmax)
   128     ax1.grid(color=
'black', linestyle=
':', linewidth=0.25)
   129     ax1.set_xlabel(xlabel)
   130     ax1.set_ylabel(ylabel)
   131     cbar = matplotlib.colorbar.ColorbarBase(ax2, cmap=cmap,
   132                                             orientation=
'horizontal', ticks=levels,
   133                                             norm=matplotlib.colors.Normalize(zmin, zmax))
   134     cbar.set_label(zlabel)
   138 if not os.path.exists(
"images"):
   141 for target_file 
in args.files:
   142     simulator = target_file.split(
'_')[-1].split(
'.csv')[0]
   143     experiment = target_file.split(
'/')[-1].split(simulator)[0]
   146     results = np.genfromtxt(target_file, delimiter=
',', names=
True)
   147     keys = results.dtype.names
   148     data = np.zeros((results.shape[0], len(keys)))
   149     for i 
in range(0, len(results)):
   150         data[i] = np.array(list(results[i]))
   154                          zlabel=
get_label(keys[args.z]), zmin=args.zmin,
   155                          zmax=args.zmax, qualitative=args.q, contour=args.c,
   156                          title=SIMULATOR_LABELS[simulator])
   158     if target_file.split(
'/')[-2]:
   159         if not os.path.exists(
"images/" + target_file.split(
'/')[-2]):
   160             os.mkdir(
"images/" + target_file.split(
'/')[-2])
   161         fig.savefig(
"images/" + target_file.split(
'/')[-2] + 
"/" +
   162                     experiment + simulator + 
".pdf", format=
'pdf',
   165         fig.savefig(
"images/" + experiment + simulator + 
".pdf", format=
'pdf',
 
def plot_measure2d(xs, ys, zs, xlabel, ylabel, zlabel="", zmin=None, zmax=None, qualitative=False, contour=True, title=None)
def round_to_divisable(value, divisable)