<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def compute(self, inputs, outputs):
 """ Compute the location based on the 'displacement' and 'anchorInput' by first applying the movement, if 'displacement' is present in the 'input' array and then applying the sensation if 'anchorInput' is present in the input array. The 'anchorGrowthCandidates' input array is used during learning See :meth:`ThresholdedGaussian2DLocationModule.movementCompute` and :meth:`ThresholdedGaussian2DLocationModule.sensoryCompute` """


    if inputs.get("resetIn", False):
      self.reset()
      if self.learningMode:
        # Initialize to random location after reset when learning
        self.activateRandomLocation()

      # send empty output
      outputs["activeCells"][:] = 0
      outputs["learnableCells"][:] = 0
      outputs["sensoryAssociatedCells"][:] = 0
      return

    displacement = inputs.get("displacement", np.array([]))
    anchorInput = inputs.get("anchorInput", np.array([])).nonzero()[0]
    anchorGrowthCandidates = inputs.get("anchorGrowthCandidates", np.array([])).nonzero()[0]

    # Concatenate the output of all modules
    activeCells = np.array([], dtype=np.uint32)
    learnableCells = np.array([], dtype=np.uint32)
    sensoryAssociatedCells = np.array([], dtype=np.uint32)

    # Only process input when data is available
    shouldMove = displacement.any()
    shouldSense = anchorInput.any() or anchorGrowthCandidates.any()

    if shouldMove and len(displacement) != self.dimensions:
      raise TypeError("displacement must have {} dimensions".format(self.dimensions))

    # Handles dual phase movement/sensation processing
    if self.dualPhase:
      if self._sensing:
        shouldMove = False
      else:
        shouldSense = False

      # Toggle between movement and sensation
      self._sensing = not self._sensing

    for i in xrange(self.moduleCount):
      module = self._modules[i]

      # Compute movement
      if shouldMove:
        movement = displacement
        if self.dimensions > 2:
          # Project n-dimension displacements to 2D
          movement = np.matmul(self._projection[i], movement)

        module.movementCompute(movement)

      # Compute sensation
      if shouldSense:
        module.sensoryCompute(anchorInput, anchorGrowthCandidates,
                              self.learningMode)

      # Concatenate outputs
      start = i * self.cellCount
      activeCells = np.append(activeCells,
                              module.getActiveCells() + start)
      learnableCells = np.append(learnableCells,
                                 module.getLearnableCells() + start)
      sensoryAssociatedCells = np.append(sensoryAssociatedCells,
                                         module.getSensoryAssociatedCells() + start)

    outputs["activeCells"][:] = 0
    outputs["activeCells"][activeCells] = 1
    outputs["learnableCells"][:] = 0
    outputs["learnableCells"][learnableCells] = 1
    outputs["sensoryAssociatedCells"][:] = 0
    outputs["sensoryAssociatedCells"][sensoryAssociatedCells] = 1