I am trying to make a raster plot from neuronal activity. I starred the time of the neuronal activity in lists. Lets say:
Event1 = [[-.1,0.1,3],[-2,1,4,4.5,4.6,4.9]]
Event2 = [[1,2]]
What I would like in order to make the raster is to get all the elements from each event in a new list. Specifically
raster = [[-.1,0,1,3],[-2,1,4,4.5,4.6,4.9],[1,2]]
I thought into use np.concatenate
but in the cases there is an event like Event2
this shields an error
raster = np.concatenate([Event1,Event2])
ValueError: all the input arrays must have same number of dimensions, but the array at index 0 has 1 dimension(s) and the array at index 1 has 2 dimension(s)
While if for instance Event3 = [[-1,-.1,3],[1,2]]
this performs well
raster = np.concatenate([Event1,Event3])
array([list([-0.1, 0.1, 3]), list([-2, 1, 4, 4.5, 4.6, 4.9]),list([-1, -0.1, 3]), list([1, 2])], dtype=object)
How can I solve this?