Untitled
unknown
python
4 years ago
761 B
6
Indexable
def buildBinaryArray(x, N=100000, nSteps=1000): """ Select renormalize data by its mean, taking only nonzero values into account Args: x(numpy array of integers) : timeStamps in (t,neuron_j) form Returns: binary_array(numpy array of integers) : (N,nSteps) array with 1's on spike times t for neuron N """ #ESSA PARTE DAQUI ÓÓÓ binary_array = np.zeros((N,nSteps),dtype=np.int8) for i in range(0,nSteps): idx = np.nonzero(x[:,0]==i) binary_array[x[idx,1],i] = 1 return binary_array a = np.zeros((20,2), dtype=np.int8) a[5:,0] = 1 a[10:,0] = 2 for i in range(0,20): a[i,1] = np.random.randint(1,high=10) binary_array= buildBinaryArray(a,10,3)
Editor is loading...