%matplotlib inline
from __future__ import division, print_function, absolute_import
import numpy as np
import scipy.signal as dsp
import pandas as pd
import matplotlib.pyplot as plt
import cochlea
import cochlea.stats
import thorns as th
import thorns.waves as wv
fs = 100e3
cf = 1000
tone = wv.ramped_tone(
fs=fs,
freq=1000,
duration=0.1,
dbspl=50
)
wv.plot_signal(tone, fs)
<matplotlib.axes.AxesSubplot at 0x7f2ddd6d5090>
anf_trains = cochlea.run_zilany2014(
tone,
fs,
anf_num=(200,0,0),
cf=cf,
seed=0,
species='cat'
)
th.plot_raster(anf_trains)
<matplotlib.axes.AxesSubplot at 0x7f2ddd0da850>
t = np.arange(0, 0.05, 1/fs)
chirp = dsp.chirp(t, 80, t[-1], 8000)
chirp = cochlea.set_dbspl(chirp, 50)
wv.plot_signal(chirp, fs)
<matplotlib.axes.AxesSubplot at 0x7f2ddcb876d0>
anf_trains = cochlea.run_zilany2014(
chirp,
fs,
anf_num=(0,0,50),
cf=(125, 10e3, 100),
seed=0,
species='human'
)
th.plot_raster(th.accumulate(anf_trains))
<matplotlib.axes.AxesSubplot at 0x7f2ddcabbd90>
rates = cochlea.stats.calc_rate_level(
model=cochlea.run_zilany2014,
cf=1000,
model_pars={'fs': 100e3, 'species': 'human'}
)
_run_model [OOOOOOOOOOOOOOOOOOOO] 22/0/0 0:00:00.125618
rates.plot()
<matplotlib.axes.AxesSubplot at 0x7f2ddc77b2d0>