Show the code
from brian2 import *
from brian2hears import *
import matplotlib.pyplot as plt
For more information, see Brian documentation.
from brian2 import *
from brian2hears import *
import matplotlib.pyplot as plt
= loadsound('data/400_600_1600_hz.wav')
sound
# Inner hair cell model
= 20*Hz, 20*kHz, 3000 # was 3000
cfmin, cfmax, cfN = erbspace(cfmin, cfmax, cfN)
cf = Gammatone(sound, cf)
gfb = FunctionFilterbank(gfb, lambda x: 3*clip(x, 0, Inf)**(1.0/3.0))
ihc # Leaky integrate-and-fire model with noise and refractoriness
= '''
eqs dv/dt = (I-v)/(1*ms)+0.2*xi*(2/(1*ms))**.5 : 1 (unless refractory)
I : 1
'''
= FilterbankGroup(ihc, 'I', eqs, reset='v=0', threshold='v>1', refractory=5*ms)
G # Run, and raster plot of the spikes
= SpikeMonitor(G)
M
run(sound.duration)
# Plot the results
= plt.subplots(figsize=(8.0, 4.0))
fig, ax /ms, M.i, '.', alpha=0.5, color='tab:blue', ms=3)
ax.plot(M.t'Time (ms)')
ax.set_xlabel('Neuron number (inner hair cell)')
ax.set_ylabel(0, 2000)
ylim('Time (ms)')
xlabel('Neuron index');
ylabel( plt.show()
INFO No numerical integration method specified for group 'neurongroup', using method 'euler' (took 0.03s, trying other methods took 0.00s). [brian2.stateupdaters.base.method_choice]