def simulate(self, time,
               feedforwardInputI,
               feedforwardInputE,
               v,
               recurrent=True,
               dt=None,
               envelope=False,
               inputNoise=None):
    """
    :param time: Amount of time to simulate.
           Divided into chunks of len dt.
    :param feedforwardInputI: feedforward input to inhibitory cells.  Must have
           shape (numInhibitory,).  Should be total input over period time.
    :param feedforwardInputE: feedforward input to excitatory cells.  Must have
           shape (numExcitatory,).  Applied equally to ER and EL cells.
           Should be total input over period time.
    :param v: Velocity.  Should be a scalar.
    :param recurrent: whether or not recurrent connections should be used.
           Set to False during training to follow the methods of the original
           model.
    """
    # Set up plotting
    if self.plotting:
      self.fig = plt.figure()
      self.ax1 = self.fig.add_subplot(221)
      self.ax2 = self.fig.add_subplot(222)
      self.ax3 = self.fig.add_subplot(223)
      plt.ion()

      self.ax1.set_xlabel("Excitatory population activity")
      self.ax2.set_xlabel("Inhibitory population activity")

      plt.tight_layout()
      self.fig.show()
      self.fig.canvas.draw()

    if self.movie:
      history = []

    self.activationsI = np.random.random_sample(self.activationsI.shape)
    for k, a in self.activations.items():
      self.a = np.random.random_sample(a.shape)

    self.activationsP.fill(0)
    self.activationHistoryI.fill(0)
    residTime = 0.
    for k, a in self.histories.items():
      a.fill(0)

    if dt is None:
      oldDt = self.dt
    else:
      oldDt = self.dt
      self.dt = dt
    times = np.arange(0, time, self.dt)
    for i, t in enumerate(times):
      if inputNoise is not None:
        noisesI = np.random.random_sample(feedforwardInputI.shape)*inputNoise
        noisesE = np.random.random_sample(feedforwardInputE.shape)*inputNoise
      else:
        noisesE = 1.; noisesI = 1.

      self.activationsP = np.zeros(self.activationsP.shape)

      self.update(feedforwardInputI*noisesI, feedforwardInputE*noisesE,
                  v, recurrent, envelope=envelope)

      residTime += self.dt
      if residTime > PLOT_INTERVAL:
        residTime -= PLOT_INTERVAL
        if self.plotting:
          self.plotActivation(time=t, velocity=v)
        if self.movie:
          history.append(np.copy(self.activationsI))
          print(t)

    if self.movie:
      self.createMovie(np.stack(history, -1), "IMovement2D.mp4",
                       self.numInhibitory, self.numPlaces)

    self.dt = oldDt