<commit_before>import pylab
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import numpy as np

BIOSEMI_32_LOCS = {
  'AF3': (-0.409, 0.87, 0.280), 'AF4': (0.409, 0.87, 0.280),
  'C3': (-0.719, 0.0, 0.689), 'C4': (0.719, 0.0, 0.689),
  'CP1': (-0.37, -0.37, 0.849), 'CP2': (0.37, -0.37, 0.849),
  'CP5': (-0.890, -0.340, 0.31), 'CP6': (0.890, -0.340, 0.31),
  'Cz': (-0, 0.0, 1.0), 'F3': (-0.550, 0.670, 0.5),
  'F4': (0.550, 0.670, 0.5), 'F7': (-0.810, 0.589, -0.0299),
  'F8': (0.810, 0.589, -0.0299), 'FC1': (-0.37, 0.37, 0.849),
  'FC2': (0.37, 0.37, 0.849), 'FC5': (-0.890, 0.340, 0.31),
  'FC6': (0.890, 0.340, 0.31), 'Fp1': (-0.31, 0.949, -0.0299),
  'Fp2': (0.31, 0.949, -0.0299), 'Fz': (-0, 0.719, 0.689),
  'O1': (-0.31, -0.949, -0.029), 'O2': (0.31, -0.949, -0.029),
  'Oz': (0.0, -1.0, -0.029), 'P3': (-0.550, -0.670, 0.5),
  'P4': (0.550, -0.670, 0.5), 'P7': (-0.810, -0.589, -0.029),
  'P8': (0.810, -0.589, -0.029), 'PO3': (-0.409, -0.87, 0.280),
  'PO4': (0.409, -0.87, 0.280), 'Pz': (0.0, -0.719, 0.689),
  'T7': (-1.0, 0.0, -0.029), 'T8': (1.0, 0.0, -0.0299)}

def plot_scalp(densities, sensors, sensor_locs, show_sensors=True, 
  clim=[None, None]):
  curr_sens = dict([(lab, sensor_locs[lab]) for lab in sensors]) 
  add_density(densities, sensors, curr_sens, cmap=pylab.cm.jet, clim=clim)
  add_head()
  if show_sensors:
    add_sensors(curr_sens)
 
def add_head():
  ax = pylab.gca()
  ax.set_aspect(1.2)

  LINEWIDHT = 2
  nose = [
    (Path.MOVETO, (-.1, 1.)),
    (Path.LINETO, (0, 1.1)),
    (Path.LINETO, (.1, 1.))
    ]

  lear = [
    (Path.MOVETO, (-1, .134)),
    (Path.LINETO, (-1.04, 0.08)),
    (Path.LINETO, (-1.08, -0.11)),
    (Path.LINETO, (-1.06, -0.16)),
    (Path.LINETO, (-1.02, -0.15)),
    (Path.LINETO, (-1, -0.12)),
    ]
  rear = [(c, (-px, py)) for (c, (px, py)) in lear]

  # plot outline
  c = pylab.Circle((0, 0), 1, fill=False, linewidth=LINEWIDHT)
  ax.add_artist(c)

  # add nose and ears
  for p in [nose, lear, rear]:<commit_msg>Added cmap arg to plot_scalp.<commit_after>import pylab
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import numpy as np

BIOSEMI_32_LOCS = {
  'AF3': (-0.409, 0.87, 0.280), 'AF4': (0.409, 0.87, 0.280),
  'C3': (-0.719, 0.0, 0.689), 'C4': (0.719, 0.0, 0.689),
  'CP1': (-0.37, -0.37, 0.849), 'CP2': (0.37, -0.37, 0.849),
  'CP5': (-0.890, -0.340, 0.31), 'CP6': (0.890, -0.340, 0.31),
  'Cz': (-0, 0.0, 1.0), 'F3': (-0.550, 0.670, 0.5),
  'F4': (0.550, 0.670, 0.5), 'F7': (-0.810, 0.589, -0.0299),
  'F8': (0.810, 0.589, -0.0299), 'FC1': (-0.37, 0.37, 0.849),
  'FC2': (0.37, 0.37, 0.849), 'FC5': (-0.890, 0.340, 0.31),
  'FC6': (0.890, 0.340, 0.31), 'Fp1': (-0.31, 0.949, -0.0299),
  'Fp2': (0.31, 0.949, -0.0299), 'Fz': (-0, 0.719, 0.689),
  'O1': (-0.31, -0.949, -0.029), 'O2': (0.31, -0.949, -0.029),
  'Oz': (0.0, -1.0, -0.029), 'P3': (-0.550, -0.670, 0.5),
  'P4': (0.550, -0.670, 0.5), 'P7': (-0.810, -0.589, -0.029),
  'P8': (0.810, -0.589, -0.029), 'PO3': (-0.409, -0.87, 0.280),
  'PO4': (0.409, -0.87, 0.280), 'Pz': (0.0, -0.719, 0.689),
  'T7': (-1.0, 0.0, -0.029), 'T8': (1.0, 0.0, -0.0299)}

def plot_scalp(densities, sensors, sensor_locs, show_sensors=False, 
  cmap=pylab.cm.jet, clim=[None, None]):
  curr_sens = dict([(lab, sensor_locs[lab]) for lab in sensors]) 
  add_density(densities, sensors, curr_sens, cmap=cmap, clim=clim)
  add_head()
  if show_sensors:
    add_sensors(curr_sens)
 
def add_head():
  ax = pylab.gca()
  ax.set_aspect(1.2)

  LINEWIDHT = 2
  nose = [
    (Path.MOVETO, (-.1, 1.)),
    (Path.LINETO, (0, 1.1)),
    (Path.LINETO, (.1, 1.))
    ]

  lear = [
    (Path.MOVETO, (-1, .134)),
    (Path.LINETO, (-1.04, 0.08)),
    (Path.LINETO, (-1.08, -0.11)),
    (Path.LINETO, (-1.06, -0.16)),
    (Path.LINETO, (-1.02, -0.15)),
    (Path.LINETO, (-1, -0.12)),
    ]
  rear = [(c, (-px, py)) for (c, (px, py)) in lear]

  # plot outline
  c = pylab.Circle((0, 0), 1, fill=False, linewidth=LINEWIDHT)
  ax.add_artist(c)

  # add nose and ears
  for p in [nose, lear, rear]:
{'fraction_non_alphanumeric': 0.2911111111111111, 'fraction_numerical': 0.20148148148148148, 'mean_word_length': 2.679382379654859, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3786454', 'n_tokens_mistral': 2565, 'n_tokens_neox': 2167, 'n_words': 466}