Beispiel #1
0
    def add_cpampars(self,
                     locations,
                     section_name,
                     release_time,
                     gmax=500,
                     pconc=100):

        for section in self.dendrites:
            if section.name() == section_name:
                self.dendrite = section
        #print 'adding synapses to', self.dendrite.name()

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 1.0
        pre.del_rel = release_time
        self.pre_cpampa_list.append(pre)

        for loc in locations:
            cpampa = h.cpampa12st(loc, sec=self.dendrite)
            cpampa.pconc = pconc
            cpampa.gmax = gmax
            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)
            self.cpampa_list.append(cpampa)
    def get_synapse_iv(self,
                       synpase_type='ampa',
                       p_conc=0,
                       ampa_gmax=5000,
                       nmda_gmax=5000,
                       t_rel=40.0,
                       vc_range=np.arange(-90.0, 50.0, 5.0),
                       nmda_mech='h.NMDA_Mg_T',
                       vshift=None):
        '''

        Method for generating large IV curves... Not sure if best, use synapse __ref__i
        '''

        self.clamp = h.SEClamp(0.5, sec=self.root)
        self.clamp.dur1 = 10
        self.clamp.dur2 = 60
        self.clamp.dur3 = 10
        self.clamp.amp1 = -70
        self.clamp.amp2 = -70
        self.clamp.amp3 = -70
        self.clamp.rs = 0.0001

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 3.0
        pre.del_rel = t_rel

        if synpase_type.lower() == 'ampa':
            print('running simulation of AMPAR IV with', p_conc,
                  'µM polyamines')

            cpampa = h.cpampa12st(0.5, sec=self.root)
            cpampa.pconc = p_conc
            cpampa.gmax = ampa_gmax

            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

        if synpase_type.lower() == 'nmda':
            print('running simulation of NMDA IV')
            nmda = eval(nmda_mech + '(0.5,sec=self.root)')
            print('inserted: ' + nmda_mech + '(0.5,sec=self.root)')
            #nmda = h.NMDA_Mg_T(0.5,sec=self.root)
            if vshift:
                print('vshift: ' + str(vshift))
                nmda.vshift = vshift
            nmda.gmax = nmda_gmax
            h.setpointer(pre(0.5).rel._ref_T, 'C', nmda)

        v, i, t = self.run_vclamp(vc_range, tstop=80)
        i_list, v_list = self.calc_iv_relationship(v, i, t)
        return i_list, v_list,
Beispiel #3
0
    def add_cpampa(self, pconc=100, gmax=1000, release_time=50):
        syn = h.cpampa12st(0.5, sec=self.soma)
        syn.pconc = pconc
        syn.gmax = gmax

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 2.0
        pre.del_rel = release_time

        h.setpointer(pre(0.5).rel._ref_T, 'C', syn)

        self.syn = syn
        self.pre = pre
    def get_iv(self,
               synpase_type='ampa',
               p_conc=0,
               ampa_gmax=5000,
               nmda_gmax=5000,
               t_rel=40.0):

        self.clamp = h.SEClamp(0.5, sec=self.root)
        self.clamp.dur1 = 10
        self.clamp.dur2 = 60
        self.clamp.dur3 = 10
        self.clamp.amp1 = -70
        self.clamp.amp2 = -70
        self.clamp.amp3 = -70
        self.clamp.rs = 0.0001

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 3.0
        pre.del_rel = t_rel

        if synpase_type.lower() == 'ampa':
            print('running simulation of AMPAR IV with', p_conc,
                  'µM polyamines')

            cpampa = h.cpampa12st(0.5, sec=self.root)
            cpampa.pconc = p_conc
            cpampa.gmax = ampa_gmax

            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

        if synpase_type.lower() == 'nmda':
            print('running simulation of NMDA IV')

            nmda = h.NMDA_Mg_T(0.5, sec=self.root)
            nmda.gmax = nmda_gmax
            h.setpointer(pre(0.5).rel._ref_T, 'C', nmda)

        vc_range = np.arange(-90.0, 50.0, 10.0)
        v, i, t = self.run_vclamp(vc_range, tstop=80)
        i_list, v_list = self.calc_iv_relationship(v, i, t)
        return i_list, v_list
    def get_nmda_ampa_ratio(self,
                            p_conc,
                            ampa_gmax,
                            nmda_gmax,
                            t_rel=40.0,
                            vc_range=[-60, 60]):

        self.clamp = h.SEClamp(0.5, sec=self.root)
        self.clamp.dur1 = 10
        self.clamp.dur2 = 150
        self.clamp.dur3 = 10
        self.clamp.amp1 = -70
        self.clamp.amp2 = -70
        self.clamp.amp3 = -70
        self.clamp.rs = 0.0001

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 3.0
        pre.del_rel = t_rel

        syn_list = []
        locs = np.linspace(0, 1, 35)
        for l in locs:
            cpampa = h.cpampa12st(l, sec=self.root)
            cpampa.pconc = p_conc
            cpampa.gmax = ampa_gmax

            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

            nmda = h.NMDA_Mg_T(l, sec=self.root)
            nmda.gmax = nmda_gmax
            h.setpointer(pre(0.5).rel._ref_T, 'C', nmda)

            syn_list.append((nmda, cpampa))

        v, i, t = self.run_vclamp(vc_range, tstop=170)

        return v, i, t
Beispiel #6
0
    def add_cpampars_for_stim_electrodes(self,
                                         section_loc_list,
                                         release_time,
                                         stim_string,
                                         gmax=500,
                                         pconc=100):
        '''
            Method adds across sections, expects a list of tuples containing (section(str), loc(float)).
            Stores the stims in a dictionary...
            '''
        # should make this a method
        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 1.0
        pre.del_rel = release_time
        self.pre_cpampa_list.append(pre)

        stim_syns = []
        for sec_loc in section_loc_list:
            section_name = sec_loc[0]
            loc = sec_loc[1]
            #print 'adding at:', section_name, loc
            for section in self.dendrites:
                if section.name() == section_name:
                    dendrite = section
            cpampa = h.cpampa12st(loc, sec=dendrite)
            cpampa.pconc = pconc
            cpampa.gmax = gmax
            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)
            stim_syns.append(cpampa)
        self.cpampa_stim_dict[stim_string] = stim_syns
        # hacky just go with last dendrite for recording - change this!
        self.dendrite = dendrite
Beispiel #7
0
    def add_cpampars(self,
                     locations,
                     dendrite_strings,
                     gmax=500,
                     release_times=[20],
                     pconc=100,
                     NMDARs=False):
        self.cpampa_list = []
        self.pre_cpampa_list = []
        self.NMDARs_list = []
        # find the dendrite of choice!
        for string in dendrite_strings:
            for sec in self.sec_list:
                if sec.name().find(string) >= 0:
                    self.dendrite = sec
            for x, loc in enumerate(locations):
                pre = h.Section()
                pre.diam = 1.0
                pre.L = 1.0
                pre.insert('rel')
                pre.dur_rel = 0.5
                pre.amp_rel = 1.0
                pre.del_rel = release_times[x]
                cpampa = h.cpampa12st(locations[x], sec=self.dendrite)
                cpampa.pconc = pconc
                cpampa.gmax = gmax

                if NMDARs:
                    NMDA = h.NMDA_Mg_T(locations[x], sec=self.dendrite)
                    NMDA.gmax = gmax
                    h.setpointer(pre(0.5).rel._ref_T, 'C', NMDA)
                    self.NMDARs_list.append(NMDA)
                h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

                self.cpampa_list.append(cpampa)
                self.pre_cpampa_list.append(pre)
    def get_ampa_iv_2017(self,
                         ampa_gmax,
                         p_conc=0,
                         vc_range=[-60, 60],
                         tstop=220,
                         t_rel=40.0):
        self.clamp = h.SEClamp(0.5, sec=self.root)
        self.clamp.dur1 = 10
        self.clamp.dur2 = 200
        self.clamp.dur3 = 10
        self.clamp.amp1 = -70
        self.clamp.amp2 = -70
        self.clamp.amp3 = -70
        self.clamp.rs = 0.0001

        pre = h.Section()
        pre.diam = 1.0
        pre.L = 1.0
        pre.insert('rel')
        pre.dur_rel = 0.5
        pre.amp_rel = 3.0
        pre.del_rel = t_rel
        print('amp 3')

        cpampa = h.cpampa12st(0.5, sec=self.root)
        cpampa.pconc = p_conc
        cpampa.gmax = ampa_gmax

        h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

        h.load_file('stdrun.hoc')
        rec = {}
        for label in 't', 'v', 'i_ampa', 'g_ampa':
            rec[label] = h.Vector()

        rec['t'].record(h._ref_t)
        rec['i_ampa'].record(cpampa._ref_i)
        rec['g_ampa'].record(cpampa._ref_g)
        rec['v'].record(self.root(0.5)._ref_v)

        v_list, i_list, t_list, g_list = [], [], [], []
        h.tstop = tstop
        h.celsius = 32.0

        for vc in vc_range:
            h.init()
            #h.finitialize(v_init)
            self.clamp.amp2 = vc
            h.run()
            i = rec['i_ampa'].to_python()
            g = rec['g_ampa'].to_python()
            v = rec['v'].to_python()
            t = rec['t'].to_python()
            v_list.append(v)
            i_list.append(i)
            t_list.append(t)
            g_list.append(g)

        v = np.array(v_list).transpose()
        i = np.array(i_list).transpose() * 1000  # for pA
        t = np.array(t_list).transpose()
        g = np.array(g_list).transpose(
        ) * 1 * 10**6  # this is defined as microSiemens in the mod file: 1000000, so for pico 1e-6

        return t, i, v, g  # in pA
Beispiel #9
0
    def add_uncaging_spots(self,
                           random_seed=7,
                           n_synapses=15,
                           uncaging_dendrite='jc_tree2_bdend1[2]',
                           ampa_gmax=500,
                           nmda_gmax=500,
                           rel_time=20,
                           delay=0.5,
                           pconc=100,
                           nmda=False,
                           spots='all',
                           loc_range=(0, 1),
                           wipe_lists=True):

        # grab dendrite
        for section in self.sec_list:
            if section.name() == uncaging_dendrite:
                self.u_dend = section

        # do these neeed to be here?
        if wipe_lists:
            self.cpampa_list = []
            self.nmda_list = []
            self.pre_list = []
        ##

        locs = np.linspace(loc_range[0], loc_range[1], n_synapses)

        np.random.seed(random_seed)
        possible_locs = np.random.permutation(locs)

        release_times = np.array(
            [rel_time + delay * i for i in range(n_synapses)])

        if spots == 'all':
            print('uncaging on all spots:')
            uncaging_spots = possible_locs
        else:
            uncaging_spots = possible_locs[spots]
            release_times = release_times[spots]

        for i, loc in enumerate(uncaging_spots):
            pre = h.Section()
            pre.diam = 1.0
            pre.L = 1.0
            pre.insert('rel')
            pre.dur_rel = 0.5
            pre.amp_rel = 3.0
            pre.del_rel = release_times[i]
            cpampa = h.cpampa12st(loc, sec=self.u_dend)
            cpampa.pconc = pconc
            cpampa.gmax = ampa_gmax

            h.setpointer(pre(0.5).rel._ref_T, 'C', cpampa)

            self.cpampa_list.append(cpampa)
            self.pre_list.append(pre)

            if nmda:
                nmda = h.NMDA_Mg_T(loc, sec=self.u_dend)
                nmda.gmax = nmda_gmax
                h.setpointer(pre(0.5).rel._ref_T, 'C', nmda)
                self.nmda_list.append(nmda)