File: examples-hears_cochlear_models.txt

package info (click to toggle)
brian 1.4.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 23,436 kB
  • sloc: python: 68,707; cpp: 29,040; ansic: 5,182; sh: 111; makefile: 61
file content (53 lines) | stat: -rw-r--r-- 1,454 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
.. currentmodule:: brian

.. index::
   pair: example usage; figure
   pair: example usage; show
   pair: example usage; flipud
   pair: example usage; imshow
   pair: example usage; TanCarney
   pair: example usage; erbspace
   pair: example usage; set_default_samplerate
   pair: example usage; whitenoise

.. _example-hears_cochlear_models:

Example: cochlear_models (hears)
================================

Example of the use of the cochlear models (:class:`~brian.hears.DRNL`,
:class:`~brian.hears.DCGC` and :class:`~brian.hears.TanCarney`) available in the library.

::

    from brian import *
    from brian.hears import *
    
    simulation_duration = 50*ms
    set_default_samplerate(50*kHz)
    sound = whitenoise(simulation_duration)
    sound = sound.atlevel(50*dB) # level in rms dB SPL
    cf = erbspace(100*Hz, 1000*Hz, 50) # centre frequencies
    interval = 16  #update interval of the time varying filters
    ## DNRL
    #param_drnl = {}
    #param_drnl['lp_nl_cutoff_m'] = 1.1
    #drnl_filter=DRNL(sound, cf, type='human', param=param_drnl)
    #out = drnl_filter.process()
    
    ## DCGC
    #param_dcgc = {}
    #param_dcgc['c1'] = -2.96
    
    #dcgc_filter = DCGC(sound, cf, interval, param=param_dcgc)
    #out = dcgc_filter.process()
    
    ## Tan and Carney 2003
    tan_filter = TanCarney(sound, cf, interval)
    out = tan_filter.process()
    
    figure()
    imshow(flipud(out.T), aspect='auto')
    show()