def computePWCorrelationsWithinCol(spikeTrains, removeAutoCorr, cellsPerColumn):
  """
  Computes pairwise correlations from spikeTrains
  
  @param spikeTrains (array) spike trains obtained from the activation of cells in the TM
     the array dimensions are: numCells x timeSteps
  @param removeAutoCorr (boolean) if true, auto-correlations are removed by substracting
     the diagonal of the correlation matrix
  @param cellsPerColumn (int) number of cells per column in thr TM
  @return corrMatrix (array) numCells x numCells matrix containing the Pearson correlation
      coefficient of spike trains of cell i and cell j
  @return numNegPCC (int) number of negative pairwise correlations (PCC(i,j) < 0)
  """
  numCells = np.shape(spikeTrains)[0]
  numCols = numCells / cellsPerColumn
  corrMatrix = np.zeros((numCells, numCells))
  numNegPCC = 0
  indices = np.zeros(cellsPerColumn, dtype="uint32")
  
  for col in range(numCols):
    for k in range(cellsPerColumn):
      indices[k] = (cellsPerColumn * col) + k
    for i in indices:
      for j in indices:
        if i == j and removeAutoCorr == True:
          continue
        if not all(spikeTrains[i,:] == 0) and not all(spikeTrains[j,:] == 0):          
          corrMatrix[i,j] = np.corrcoef(spikeTrains[i,:], spikeTrains[j,:])[0,1]  
          if corrMatrix[i,j] < 0:
            numNegPCC += 1
          
  return (corrMatrix, numNegPCC)
Computes pairwise correlations from spikeTrains
  
  @param spikeTrains (array) spike trains obtained from the activation of cells in the TM
     the array dimensions are: numCells x timeSteps
  @param removeAutoCorr (boolean) if true, auto-correlations are removed by substracting
     the diagonal of the correlation matrix
  @param cellsPerColumn (int) number of cells per column in thr TM
  @return corrMatrix (array) numCells x numCells matrix containing the Pearson correlation
      coefficient of spike trains of cell i and cell j
  @return numNegPCC (int) number of negative pairwise correlations (PCC(i,j) < 0)