Example #1
0
def run_WN(photoreceptor, I):

    Z_dictionary = {}
    V_dictionary = {}
    Vl_dictionary = {}
    I_dictionary = {}

    for i, V in enumerate(Vr):
        DepolarisePhotoreceptor.WithLight(photoreceptor, V)
        ## Filtering signal
        print("Processing V=", V, " mV")

        ## Run HH

        print("Running HH...")
        Vm, g = Experiment.inject_current(photoreceptor, I, dt)
        Vl = Linearise.inject_current(photoreceptor, I, dt)
        print("Variance of voltage is ", var(Vm), "mV2")
        ## Calculate impedance

        Vmm = (Vm - mean(Vm))  #without DC
        CPSD = zeros(round(len(time) / 2 + 1), dtype=complex_)
        PSD = zeros(round(len(time) / 2 + 1))
        window = hamming(len(time))
        print("len(window)", len(window))
        for ii in range(repetitions):
            I_cut = I[ii * len(time):(ii + 1) * len(time)]
            V_cut = Vmm[ii * len(time):(ii + 1) * len(time)]
            PSD += power(absolute(rfft(I_cut * window)), 2)
            CPSD += rfft(V_cut * window) * rfft(I_cut * window).conjugate()

        Z = CPSD / PSD  #MOhm

        Z_dictionary[V] = Z
        I_dictionary[V] = I[sample * len(time):(sample + 1) * len(time)]
        V_dictionary[V] = Vm[sample * len(time):(sample + 1) * len(time)]
        Vl_dictionary[V] = Vl[sample * len(time):(sample + 1) * len(time)]
    return (Z_dictionary, V_dictionary, Vl_dictionary, I_dictionary)
Example #2
0
    for ii, condition in enumerate(conditions):
        photoreceptor = FlyFactory.DrosophilaR16(shift="none")
        DepolarisePhotoreceptor.WithLight(photoreceptor, V=V)
        if condition == 'PIP2':
            ShiftConductances.WithLight(photoreceptor,
                                        change_LIC_to_keep_depolarisation=
                                        change_LIC_to_keep_depolarisation)
        elif condition == 'Serotonin':
            ShiftConductances.WithSerotonin(photoreceptor,
                                            change_LIC_to_keep_depolarisation=
                                            change_LIC_to_keep_depolarisation)
        elif condition == 'Shab-50':
            Experiment.modify_conductance(photoreceptor,
                                          "Shab",
                                          .5,
                                          change_LIC_to_keep_depolarisation=
                                          change_LIC_to_keep_depolarisation)
        elif condition == 'Shab+50':
            Experiment.modify_conductance(photoreceptor,
                                          "Shab",
                                          1.5,
                                          change_LIC_to_keep_depolarisation=
                                          change_LIC_to_keep_depolarisation)
        else:
            print("Warning, option not recognised")

        Vr_new_r[ii, i] = photoreceptor.body.V_m

        Z_cut = photoreceptor.body.impedance(
            f_from_medium
Example #3
0
gain_bandwidth_product_fixed = zeros_like(Vr)

HH_RC = []

for i, V in enumerate(Vr):

    label_str = str(V) + ' mV'

    DepolarisePhotoreceptor.WithLight(HH, V)

    gain_max[i], Bandwidth[i] = Gain_Bandwidth(HH.body.voltage_contrast_gain,
                                               f_min=f_medium)
    gain = abs(HH.body.voltage_contrast_gain(f))
    gain_bandwidth_product[i] = gain_max[i] * Bandwidth[i]

    Experiment.freeze_conductances(HH)

    gain_max_fixed[i], Bandwidth_fixed[i] = Gain_Bandwidth(
        HH.body.voltage_contrast_gain, f_min=f_medium)
    gain_fixed = abs(HH.body.voltage_contrast_gain(f))
    gain_bandwidth_product_fixed[i] = gain_max_fixed[i] * Bandwidth_fixed[i]

    Experiment.unfreeze_conductances(HH)

    ax_bwprod.plot(V,
                   gain_bandwidth_product[i],
                   colour_graph[i] + '.',
                   markersize=15)
    ax_bwprod.plot(V,
                   gain_bandwidth_product_fixed[i],
                   colour_graph[i] + '.',
Example #4
0
photoreceptor = Drone.Vallet92()
DepolarisePhotoreceptor.WithLight(photoreceptor, V=V_membrane)

fig1.text(0.06,
          0.5,
          'Membrane potential deflection (mV)',
          ha='center',
          va='center',
          rotation='vertical')

for ii in range(5):
    for i, t in enumerate(time_array):
        if 10 <= t <= 110: I[i] = 1e-3 * (-0.02 + 0.01 * ii)  # nA->uA
    DepolarisePhotoreceptor.WithLight(photoreceptor, V=V_membrane)

    V_array, g_Ch = Experiment.inject_current(photoreceptor, I, dt)
    ax_curr.plot(time_array, I, 'k')
    ax.plot(time_array, V_array - V_membrane, color='black')  #mV
    ax.set_xticklabels([])

    V_array = Linearise.inject_current(photoreceptor, I, dt)
    ax.plot(time_array, V_array, 'k--')  #mV
    ax.set_xticklabels([])

V_membrane = -38  #mV
photoreceptor = Drone.Vallet92(k_h=1)
DepolarisePhotoreceptor.WithLight(photoreceptor, V=V_membrane)

for ii in range(5):
    for i, t in enumerate(time_array):
        if 10 <= t <= 110: I[i] = 1e-3 * (-0.02 + 0.01 * ii)  # nA->uA
Example #5
0
    V_membrane = -60  # mV
else:
    N_rep = 8
    a = -0.7
    b = 0.2
    V_membrane = -40 #mV


photoreceptor = FlyFactory.CalliphoraR16(channel_choice = "Anderson")

for ii in range(N_rep) :
    for i, t in enumerate(time_array):
        if 10 <= t <= 110: I[i] = 1e-3*(a+b*ii)  # nA->uA  --- Fig S1b
    DepolarisePhotoreceptor.WithLight(photoreceptor, V = V_membrane)

    V_array, g_Ch = Experiment.inject_current(photoreceptor,I,dt)
    plt.ylabel_set = False
    ax = plt.subplot(2,1,1)
    ax.plot(time_array, V_array,color='black') #mV
    ax.set_title('Hodgkin-Huxley voltage (top) and conductances (bottom)')
    plt.ylabel('Potential (mV)')
    ax.set_xticklabels([])
    ax = plt.subplot(2,1,2)
    ax.plot(time_array, g_Ch[0]*1e6,color='blue') #Fast conductance, nS
    ax.plot(time_array, g_Ch[1]*1e6,color='red') #Slow conductance, nS
    plt.xlabel('Time (msec)')
    plt.ylabel('Conductances (nS)')

    Experiment.freeze_conductances(photoreceptor)

    V_array, g_Ch = Experiment.inject_current(photoreceptor,I,dt)
Example #6
0
                    ha='right')

Vr = np.arange(-68.0, -30.0, 8)
deltaV = 0.5
Vr_continuous = np.arange(-68, -36 + deltaV, deltaV)

colour_graph = list('ybgrc')

GBWP_continuous_ = np.zeros_like(Vr_continuous)
GBWP_RC_continuous_ = np.zeros_like(Vr_continuous)
GBWP_selective_continuous_ = np.zeros((3, len(Vr_continuous)))

for i, V in enumerate(Vr_continuous):
    DepolarisePhotoreceptor.WithLight(HH, V)
    GBWP_continuous_[i] = GBWP(HH.body.impedance, f_min=f_medium)
    Experiment.freeze_conductances(HH)
    GBWP_RC_continuous_[i] = GBWP(HH.body.impedance, f_min=f_medium)
    Experiment.unfreeze_conductances(HH)

    for ii in range(3):
        for iii in range(3):
            if ii != iii:
                Experiment.freeze_conductances(HH, index=iii)
        GBWP_selective_continuous_[ii, i] = GBWP(HH.body.impedance,
                                                 f_min=f_medium)
        Experiment.unfreeze_conductances(HH)

for ii in range(3):
    ax_GBWP[ii].plot(Vr_continuous,
                     GBWP_continuous_ / 1e3,
                     'k',
Example #7
0
V_membrane_ = [-68,-59,-41] #mV
plot_window = array([-.5,3.5])
drosophila = FlyFactory.DrosophilaR16()
fig1 = figure(1)

T=200 #ms
dt=0.5 #ms
time_array = arange(0,T+dt,dt)
I = zeros_like(time_array)

for ii,V_membrane in enumerate(V_membrane_) :
    for i, t in enumerate(time_array):
        if 10 <= t <= 160: I[i] = 1e-3*(0.01)  # nA->uA
    DepolarisePhotoreceptor.WithLight(drosophila, V = V_membrane)

    V_array, g_Ch = Experiment.inject_current(drosophila,I,dt)
    ax = fig1.add_subplot(3,1,ii+1)
    ax.plot(time_array, V_array,color='black') #mV

    #Experiment.unfreeze_conductances(drosophila)

    DepolarisePhotoreceptor.WithLight(drosophila, V = V_membrane) #To make sure that all channels are back at rest

    Experiment.freeze_inactivations(drosophila)
    V_array, g_Ch = Experiment.inject_current(drosophila,I,dt)
    Experiment.unfreeze_inactivations(drosophila)
    ax.plot(time_array, V_array,'k:') #mV

    DepolarisePhotoreceptor.WithLight(drosophila, V = V_membrane) #To make sure that all channels are back at rest

    Experiment.freeze_conductances(drosophila)
Example #8
0
DepolarisePhotoreceptor.WithLight(HH,V)
passive_gbwp = 1/2/pi/HH.body.C
tau_fast_original = HH.body.voltage_channels[0].m_time(V)
print("Passive GBWP is ", passive_gbwp, " MOhm Hz")
print("Original time constant for FDR is ", tau_fast_original, "ms")

low_pass_found = False
for i,tau in enumerate(tau_fast):
    HH.body.voltage_channels[0].time_multiplier = tau_fast[i]/tau_fast_original
    GBWP_a[i]= GBWP(HH.body.impedance)/passive_gbwp
    GDV_a[i] = GDV(HH.body.impedance, f_down=f_down)
    if (Is_Band_Pass(HH.body.impedance) and low_pass_found==False):
        print ("First low pass when tau = ", tau)
        low_pass_found = True

Experiment.freeze_conductances(HH,index=1) #freeze SDR

low_pass_found = False
for i,tau in enumerate(tau_fast):
    HH.body.voltage_channels[0].time_multiplier = tau_fast[i]/tau_fast_original
    GBWPf_a[i]= GBWP(HH.body.impedance)/passive_gbwp
    GDVf_a[i] = GDV(HH.body.impedance, f_down=f_down)
    if (Is_Band_Pass(HH.body.impedance) and low_pass_found==False):
        print ("First low pass when tau = ", tau)
        low_pass_found = True


Experiment.freeze_conductances(HH,index=0) #freeze FDR and SDR
passive_gdv = GDV(HH.body.impedance)

ax_gbwp1.plot(tau_fast,GBWP_a,'k')
Example #9
0
deltaV = 0.5
Vr_continuous = np.arange(-68, -36 + deltaV, deltaV)

colour_graph=['y','b','g','r','c']

##Continuous across depolarisations

GBWP_continuous_ = np.zeros_like(Vr_continuous)
GBWP_RC_continuous_ = np.zeros_like(Vr_continuous)
GBWP_shift_continuous_ = np.zeros((3,len(Vr_continuous)))
Vr_shift_continuous = np.zeros((3,len(Vr_continuous)))

for i,V in enumerate(Vr_continuous):
    DepolarisePhotoreceptor.WithLight(HH,V)
    GBWP_continuous_[i] = GBWP(HH.body.impedance, f_min = f_medium)
    Experiment.freeze_conductances(HH)
    GBWP_RC_continuous_[i] = GBWP(HH.body.impedance, f_min = f_medium)
    Experiment.unfreeze_conductances(HH)

    for ii in range(3):
        HH_shifted = copy.deepcopy(HH)
        if ii==0:
            ShiftConductances.WithLight(HH_shifted, change_LIC_to_keep_depolarisation = change_LIC_to_keep_depolarisation)
        elif ii==2:
            ShiftConductances.WithSerotonin(HH_shifted, change_LIC_to_keep_depolarisation = change_LIC_to_keep_depolarisation)
        elif ii==1:
            Experiment.modify_conductance(HH_shifted, "Shab", .5, change_LIC_to_keep_depolarisation = change_LIC_to_keep_depolarisation)
        else:
            raise Exception
        GBWP_shift_continuous_[ii,i] = GBWP(HH_shifted.body.impedance, f_min = f_medium)
        Vr_shift_continuous[ii,i] = HH_shifted.body.V_m