'Randomly spikify underlying rates according a Poisson distribution
Args:
rates_bxtxd: a numpy tensor with shape:
Returns:
A numpy array with the same shape as rates_bxtxd, but with the event
counts.'

@staticmethod
def spikify_rates(rates_bxtxd):

    (B, T, N) = rates_bxtxd.shape
    assert all([(B > 0), (N > 0)]), 'problems'
    spikes_bxtxd = np.zeros([B, T, N], dtype=np.int32)
    for b in range(B):
        for t in range(T):
            for n in range(N):
                rate = rates_bxtxd[(b, t, n)]
                count = np.random.poisson(rate)
                spikes_bxtxd[(b, t, n)] = count
    return spikes_bxtxd
