File: examples-hears_linear_gammachirp.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 (52 lines) | stat: -rw-r--r-- 1,654 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
.. currentmodule:: brian

.. index::
   pair: example usage; plot
   pair: example usage; figure
   pair: example usage; show
   pair: example usage; imshow
   pair: example usage; erbspace
   pair: example usage; linspace
   pair: example usage; whitenoise
   pair: example usage; LinearGammachirp

.. _example-hears_linear_gammachirp:

Example: linear_gammachirp (hears)
==================================

Example of the use of the class :class:`~brian.hears.LinearGammachirp` available
in the library. It implements a filterbank of FIR gammatone filters with linear
frequency sweeps as described in Wagner et al. 2009, "Auditory responses in the
barn owl's nucleus laminaris to clicks: impulse response and signal analysis of
neurophonic potential", J. Neurophysiol. In this example, a white noise is
filtered by a gammachirp filterbank and the resulting cochleogram is plotted.
The different impulse responses are also plotted.

::

    from brian import *
    from brian.hears import *
    
    sound = whitenoise(100*ms).ramp()
    sound.level = 50*dB
    
    nbr_center_frequencies = 10  #number of frequency channels in the filterbank
    #center frequencies with a spacing following an ERB scale
    center_frequencies = erbspace(100*Hz, 1000*Hz, nbr_center_frequencies)
    
    c = 0.0 #glide slope
    time_constant = linspace(3, 0.3, nbr_center_frequencies)*ms
    
    gamma_chirp = LinearGammachirp(sound, center_frequencies, time_constant, c) 
    
    gamma_chirp_mon = gamma_chirp.process()
    
    figure()
    
    imshow(gamma_chirp_mon.T, aspect='auto')    
    figure()
    plot(gamma_chirp.impulse_response.T)
    show()