示例#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, 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()
示例#3
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!"
 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()
示例#5
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')
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)

from pylab import *

SETTLETIME = 0.25 # s
RUNTIME = 1.0+SETTLETIME # s
SIMDT = 5e-6 #s
PLOTDT = 5e-6 #s
                        
if __name__ == "__main__":
    load_synapses(1.0)
    idx = test_synapse_index
    syn_name = synapse_names[idx]
    context = moose.PyMooseBase.getContext()

    soma = moose.Compartment('/soma')
    soma.length = 1e-6 # m
    soma.diameter = 1e-6 # m
    soma.Cm = 0.01 * 3.14159 * soma.length * soma.diameter

    synid = context.deepCopy(context.pathToId('/library/'+syn_name),soma.id,syn_name)
    syn = moose.SynChan(synid)
    #### connect the soma to the synapse
    if syn.getField('mgblock')=='True': # If NMDA synapse based on mgblock, connect to mgblock
        mgblock = moose.Mg_block(syn.path+'/mgblock')
        compartment_connection = mgblock
示例#7
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!"
    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')
import operator # has itemgetter() for sorted()

sys.path.extend(["..","../neuroml","../cells","../channels","../networks","../simulations"])
from neuroml_utils import *
from sim_utils import * # has build_tweaks()
from networkConstants import *
## these are needed to load mitral cell and get segids and synapse locations
from load_channels import *
from load_synapses import *
from load_cells import *
from simset_odor import * # has synchan_activation_correction
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)
## cellSegmentDict[<cellname>] = { segid1 : [ segname,(proximalx,proximaly,proximalz),
##     (distalx,distaly,distalz),diameter,length,[potential_syn1, ... ] ] , ... }
cellSegmentDict = load_cells()

from pylab import *

## USAGE:
## python2.6 plot_mitral_connectivity_NetworkML.py <networkmlfile.xml>
## OR
## python2.6 plot_mitral_connectivity_NetworkML.py SYN_DECAY
## The plots are for weights and numbers of all exc/inh synapses on the central/lateral mitrals.
## The printing on the terminal gives weights located proximally vs distally from central mits.

TWOGLOMS = False#True # whether to check for mits 0,2 (True) or 0,1 (False)
INCLUDEMULTIS = True # whether to include multi-s in joint connectivity
示例#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)

from pylab import *

SETTLETIME = 0.25  # s
RUNTIME = 1.0 + SETTLETIME  # s
SIMDT = 5e-6  #s
PLOTDT = 5e-6  #s

if __name__ == "__main__":
    load_synapses(1.0)
    idx = test_synapse_index
    syn_name = synapse_names[idx]
    context = moose.PyMooseBase.getContext()

    soma = moose.Compartment('/soma')
    soma.length = 1e-6  # m
    soma.diameter = 1e-6  # m
    soma.Cm = 0.01 * 3.14159 * soma.length * soma.diameter

    synid = context.deepCopy(context.pathToId('/library/' + syn_name), soma.id,
                             syn_name)
    syn = moose.SynChan(synid)
    #### connect the soma to the synapse
    if syn.getField(
            'mgblock'