Пример #1
0
def make_lp_noise(n,f_c_noise,rate):
    # load experiment parameters
    a,b = filt.make_low_pass_butterworth(f_c_noise, 6,rate) 
    N = 0 # to cut begining of filter convolution
    wn = np.random.randn(n+N) # generate white noise
    fwn = filt.apply_filter(wn,a,b)
    return normalize(fwn[-n:]) 
Пример #2
0
def ABABl(f,l,timbre,t,fs):
    Np = int(fs/f/2.*0.8)
    A = np.random.randn(Np)
    B = np.random.randn(Np)
    C = l*A+(1-l)*B
    y = ABAB(A,C,f,t)
    (af,bf) = filt.make_low_pass_butterworth(timbre, 6,fs)
    y = filt.apply_filter(y,af,bf)
    return y[0:len(t)]
Пример #3
0
def make_act_control(ratio,f,timbre,exp):
    # loading parameters
    duration_stim = exp.duration_stim
    rate = exp.rate
    # function
    time_stim = make_time(duration_stim,rate)
    #fir,N,nyq_rate = filt.make_low_pass_FIR(f_c,f_w,rate)

    if (timbre == exp.DARK):
        f_c = exp.fc_ACT_DARK
        a,b = filt.make_low_pass_butterworth(f_c, 6,rate)  
        x= filt.apply_filter(act(0,1/float(ratio),f,time_stim),a,b)
        y= filt.apply_filter(act(1,1/float(ratio),f,time_stim),a,b)
        return np.divide(x,np.std(y)) # cross normalization
    if (timbre == exp.BROAD):
        x= act(0,1/float(ratio),f,time_stim)
        y= act(1,1/float(ratio),f,time_stim)
        return np.divide(x,np.std(y)) # cross normalization
Пример #4
0
def make_act_target(ratio,f,timbre, exp):
    # loading parameters
    duration_stim = exp.duration_stim
    rate = exp.rate
    # function
    time_stim = make_time(duration_stim,rate)
    #fir,N,nyq_rate = filt.make_low_pass_FIR(f_c,f_w,rate)

    y = act(1,1/float(ratio),f,time_stim)
    if (timbre == exp.DARK):
        f_c = exp.fc_ACT_DARK
        a,b = filt.make_low_pass_butterworth(f_c, 6,rate)  
        z= normalize(filt.apply_filter(y,a,b))
    if (timbre == exp.BROAD):
        z = normalize(y)
    return z