In [1]:
%matplotlib inline
In [2]:
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
In [3]:
fs = 100e3
cf = 1000
tone = wv.ramped_tone(
fs=fs,
freq=1000,
duration=0.1,
dbspl=50
)
wv.plot_signal(tone, fs)
Out[3]:
In [4]:
anf_trains = cochlea.run_zilany2014(
tone,
fs,
anf_num=(200,0,0),
cf=cf,
seed=0,
species='cat'
)
In [5]:
th.plot_raster(anf_trains)
Out[5]:
In [6]:
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)
Out[6]:
In [7]:
anf_trains = cochlea.run_zilany2014(
chirp,
fs,
anf_num=(0,0,50),
cf=(125, 10e3, 100),
seed=0,
species='human'
)
In [8]:
th.plot_raster(th.accumulate(anf_trains))
Out[8]:
In [9]:
rates = cochlea.stats.calc_rate_intensity(
model=cochlea.run_zilany2014,
cf=1000,
model_pars={'fs': 100e3, 'species': 'human'}
)
In [10]:
rates.plot()
Out[10]: