def RenderEvents(vf_time, places):
  """Renders events based on the current time and interval available
  via vf_time.
  """
  # Get circle and draw it.
  c, r, theta = GetCircle(vf_time.GetPos())

  def _GetArcCoords(radians):
    """Returns the coordinates on the arc for the specified angle."""
    return [c[0] + r*math.cos(radians), c[1] + r*math.sin(radians)]

  def _GetTimestamp(radians):
    """Gets timestamp implied by moving to 'radians' degrees on the arc."""
    return vf_time.ComputeTimeAtPos(_GetArcCoords(radians))

  def _ApproximateAngle(timestamp, x, x1):
    """Determines the position along the arc of the specified timestamp
    via numeric approximation (Secant Method).
    """
    def f(x):
      return _GetTimestamp(x) - timestamp
    error = 1  # get within 1 pixel
    x2 = 0
    for attempt in xrange(20):
      d = f(x1) - f(x)
      if d < error:
        return x1
      x2 = x1 - f(x1) * (x1 - x) / d
      x = x1
      x1 = x2
      dx = x1 - x
    assert False, 'could not converge on position'

  def _ComputeDecay(distance, half_distance):
    return math.exp(-math.log(2.0) * distance / half_distance)

  interval = vf_time.GetInterval()
  combined_places = CombinePlaces(places, float(interval[1] - interval[0]) / 24)
  start_angle = math.pi - theta / 2
  end_angle = math.pi + theta / 2
  text_height = 16.0
  half_distance = 12.0

  places = []
  for p in combined_places:
    place_angle = _ApproximateAngle(p['timestamp'], start_angle, end_angle)
    if place_angle > start_angle and place_angle < end_angle:
      p['x'], p['y'] = _GetArcCoords(place_angle)
      places.append(p)

  # For each place, compute the rank in the 'neighborhood'.
  for p in places:
    y = p['y']
    sub_places = [sp for sp in places if sp['y'] > (y - text_height) and sp['y'] < (y + text_height)]
    max_count = max([sp['total_count'] for sp in sub_places])
    total_weight = 0
    for sp in sub_places:
      total_weight += (float(sp['total_count']) / max_count) * _ComputeDecay(abs(sp['y'] - y), half_distance)
    p['weight'] = (float(p['total_count']) / max_count) / total_weight

  if places:
    min_weight = min(p['weight'] for p in places)
    max_weight = max(p['weight'] for p in places)
    sorted_places = sorted(places, key=itemgetter('weight'))
    for p in sorted_places:
      if min_weight == max_weight:
        opacity = 1.0
      else:
        opacity = (max_weight - min_weight) / (p['weight'] - min_weight)
      DrawLabel('%s' % (p['locality']), p['x'], p['y'], place_color,
                font, 1.0 - opacity, left_justify=True)
dataset/ETHPy150Open viewfinderco/viewfinder/clients/experimental/viewfinder.py/RenderEvents/swapped operands of `/`