def main(): fs = 48e3 ### Make sound tmax = 0.03 t = np.arange(0, tmax, 1 / fs) s = dsp.chirp(t, 80, t[-1], 16000) sound = cochlea.set_dbspl(s, 50) ### Run model anf = run_matlab_auditory_periphery( sound, fs, anf_num=(100, 50, 20), cf=(125, 16000, 80), seed=0, ) ### Accumulate spike trains anf_acc = th.accumulate(anf, keep=['cf', 'duration']) anf_acc.sort('cf', ascending=False, inplace=True) ### Plot auditory nerve response fig, ax = plt.subplots(2, 1, sharex=True) th.plot_signal(signal=sound, fs=fs, ax=ax[0]) th.plot_neurogram(anf_acc, fs, ax=ax[1]) plt.show()
def main(): fs = 100e3 ### Make sound t = np.arange(0, 0.1, 1 / fs) s = dsp.chirp(t, 80, t[-1], 20000) s = cochlea.set_dbspl(s, 50) pad = np.zeros(10e-3 * fs) sound = np.concatenate((s, pad)) ### Run model anf = cochlea.run_zilany2014( sound, fs, anf_num=(100, 0, 0), cf=(125, 20000, 100), seed=0, powerlaw="approximate", species="human" ) ### Accumulate spike trains anf_acc = th.accumulate(anf, keep=["cf", "duration"]) anf_acc.sort("cf", ascending=False, inplace=True) ### Plot auditory nerve response fig, ax = plt.subplots(2, 1) th.plot_signal(signal=sound, fs=fs, ax=ax[0]) th.plot_neurogram(anf_acc, fs, ax=ax[1]) plt.show()
def main(): fs = 48e3 cf = cochlea.get_nearest_cf_holmberg2007(1e3) ### Make sound sound = wv.ramped_tone( fs=fs, freq=cf, duration=150e-3, pad=10e-3, dbspl=70, ) ### Run model anf_trains = sg.run_holmberg2007_sg( sound, fs, cf=cf, anf_num=(10, 0, 0), seed=0, ) print(th.firing_rate(anf_trains)) ### Plot auditory nerve response fig, ax = plt.subplots(2, 1) th.plot_signal(signal=sound, fs=fs, ax=ax[0]) th.plot_raster(anf_trains, ax=ax[1]) plt.show()
def main(): ### Generate the stimulus fs = 10e3 # [Hz] amp = 400e-6 # [A] s = np.zeros(30e-3 * fs) # 30 ms s[100:105] = -amp # [A] s[105:110] = +amp # [A] stim = {3: s, 8: np.roll(s, 100)} ### Run CI simulation trains = sg.run_ci_simulation( stim=stim, fs=fs, anf_num=10, # map_backend='multiprocessing' ) ### Plot results fig, ax = plt.subplots(2, 1, sharex=True) th.plot_signal(stim[3], fs=fs, ax=ax[0]) th.plot_signal(stim[8], fs=fs, ax=ax[0]) ax[0].set_ylabel("Amplitude [A]") th.plot_raster(trains, ax=ax[1]) plt.show()
def main(): fs = 48e3 ### Make sound t = np.arange(0, 0.1, 1 / fs) s = dsp.chirp(t, 80, t[-1], 20000) s = cochlea.set_dbspl(s, 50) s = np.concatenate((s, np.zeros(int(10e-3 * fs)))) ### Run model anf_trains = cochlea.run_holmberg2007( s, fs, anf_num=(100, 0, 0), seed=0, ) ### Plot auditory nerve response anf_acc = th.accumulate(anf_trains, keep=['cf', 'duration']) anf_acc.sort('cf', ascending=False, inplace=True) fig, ax = plt.subplots(2, 1) th.plot_signal(signal=s, fs=fs, ax=ax[0]) th.plot_neurogram(anf_acc, fs, ax=ax[1]) plt.show()
def main(): fs = 100e3 cf = 500 convergence = (35, 0, 0) # Generate sound sound = wv.ramped_tone(fs=fs, freq=cf, duration=50e-3, pad=30e-3, dbspl=50) # Run inner ear model anf_trains = cochlea.run_zilany2014(sound=sound, fs=fs, cf=cf, anf_num=convergence, species='cat', seed=0) # Run GBC cn.set_celsius(37) cn.set_fs(fs) gbc = cn.GBC_Point(convergence=convergence, cf=cf, endbulb_class='tonic', record_voltages=True) gbc.load_anf_trains(anf_trains, seed=0) cn.run(duration=len(sound) / fs, objects=[gbc]) # Collect the results gbc_trains = gbc.get_trains() voltages = gbc.get_voltages() # Present the results print(gbc_trains) fig, ax = plt.subplots(2, 1) th.plot_raster(anf_trains, ax=ax[0]) ax[0].set_title("ANF input") th.plot_signal(voltages, fs=fs, ax=ax[1]) th.show()
def main(): fs = 48e3 ### Make sound tmax = 0.03 t = np.arange(0, tmax, 1/fs) s = dsp.chirp(t, 80, t[-1], 16000) sound = cochlea.set_dbspl(s, 50) ### Run model anf = run_matlab_auditory_periphery( sound, fs, anf_num=(100,50,20), cf=(125, 16000, 80), seed=0, ) ### Accumulate spike trains anf_acc = th.accumulate(anf, keep=['cf', 'duration']) anf_acc.sort('cf', ascending=False, inplace=True) ### Plot auditory nerve response fig, ax = plt.subplots(2, 1, sharex=True) th.plot_signal( signal=sound, fs=fs, ax=ax[0] ) th.plot_neurogram( anf_acc, fs, ax=ax[1] ) plt.show()
def main(): fs = 100e3 # Make sound t = np.arange(0, 0.1, 1/fs) s = dsp.chirp(t, 80, t[-1], 20000) s = cochlea.set_dbspl(s, 50) pad = np.zeros(int(10e-3 * fs)) sound = np.concatenate( (s, pad) ) # Run model anf = cochlea.run_zilany2014( sound, fs, anf_num=(100,0,0), cf=(125, 20000, 100), seed=0, powerlaw='approximate', species='human', ) # Accumulate spike trains anf_acc = th.accumulate(anf, keep=['cf', 'duration']) anf_acc.sort_values('cf', ascending=False, inplace=True) # Plot auditory nerve response fig, ax = plt.subplots(2,1) th.plot_signal( signal=sound, fs=fs, ax=ax[0] ) th.plot_neurogram( anf_acc, fs, ax=ax[1] ) plt.show()
def main(): fs = 48e3 ### Make sound t = np.arange(0, 0.1, 1/fs) s = dsp.chirp(t, 80, t[-1], 20000) s = cochlea.set_dbspl(s, 50) s = np.concatenate( (s, np.zeros(10e-3 * fs)) ) ### Run model anf_trains = cochlea.run_holmberg2007( s, fs, anf_num=(100,0,0), seed=0, ) ### Plot auditory nerve response anf_acc = th.accumulate(anf_trains, keep=['cf', 'duration']) anf_acc.sort('cf', ascending=False, inplace=True) fig, ax = plt.subplots(2,1) th.plot_signal( signal=s, fs=fs, ax=ax[0] ) th.plot_neurogram( anf_acc, fs, ax=ax[1] ) plt.show()