Ejemplo n.º 1
0
 def __init__(self, source, cf):
     CombinedFilterbank.__init__(self, source)
     source = self.get_modified_source()
     
     ## Saturation
     saturation = FunctionFilterbank(source, saturation_fc,
                                     A0=0.1, B=2000, C=1.74, D=6.87e-9)
     ## low pass IHC
     ihc = LowPass_IHC(saturation, cf, 3800, 1, 7)
     self.set_output(ihc)
Ejemplo n.º 2
0
    def __init__(self, source, cf, update_interval=1, param=None):
        CombinedFilterbank.__init__(self, source)
        source = self.get_modified_source()       
        cf = np.atleast_1d(cf)

        parameters=set_parameters(cf,param)        
        
        signal = TanCarneySignal(source, cf, update_interval, parameters)
        ihc = TanCarneyIHC(signal, cf)
        
        self.set_output(ihc)
Ejemplo n.º 3
0
    def __init__(self, source, cf, update_interval, param=None):

        CombinedFilterbank.__init__(self, source)
        source = self.get_modified_source()       
        cf = np.atleast_1d(cf)
        parameters = set_parameters(cf, param)
        samplerate=source.samplerate

        if int(source.samplerate)!=50000:
            warnings.warn('To use the TanCarney cochlear model the sample rate should be 50kHz')
        
        # band pass filter
        signal_coef = Signal_Coefficients(cf, samplerate,parameters)
        [filt_b,filt_a] = signal_coef.return_coefficients(np.zeros((1,len(cf))))
        BP_signal = LinearFilterbank(source,filt_b,filt_a)
        
        control_output = TanCarneyControl(source, cf, update_interval, parameters)
        
        updater = Filter_Update(BP_signal, signal_coef) #instantiation of the updater for the signal path
        output = ControlFilterbank(BP_signal, control_output, BP_signal,
                                   updater, update_interval)  #controler for the band pass filter of the signal path

        self.set_output(output)
Ejemplo n.º 4
0
    def __init__(self, source, cf, update_interval, param=None):
        CombinedFilterbank.__init__(self, source)
        source = self.get_modified_source()       
        cf = np.atleast_1d(cf)
        samplerate=source.samplerate
        parameters = set_parameters(cf, param)
        ##### Control Path ####
        # band pass filter
        control_coef = Control_Coefficients(cf, samplerate)
        [filt_b,filt_a] = control_coef.return_coefficients(np.zeros((1,len(cf))))        
        BP_control = LinearFilterbank(source,filt_b,filt_a)
                
        # first non linearity of control path
        Acp,Bcp,Ccp=100.,2.5,0.60 
        func_NL1_control=lambda x:np.sign(x)*Bcp*np.log(1.+Acp*abs(x)**Ccp)
        NL1_control=FunctionFilterbank(BP_control,func_NL1_control)
                
        # second non linearity of control path
        asym,s0,x1,s1=7.,8.,5.,3. 
        shift = 1./(1.+asym)
        x0 = s0*np.log((1.0/shift-1)/(1+np.exp(x1/s1)))
        func_NL2_control=lambda x:(1.0/(1.0+np.exp(-(x-x0)/s0)*(1.0+np.exp(-(x-x1)/s1)))-shift)*parameters['nlgain']
        NL2_control=FunctionFilterbank(NL1_control,func_NL2_control)

        #control low pass filter (its output will be used to control the signal path)
        gain_lp_con = (2*pi*parameters['fc_LP_control'])**3*1.5
        LP_control = LowPass_filter(NL2_control,cf,parameters['fc_LP_control'],gain_lp_con,3)   
        #low pass filter for feedback to control band pass (its output will be used to control the control path)
        gain_lp_fb = parameters['fc_LP_fb']*2*pi*10
        LP_feed_back = LowPass_filter(LP_control,cf,parameters['fc_LP_fb'],gain_lp_fb,1)
        
        updater = Filter_Update(BP_control, control_coef) #instantiation of the updater for the control path
        output = ControlFilterbank(LP_control, LP_feed_back, BP_control,
                                   updater, update_interval)  #controler for the band pass filter of the control path
                 
        self.set_output(output)