Define the value of part,
use the value in part in turn using a loop
for i in part:
x = spike[i:i+scale,:]
At this time an error occurs.
The variable i can be forced to int to solve it.
for i in part:
x = spike[int(i):int(i+scale),:]