original_docstring: Plot a heat map comparing the adaptive tree variations.
  
      @param store: A dictionary mapping machine name -> mbench results
      
docstring: Plot a heat map comparing the adaptive tree variations.
docstring_tokens: Plot a heat map comparing the adaptive tree variations .
code: def plot_heatmap(store):
      """Plot a heat map comparing the adaptive tree variations.
  
      @param store: A dictionary mapping machine name -> mbench results
      """
      topos = set([v for _, v in list([ v for _, v in list(store.items()) ][0].items()) ][0].keys())
      topos = [ t for t in topos if 'adaptive' in t ]
  
      machines = list(store.keys())
      algo = 'ab'
      normalize = 'adaptivetree-nomm-shuffle-sort'
  
      topos = [ t for t in topos if not t == normalize ]
  
  
      # Assign a x-axis position for each machine, based on sorted num_cores array
      num_cores_used = { m: c for (m, c) in list(num_cores.items()) if m in machines }
      num_cores_ordered = { machine: idx for ((machine, numcores), idx) in \
                            zip(sorted(list(num_cores_used.items()), key=lambda x: x[1]), \
                                list(range(len(num_cores_used)))) }
  
      # make these smaller to increase the resolution
      dx, dy = 1.0, 1.0 # 0.15, 0.05
  
      # generate grid for the x & y bounds
      Y, X = np.mgrid[slice(0, len(topos)+1, dy),
                      slice(0, len(machines)+1, dx)]
  
      z = np.zeros((len(topos), len(machines)), dtype=np.float)
  
      l_machines = [ None for i in range(len(machines)) ]
  
      for m in machines:
  
          assert m in num_cores_ordered
          _x = num_cores_ordered[m]
  
          l_machines[_x] = machine_name_translation(m)
  
          for i,t in enumerate(topos):
              v, _, _ = store[m][algo][t]
              ref, _, _ = store[m][algo][normalize] # should be smaller
              z[i,_x] = v/ref # should be > ref
  
      # Maximum distance from 1.0
      z_min, z_max = np.min(z), np.max(z)
      z_min = abs(1-z_min)
      z_max = abs(1-z_max)
      z_dist = max(z_min, z_max)
  
      z_dist = MAX_Z_DIFF
  
      f = 'ab-bench-adaptive-heatmap'
      with PdfPages(f + '.pdf') as pdf:
  
          fig, ax = plt.subplots()
  
          ## Add measurements to heatmap
          for x in range(0,len(machines)):
              for y in range(0, len(topos)):
                  color = 'black'
                  plt.text(x + 0.5, y + 0.5, '%.2f' % (z[y][x]),
                           horizontalalignment='center',
                           verticalalignment='center',
                           color=color,
                           fontproperties=prop)
  
  
          plt.pcolor(X, Y, z, cmap=tab_cmap, vmin=1-z_dist, vmax=1+z_dist)
          plt.colorbar()
  
          ax.set_xticks([ i + 0.5 for i in range(len(machines))])
          ax.set_xticklabels(l_machines)
  
          ax.set_yticks([ i + 0.5 for i in range(len(topos))])
          ax.set_yticklabels(topos)
  
          ax.set_xlim(xmin=0,xmax=len(machines))
          ax.set_ylim(ymin=0,ymax=len(topos))
  
          fig.autofmt_xdate() # rotate x-labels
          plt.tight_layout() # re-create bounding-box
  
          fout = f + '.png'
          plt.savefig(fout)
          pdf.savefig(bbox_inches='tight')
code_tokens: def plot_heatmap ( store ) : topos = set ( [ v for _ , v in list ( [ v for _ , v in list ( store . items ( ) ) ] [ 0 ] . items ( ) ) ] [ 0 ] . keys ( ) ) topos = [ t for t in topos if 'adaptive' in t ] machines = list ( store . keys ( ) ) algo = 'ab' normalize = 'adaptivetree-nomm-shuffle-sort' topos = [ t for t in topos if not t == normalize ] num_cores_used = { m : c for ( m , c ) in list ( num_cores . items ( ) ) if m in machines } num_cores_ordered = { machine : idx for ( ( machine , numcores ) , idx ) in zip ( sorted ( list ( num_cores_used . items ( ) ) , key = lambda x : x [ 1 ] ) , list ( range ( len ( num_cores_used ) ) ) ) } dx , dy = 1.0 , 1.0 Y , X = np . mgrid [ slice ( 0 , len ( topos ) + 1 , dy ) , slice ( 0 , len ( machines ) + 1 , dx ) ] z = np . zeros ( ( len ( topos ) , len ( machines ) ) , dtype = np . float ) l_machines = [ None for i in range ( len ( machines ) ) ] for m in machines : assert m in num_cores_ordered _x = num_cores_ordered [ m ] l_machines [ _x ] = machine_name_translation ( m ) for i , t in enumerate ( topos ) : v , _ , _ = store [ m ] [ algo ] [ t ] ref , _ , _ = store [ m ] [ algo ] [ normalize ] z [ i , _x ] = v / ref z_min , z_max = np . min ( z ) , np . max ( z ) z_min = abs ( 1 - z_min ) z_max = abs ( 1 - z_max ) z_dist = max ( z_min , z_max ) z_dist = MAX_Z_DIFF f = 'ab-bench-adaptive-heatmap' with PdfPages ( f + '.pdf' ) as pdf : fig , ax = plt . subplots ( ) for x in range ( 0 , len ( machines ) ) : for y in range ( 0 , len ( topos ) ) : color = 'black' plt . text ( x + 0.5 , y + 0.5 , '%.2f' % ( z [ y ] [ x ] ) , horizontalalignment = 'center' , verticalalignment = 'center' , color = color , fontproperties = prop ) plt . pcolor ( X , Y , z , cmap = tab_cmap , vmin = 1 - z_dist , vmax = 1 + z_dist ) plt . colorbar ( ) ax . set_xticks ( [ i + 0.5 for i in range ( len ( machines ) ) ] ) ax . set_xticklabels ( l_machines ) ax . set_yticks ( [ i + 0.5 for i in range ( len ( topos ) ) ] ) ax . set_yticklabels ( topos ) ax . set_xlim ( xmin = 0 , xmax = len ( machines ) ) ax . set_ylim ( ymin = 0 , ymax = len ( topos ) ) fig . autofmt_xdate ( ) plt . tight_layout ( ) fout = f + '.png' plt . savefig ( fout ) pdf . savefig ( bbox_inches = 'tight' )
short_docstring: Plot a heat map comparing the adaptive tree variations.
short_docstring_tokens: Plot a heat map comparing the adaptive tree variations .
comment: """Plot a heat map comparing the adaptive tree variations.
  
      @param store: A dictionary mapping machine name -> mbench results
      """$SEP$# Assign a x-axis position for each machine, based on sorted num_cores array$SEP$# make these smaller to increase the resolution$SEP$# 0.15, 0.05$SEP$# generate grid for the x & y bounds$SEP$# should be smaller$SEP$# should be > ref$SEP$# Maximum distance from 1.0$SEP$## Add measurements to heatmap$SEP$# rotate x-labels$SEP$# re-create bounding-box