Exemplo n.º 1
0
 def __init__(self, cellname):
     self.context = moose.PyMooseBase.getContext()
     self.cellname = cellname
     load_channels()
     load_synapses(synchan_activation_correction)
     MML = MorphML({'temperature': CELSIUS})
     if cellname == 'PG':
         filename = 'PG_aditya2010_neuroML_L1_L2_L3.xml'
         self.ORNCellSynapse = 'ORN_PG'
         self.somaName = 'soma_0'
         self.numORNSyns = NUM_ORN_PG_SYNS
     elif cellname == 'mitral':
         filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod_withspikeinit.xml'
         self.ORNCellSynapse = 'ORN_mitral'
         self.somaName = 'Seg0_soma_0'
         self.numORNSyns = NUM_ORN_MITRAL_SYNS
     self.cellSegmentDict = MML.readMorphMLFromFile(filename, {})
     self.cell = moose.Cell(self.context.deepCopy(self.context.pathToId('/library/'+cellname),\
         self.context.pathToId('/'),cellname))
     self.soma = moose.Compartment('/' + self.cellname + '/' +
                                   self.somaName)
     self.soma_vm = setupTable('soma_vm', self.soma, 'Vm')
     if mpisize > 1:
         self.soma_vm.stepMode = TAB_SPIKE  # store only spikes
         self.soma_vm.stepSize = -0.030  # that cross -30 mV
     self.spikeTableList = []
     self.attachORNs()
 def __init__(self,figname):
     load_channels()
     MML = MorphML({'temperature':CELSIUS})
     ## Figure 2G,H has 2013 (LTS) first, then 2010 (plateauing)
     ## 50pA injected if PG2010, else 100pA injected -- see in run() below
     if '2010' in figname:
         MML.readMorphMLFromFile('PG_aditya2010unified_neuroML_L1_L2_L3.xml',{})
         self.figname = 'PG2010'
     elif '2013' in figname:
         MML.readMorphMLFromFile('PG_aditya2013unified_neuroML_L1_L2_L3.xml',{})
         self.figname = 'PG2013'
     else:
         print "Give PG2010 or PG2013 as argument"
         sys.exit(1)
     self.libname = 'PG'
     #MML.readMorphMLFromFile('PG_aditya2013_neuroML_L1_L2_L3.xml',{})
     #self.libname = 'PG_LTS'
     self.context = moose.PyMooseBase.getContext()
     self.PGcell = self.context.deepCopy(self.context.pathToId('/library/'+self.libname),self.context.pathToId('/'),"PG")
     self.PGsoma = moose.Compartment('/PG/soma_0')
     self.soma_vm = self.setupTable('soma_vm', self.PGsoma,'Vm')
     self.caconc_conc = self.setupChannelTable('Ca_mit_conc_Ca', moose.CaConc(self.PGsoma.path+'/Ca_mit_conc'),'Ca')
     self.tca_Ik = self.setupChannelTable('TCa_Ik', moose.HHChannel(self.PGsoma.path+'/TCa_d'),'Ik')
     self.na_rat_ms_X = self.setupChannelTable('Na_rat_ms_X',moose.HHChannel(self.PGsoma.path+"/Na_rat_ms"),"X")
     self.na_rat_ms_Y = self.setupChannelTable('Na_rat_ms_Y',moose.HHChannel(self.PGsoma.path+"/Na_rat_ms"),"Y")
     self.kdr_ms_X = self.setupChannelTable('KDR_ms_X',moose.HHChannel(self.PGsoma.path+"/KDR_ms"),"X")
     self.ka_ms_X = self.setupChannelTable('KA_ms_X',moose.HHChannel(self.PGsoma.path+"/KA_ms"),"X")
     self.tca_d_X = self.setupChannelTable('TCa_d_X',moose.HHChannel(self.PGsoma.path+"/TCa_d"),"X")
     self.tca_d_Y = self.setupChannelTable('TCa_d_Y',moose.HHChannel(self.PGsoma.path+"/TCa_d"),"Y")
     self.ih_cb_X = self.setupChannelTable('Ih_cb_X',moose.HHChannel(self.PGsoma.path+"/Ih_cb"),"X")
 def __init__(self, cellname):
     self.context = moose.PyMooseBase.getContext()
     self.cellname = cellname
     load_channels()
     load_synapses(synchan_activation_correction)
     MML = MorphML({'temperature':CELSIUS})
     if cellname == 'PG':
         filename = 'PG_aditya2010_neuroML_L1_L2_L3.xml'
         self.ORNCellSynapse = 'ORN_PG'
         self.somaName = 'soma_0'
         self.numORNSyns = NUM_ORN_PG_SYNS
     elif cellname == 'mitral':
         filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod_withspikeinit.xml'
         self.ORNCellSynapse = 'ORN_mitral'
         self.somaName = 'Seg0_soma_0'
         self.numORNSyns = NUM_ORN_MITRAL_SYNS
     self.cellSegmentDict = MML.readMorphMLFromFile(filename,{})
     self.cell = moose.Cell(self.context.deepCopy(self.context.pathToId('/library/'+cellname),\
         self.context.pathToId('/'),cellname))
     self.soma = moose.Compartment('/'+self.cellname+'/'+self.somaName)
     self.soma_vm = setupTable('soma_vm', self.soma,'Vm')
     if mpisize>1:
         self.soma_vm.stepMode = TAB_SPIKE # store only spikes
         self.soma_vm.stepSize = -0.030 # that cross -30 mV
     self.spikeTableList = []
     self.attachORNs()
Exemplo n.º 4
0
    def __init__(self, OBfile, synchan_activation_correction,
        tweaks, mpirank, uniquestr, granfilebase, resptuned=False, spiketable=False):
        self.mpirank = mpirank
        self.uniquestr = uniquestr
        self.context = moose.PyMooseBase.getContext()
        self.granfilebase = granfilebase
        self.spiketable = spiketable
        ## netseed is between 'seed' and '_' / '.xml' in OBfile
        ## ensure there is an _ before .xml, to consider both endings.
        OBfile_underscored = OBfile.replace('.xml','_.xml')
        self.netseed = float((OBfile_underscored.split('seed')[1]).split('_')[0])
        load_channels()
        ## synchan_activation_correction depends on SIMDT,
        ## hence passed all the way down to
        ## granule_mitral_GABA synapse from the top level
        load_synapses(synchan_activation_correction)
        self.cellSegmentDict = load_cells()
        
        filename = OBfile
        NML = NetworkML({'temperature':CELSIUS})
        ## Below returns populationDict = { 'populationname1':(cellname,{instanceid1:moosecell, ... }) , ... }
        ## and projectionDict = { 'projectionname1':(source,target,[(syn_name1,pre_seg_path,post_seg_path),...]) , ... }
        (self.populationDict,self.projectionDict) = \
            NML.readNetworkMLFromFile(filename,self.cellSegmentDict,params=tweaks)

        if VARY_GRANS_RMP:
            self.set_granules_rmp(gran_RMP_SD)
        if VARY_PGS_RMP:
            self.set_pgs_rmp(PG_RMP_SD) # let PGs vary also
            self.set_different_pgs() # set cells as PG_LTS or PG
            ## Vary synapse/channel Gbar-s only after setting them as PG_LTS or PG above
            self.set_pgs_input_conductances() # set input conductance based on PG type
            #self.set_pgs_tca_var() # changes TCa for all PGs
            ## for PG_LTS, varying ELeak or TCa doesn't change RMP, varying KCa does
            self.set_pgs_kca_var() # changes KCa for PG_LTSs

        #### Granule baseline synapses and connected timetables are created
        #### by the networkml reader from the network xml file.
        #### But the firefiles need to be loaded into timetables.
        self.connect_granule_baselines_to_files('granule_baseline')

        #### mitral baseline synapses and connected timetables are created
        #### by the networkml reader from the network xml file.
        #### But the firefiles need to be loaded into timetables.
        #print "Connecting 10000 files per mit"
        ## connect baseline inhibition to mitrals at lateral dendrites
        #self.connect_granule_baselines_to_files('mitral_baseline')
        ## connect baseline inhibition to mitrals at tuft dendrites
        #self.connect_granule_baselines_to_files('tuft_mitral')

        #printCellTree(moose.Cell('granules_singles_0'))
        # unordered dictionary self.populationDict['mitrals'][1] is
        # renamed to a more friendly self.mitralTable
        self.mitralTable = self.populationDict['mitrals'][1]
        self.setupMitralRecordingTables()
        
        #printNetTree()
        print "OB Network from",OBfile,"loaded!"
Exemplo n.º 5
0
 def __init__(self):
     load_channels()
     MML = MorphML()
     gran_dict = MML.readMorphMLFromFile('../cells/granule_granadityaMS2007_neuroML_L1_L2_L3.xml',{})
     self.context = moose.PyMooseBase.getContext()
     granCellId = self.context.deepCopy(self.context.pathToId('/library/granule'),self.context.pathToId('/'),"granule")
     self.granCell = moose.Cell(granCellId)
     # note that soma is not just /granule/soma, it'll also have its segid appended - thus the general purpose function below:
     self.granSoma = moose.Compartment(get_matching_children(self.granCell, ['Soma','soma'])[0]) # take the first [0] available soma!!
     self.somaVm = setupTable('soma_vm', self.granSoma,'Vm')
Exemplo n.º 6
0
 def __init__(self):
     load_channels()
     MML = MorphML()
     gran_dict = MML.readMorphMLFromFile("../cells/granule_granadityaMS2007_neuroML_L1_L2_L3.xml", {})
     self.context = moose.PyMooseBase.getContext()
     granCellId = self.context.deepCopy(
         self.context.pathToId("/library/granule"), self.context.pathToId("/"), "granule"
     )
     self.granCell = moose.Cell(granCellId)
     # note that soma is not just /granule/soma, it'll also have its segid appended - thus the general purpose function below:
     self.granSoma = moose.Compartment(
         get_matching_children(self.granCell, ["Soma", "soma"])[0]
     )  # take the first [0] available soma!!
     self.somaVm = setupTable("soma_vm", self.granSoma, "Vm")
 def __init__(self, outputtype):
     load_channels()
     ## synchan_activation_correction depends on SIMDT,
     ## hence passed all the way down to
     ## granule_mitral_GABA synapse from the top level
     load_synapses(synchan_activation_correction)
     MML = MorphML({'temperature':CELSIUS})
     self.outputType = outputtype
     self.cellList = []
     ## order matters, as self.cellname etc remain that in last iteration
     for cellname in ['PG','mitral']:
         if cellname == 'PG':
             #filename = 'PG_aditya2010_neuroML_L1_L2_L3.xml'
             filename = 'PG_aditya2012_neuroML_L1_L2_L3.xml'
             self.ORNCellSynapse = 'ORN_PG'
             self.somaName = 'soma_0'
             self.numORNSyns = NUM_ORN_PG_SYNS
         elif cellname == 'mitral':
             #filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod.xml'
             filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod_withspikeinit.xml'
             #filename = 'mitral_migliore_etal_2007.xml'
             self.ORNCellSynapse = 'ORN_mitral'
             self.somaName = 'Seg0_soma_0'
             self.numORNSyns = NUM_ORN_MITRAL_SYNS
         self.cellname = cellname
         ## returns {cellname:segDict}
         ## where segDict = { segid1 : [ segname,(proximalx,proximaly,proximalz),
         ##  (distalx,distaly,distalz),diameter,length,[potential_syn1, ... ] ] , ... }
         cellDict = MML.readMorphMLFromFile(filename,{})
         segDict = cellDict[cellname]
         self.context = moose.PyMooseBase.getContext()
         self.cell = moose.Cell(self.context.deepCopy(\
             self.context.pathToId('/library/'+cellname),self.context.pathToId('/'),cellname))
         self.soma = moose.Compartment('/'+self.cellname+'/'+self.somaName)
         self.soma_vm = setupTable('soma_vm', self.soma,'Vm')
         self.soma_vm.stepMode = TAB_SPIKE # store only spikes
         self.soma_vm.stepSize = -0.020 # that cross -20 mV
         self.spikeTableList = []
         self.makeSynapses(segDict,self.cell)
         self.attachORNs()
         #printCellTree(self.cell)
         #self.soma.inject = 1e-9 # Ampere
         ## 0th cell is PG, 1st cell is mitral
         self.cellList.append((self.cell,self.soma,self.soma_vm,self.spikeTableList))
     if self.outputType == 'both':
         self.attachInhibition()
 def __init__(self, figname):
     load_channels()
     MML = MorphML({'temperature': CELSIUS})
     ## Figure 2G,H has 2013 (LTS) first, then 2010 (plateauing)
     ## 50pA injected if PG2010, else 100pA injected -- see in run() below
     if '2010' in figname:
         MML.readMorphMLFromFile(
             'PG_aditya2010unified_neuroML_L1_L2_L3.xml', {})
         self.figname = 'PG2010'
     elif '2013' in figname:
         MML.readMorphMLFromFile(
             'PG_aditya2013unified_neuroML_L1_L2_L3.xml', {})
         self.figname = 'PG2013'
     else:
         print "Give PG2010 or PG2013 as argument"
         sys.exit(1)
     self.libname = 'PG'
     #MML.readMorphMLFromFile('PG_aditya2013_neuroML_L1_L2_L3.xml',{})
     #self.libname = 'PG_LTS'
     self.context = moose.PyMooseBase.getContext()
     self.PGcell = self.context.deepCopy(
         self.context.pathToId('/library/' + self.libname),
         self.context.pathToId('/'), "PG")
     self.PGsoma = moose.Compartment('/PG/soma_0')
     self.soma_vm = self.setupTable('soma_vm', self.PGsoma, 'Vm')
     self.caconc_conc = self.setupChannelTable(
         'Ca_mit_conc_Ca', moose.CaConc(self.PGsoma.path + '/Ca_mit_conc'),
         'Ca')
     self.tca_Ik = self.setupChannelTable(
         'TCa_Ik', moose.HHChannel(self.PGsoma.path + '/TCa_d'), 'Ik')
     self.na_rat_ms_X = self.setupChannelTable(
         'Na_rat_ms_X', moose.HHChannel(self.PGsoma.path + "/Na_rat_ms"),
         "X")
     self.na_rat_ms_Y = self.setupChannelTable(
         'Na_rat_ms_Y', moose.HHChannel(self.PGsoma.path + "/Na_rat_ms"),
         "Y")
     self.kdr_ms_X = self.setupChannelTable(
         'KDR_ms_X', moose.HHChannel(self.PGsoma.path + "/KDR_ms"), "X")
     self.ka_ms_X = self.setupChannelTable(
         'KA_ms_X', moose.HHChannel(self.PGsoma.path + "/KA_ms"), "X")
     self.tca_d_X = self.setupChannelTable(
         'TCa_d_X', moose.HHChannel(self.PGsoma.path + "/TCa_d"), "X")
     self.tca_d_Y = self.setupChannelTable(
         'TCa_d_Y', moose.HHChannel(self.PGsoma.path + "/TCa_d"), "Y")
     self.ih_cb_X = self.setupChannelTable(
         'Ih_cb_X', moose.HHChannel(self.PGsoma.path + "/Ih_cb"), "X")
Exemplo n.º 9
0
    def __init__(self,
                 cellname,
                 pseudosynname,
                 libsynname,
                 synfactor,
                 Vclamp,
                 numsyns,
                 syntime,
                 stagger,
                 comp_name=None):
        load_channels()
        ## synchan_activation_correction is for graded synapses -- not useful for this script
        load_synapses(synchan_activation_correction)
        MML = MorphML({'temperature': CELSIUS})
        if cellname == 'PG':
            #filename = 'PG_aditya2010_neuroML_L1_L2_L3.xml'
            #filename = 'PG_aditya2012_neuroML_L1_L2_L3.xml'
            #filename = 'PG_aditya2013_neuroML_L1_L2_L3.xml'
            #cellname = 'PG_LTS'
            ## Choose one the two below
            ## set the ORN->PG and mitral->PG to 0.45 vs 1.25 nS for plateauing vs LTS
            #filename = 'PG_aditya2010unified_neuroML_L1_L2_L3.xml' # plateauing i.e. non-LTS
            filename = 'PG_aditya2013unified_neuroML_L1_L2_L3.xml'  # LTS
            self.somaName = 'soma_0'
        elif cellname == 'mitral':
            #filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod.xml'
            #filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3.xml'
            filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod_withspikeinit.xml'
            #filename = 'mitral_bbmit1993davison_neuroML_TEST_L1_L2_L3.xml'
            #filename = 'mitral_bbmit1993davisonMS_neuroML_L1_L2_L3.xml'
            #filename = 'mitral_migliore_etal_2007.xml'
            self.somaName = 'Seg0_soma_0'
        elif cellname == 'granule':
            filename = 'granule_granadityaMS2007_neuroML_L1_L2_L3.xml'
            self.somaName = 'soma_0'
        self.cellName = cellname
        self.synName = libsynname
        self.pseudoSynName = pseudosynname
        self.synFactor = synfactor
        self.Vclamp = Vclamp
        self.numSyns = numsyns
        self.synTime = syntime
        self.stagger = stagger
        self.compName = comp_name
        if self.stagger:
            self.synRUNTIME = self.synTime * (self.numSyns) + 2 * SETTLETIME
        else:
            self.synRUNTIME = self.synTime + 2 * SETTLETIME

        self.cellsDict = MML.readMorphMLFromFile(filename, {})
        self.context = moose.PyMooseBase.getContext()
        self.cell = moose.Cell( self.context.deepCopy(\
            self.context.pathToId('/library/'+cellname),self.context.pathToId('/'),cellname) )
        self.soma = moose.Compartment('/' + self.cellName + '/' +
                                      self.somaName)
        self.somaVm = setupTable('soma_vm', self.soma, 'Vm')
        if cellname == 'mitral':
            ## inject a current into tuft of mitral
            tuftcomp = moose.Compartment('/' + self.cellName +
                                         '/Seg0_glom_81_102')
            tuftcomp.inject = injtuft
            ## inject a current into soma of mitral
            self.soma.inject = injsoma
            ## if nerve shock, inject a sharp current into tuft compartments
            if nerve_shock:
                ## We want a single sharp current injection at SETTLETIME, so cannot use soma.inject
                ## segment info - see MorphML_reader.py
                ## Only connect to 25 tuft compartments
                for seginfo in (self.cellsDict[self.cellName].values()
                                )[0:num_tuft_comps_shock]:
                    ## seginfo[5] is a list of potential synapses at this segment
                    if 'ORN_mitral' in seginfo[5]:
                        ## wrap this segment, seginfo[0] is segment name
                        tuftcomp = moose.Compartment('/' + self.cellName +
                                                     '/' + seginfo[0])
                    ## compartment, name_extn, start_time, duration, current (all SI)
                    setup_iclamp(tuftcomp, '_nerveshock',\
                        SETTLETIME, 1e-3, tuft_shock_inject)

        self.spikeTableList = []
        self.attachSpikeTables()
        #printCellTree(self.cell)

        if cellname == 'mitral':
            ## monitor Vm at the base of the tuft
            tuftbase_seg = moose.Compartment('/'+self.cellName+\
                #'/Seg0_tuftden_19_23') # for migliore and shepherd 2007 cell

                '/Seg0_prim_dend_5_20') # tuft base
            self.tuftBaseTable = setupTable('mitdendTable', tuftbase_seg, 'Vm')

            ## monitor Vm at secondary dendrite
            dend_seg = moose.Compartment('/'+self.cellName+\
                #'/Seg0_sec_dendp4_0_254') # at 43.86 microns from soma
                #'/Seg0_sec_dendd3_0_204') # at 190.56 microns from soma


                '/Seg0_sec_dendd4_2_269') # at 1004.47 microns from soma
            self.secDendTable = setupTable('mitdendTable', dend_seg, 'Vm')

            ## monitor Vm in the tuft compartment
            ## same as current injection above
            self.tuftTable = setupTable('mitTuftTable', tuftcomp, 'Vm')
Exemplo n.º 10
0
try:
    import moose
except ImportError:
    print "ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH"
    import sys
    sys.exit(1)

sys.path.append('..')
from mooseConstants import *

from load_channels import *

from pylab import *
                        
if __name__ == "__main__":
    load_channels()
    idx = test_mechanism_index
    for varidx in range(len(mechanism_vars[idx])/2): # loop over each inf and tau i.e. two elements of mechanism_vars[idx] at a time
        var = ['x','y','z'][varidx]
        gate = moose.HHGate('/library/'+mechanism_names[idx]+'/'+var+'Gate')
        VMIN = gate.A.xmin
        VMAX = gate.A.xmax
        NDIVS = gate.A.xdivs # will use same VMIN, VMAX and NDIVS for A and B tables.
        dv = (VMAX-VMIN)/NDIVS
        vrange = [VMIN+i*dv for i in range(NDIVS+1)]
        figure()
        plot(vrange,[gate.A[i]/gate.B[i] for i in range(NDIVS+1)],'b-,') # Assume A and B have corresponding number of entries
        title('state variable '+mechanism_vars[idx][2*varidx]+' of '+mechanism_names[idx]+' vs Voltage (V)')
        figure()
        plot(vrange,[1.0/gate.B[i] for i in range(NDIVS+1)],'b-,')
        title('state variable '+mechanism_vars[idx][2*varidx+1]+' of '+mechanism_names[idx]+' vs Voltage (V)')
Exemplo n.º 11
0
    def __init__(self,
                 OBfile,
                 synchan_activation_correction,
                 tweaks,
                 mpirank,
                 uniquestr,
                 granfilebase,
                 resptuned=False,
                 spiketable=False):
        self.mpirank = mpirank
        self.uniquestr = uniquestr
        self.context = moose.PyMooseBase.getContext()
        self.granfilebase = granfilebase
        self.spiketable = spiketable
        ## netseed is between 'seed' and '_' / '.xml' in OBfile
        ## ensure there is an _ before .xml, to consider both endings.
        OBfile_underscored = OBfile.replace('.xml', '_.xml')
        self.netseed = float(
            (OBfile_underscored.split('seed')[1]).split('_')[0])
        load_channels()
        ## synchan_activation_correction depends on SIMDT,
        ## hence passed all the way down to
        ## granule_mitral_GABA synapse from the top level
        load_synapses(synchan_activation_correction)
        self.cellSegmentDict = load_cells()

        filename = OBfile
        NML = NetworkML({'temperature': CELSIUS})
        ## Below returns populationDict = { 'populationname1':(cellname,{instanceid1:moosecell, ... }) , ... }
        ## and projectionDict = { 'projectionname1':(source,target,[(syn_name1,pre_seg_path,post_seg_path),...]) , ... }
        (self.populationDict,self.projectionDict) = \
            NML.readNetworkMLFromFile(filename,self.cellSegmentDict,params=tweaks)

        if VARY_GRANS_RMP:
            self.set_granules_rmp(gran_RMP_SD)
        if VARY_PGS_RMP:
            self.set_pgs_rmp(PG_RMP_SD)  # let PGs vary also
            self.set_different_pgs()  # set cells as PG_LTS or PG
            ## Vary synapse/channel Gbar-s only after setting them as PG_LTS or PG above
            self.set_pgs_input_conductances(
            )  # set input conductance based on PG type
            #self.set_pgs_tca_var() # changes TCa for all PGs
            ## for PG_LTS, varying ELeak or TCa doesn't change RMP, varying KCa does
            self.set_pgs_kca_var()  # changes KCa for PG_LTSs

        #### Granule baseline synapses and connected timetables are created
        #### by the networkml reader from the network xml file.
        #### But the firefiles need to be loaded into timetables.
        self.connect_granule_baselines_to_files('granule_baseline')

        #### mitral baseline synapses and connected timetables are created
        #### by the networkml reader from the network xml file.
        #### But the firefiles need to be loaded into timetables.
        #print "Connecting 10000 files per mit"
        ## connect baseline inhibition to mitrals at lateral dendrites
        #self.connect_granule_baselines_to_files('mitral_baseline')
        ## connect baseline inhibition to mitrals at tuft dendrites
        #self.connect_granule_baselines_to_files('tuft_mitral')

        #printCellTree(moose.Cell('granules_singles_0'))
        # unordered dictionary self.populationDict['mitrals'][1] is
        # renamed to a more friendly self.mitralTable
        self.mitralTable = self.populationDict['mitrals'][1]
        self.setupMitralRecordingTables()

        #printNetTree()
        print "OB Network from", OBfile, "loaded!"
Exemplo n.º 12
0
try:
    import moose
except ImportError:
    print "ERROR: Could not import moose. Please add the directory containing moose.py in your PYTHONPATH"
    import sys
    sys.exit(1)

sys.path.append('..')
from mooseConstants import *

from load_channels import *

from pylab import *

if __name__ == "__main__":
    load_channels()
    idx = test_mechanism_index
    for varidx in range(
            len(mechanism_vars[idx]) / 2
    ):  # loop over each inf and tau i.e. two elements of mechanism_vars[idx] at a time
        var = ['x', 'y', 'z'][varidx]
        gate = moose.HHGate('/library/' + mechanism_names[idx] + '/' + var +
                            'Gate')
        VMIN = gate.A.xmin
        VMAX = gate.A.xmax
        NDIVS = gate.A.xdivs  # will use same VMIN, VMAX and NDIVS for A and B tables.
        dv = (VMAX - VMIN) / NDIVS
        vrange = [VMIN + i * dv for i in range(NDIVS + 1)]
        figure()
        plot(vrange, [gate.A[i] / gate.B[i] for i in range(NDIVS + 1)],
             'b-,')  # Assume A and B have corresponding number of entries
Exemplo n.º 13
0
    def __init__(self, cellname, pseudosynname, libsynname,
        synfactor, Vclamp, numsyns, syntime, stagger, comp_name=None):
        load_channels()
        ## synchan_activation_correction is for graded synapses -- not useful for this script
        load_synapses(synchan_activation_correction)
        MML = MorphML({'temperature':CELSIUS})
        if cellname == 'PG':
            #filename = 'PG_aditya2010_neuroML_L1_L2_L3.xml'
            #filename = 'PG_aditya2012_neuroML_L1_L2_L3.xml'
            #filename = 'PG_aditya2013_neuroML_L1_L2_L3.xml'
            #cellname = 'PG_LTS'
            ## Choose one the two below
            ## set the ORN->PG and mitral->PG to 0.45 vs 1.25 nS for plateauing vs LTS
            #filename = 'PG_aditya2010unified_neuroML_L1_L2_L3.xml' # plateauing i.e. non-LTS
            filename = 'PG_aditya2013unified_neuroML_L1_L2_L3.xml' # LTS
            self.somaName = 'soma_0'
        elif cellname == 'mitral':
            #filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod.xml'
            #filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3.xml'
            filename = 'mitral_bbmit1993davison_neuroML_L1_L2_L3_mod_withspikeinit.xml'
            #filename = 'mitral_bbmit1993davison_neuroML_TEST_L1_L2_L3.xml'
            #filename = 'mitral_bbmit1993davisonMS_neuroML_L1_L2_L3.xml'
            #filename = 'mitral_migliore_etal_2007.xml'
            self.somaName = 'Seg0_soma_0'
        elif cellname == 'granule':
            filename = 'granule_granadityaMS2007_neuroML_L1_L2_L3.xml'
            self.somaName = 'soma_0'
        self.cellName = cellname
        self.synName = libsynname
        self.pseudoSynName = pseudosynname
        self.synFactor = synfactor
        self.Vclamp = Vclamp
        self.numSyns = numsyns
        self.synTime = syntime
        self.stagger = stagger
        self.compName = comp_name
        if self.stagger:
            self.synRUNTIME = self.synTime*(self.numSyns)+2*SETTLETIME
        else:
            self.synRUNTIME = self.synTime+2*SETTLETIME

        self.cellsDict = MML.readMorphMLFromFile(filename,{})
        self.context = moose.PyMooseBase.getContext()
        self.cell = moose.Cell( self.context.deepCopy(\
            self.context.pathToId('/library/'+cellname),self.context.pathToId('/'),cellname) )
        self.soma = moose.Compartment('/'+self.cellName+'/'+self.somaName)
        self.somaVm = setupTable('soma_vm', self.soma,'Vm')
        if cellname=='mitral':
            ## inject a current into tuft of mitral
            tuftcomp = moose.Compartment('/'+self.cellName+'/Seg0_glom_81_102')
            tuftcomp.inject = injtuft
            ## inject a current into soma of mitral
            self.soma.inject = injsoma
            ## if nerve shock, inject a sharp current into tuft compartments
            if nerve_shock:
                ## We want a single sharp current injection at SETTLETIME, so cannot use soma.inject
                ## segment info - see MorphML_reader.py
                ## Only connect to 25 tuft compartments
                for seginfo in (self.cellsDict[self.cellName].values())[0:num_tuft_comps_shock]:
                    ## seginfo[5] is a list of potential synapses at this segment
                    if 'ORN_mitral' in seginfo[5]:
                        ## wrap this segment, seginfo[0] is segment name
                        tuftcomp = moose.Compartment('/'+self.cellName+'/'+seginfo[0])
                    ## compartment, name_extn, start_time, duration, current (all SI)
                    setup_iclamp(tuftcomp, '_nerveshock',\
                        SETTLETIME, 1e-3, tuft_shock_inject)

        self.spikeTableList = []
        self.attachSpikeTables()
        #printCellTree(self.cell)

        if cellname=='mitral':
            ## monitor Vm at the base of the tuft
            tuftbase_seg = moose.Compartment('/'+self.cellName+\
                #'/Seg0_tuftden_19_23') # for migliore and shepherd 2007 cell
                '/Seg0_prim_dend_5_20') # tuft base
            self.tuftBaseTable = setupTable('mitdendTable',tuftbase_seg,'Vm')

            ## monitor Vm at secondary dendrite
            dend_seg = moose.Compartment('/'+self.cellName+\
                #'/Seg0_sec_dendp4_0_254') # at 43.86 microns from soma
                #'/Seg0_sec_dendd3_0_204') # at 190.56 microns from soma
                '/Seg0_sec_dendd4_2_269') # at 1004.47 microns from soma
            self.secDendTable = setupTable('mitdendTable',dend_seg,'Vm')

            ## monitor Vm in the tuft compartment
            ## same as current injection above
            self.tuftTable = setupTable('mitTuftTable',tuftcomp,'Vm')