Пример #1
0
def createExportNeuroML2(netParams=None,
                         simConfig=None,
                         reference=None,
                         connections=True,
                         stimulations=True,
                         output=False):
    ''' Sequence of commands to create and export network to NeuroML2 '''
    import __main__ as top
    if not netParams: netParams = top.netParams
    if not simConfig: simConfig = top.simConfig

    sim.initialize(
        netParams,
        simConfig)  # create network object and set cfg and net params
    pops = sim.net.createPops()  # instantiate network populations
    cells = sim.net.createCells(
    )  # instantiate network cells based on defined populations
    conns = sim.net.connectCells(
    )  # create connections between cells based on params
    stims = sim.net.addStims(
    )  # add external stimulation to cells (IClamps etc)
    simData = sim.setupRecording(
    )  # setup variables to record for each cell (spikes, V traces, etc)
    sim.exportNeuroML2(
        reference, connections,
        stimulations)  # export cells and connectivity to NeuroML 2 format

    if output: return (pops, cells, conns, stims, simData)
Пример #2
0
def load(filename,
         simConfig=None,
         output=False,
         instantiate=True,
         createNEURONObj=True):
    ''' Sequence of commands load, simulate and analyse network '''
    import sim
    sim.initialize()  # create network object and set cfg and net params
    sim.cfg.createNEURONObj = createNEURONObj
    sim.loadAll(filename,
                instantiate=instantiate,
                createNEURONObj=createNEURONObj)
    if simConfig:
        sim.setSimCfg(simConfig)  # set after to replace potentially loaded cfg
    if len(sim.net.cells) == 0 and instantiate:
        pops = sim.net.createPops()  # instantiate network populations
        cells = sim.net.createCells(
        )  # instantiate network cells based on defined populations
        conns = sim.net.connectCells(
        )  # create connections between cells based on params
        stims = sim.net.addStims(
        )  # add external stimulation to cells (IClamps etc)
    simData = sim.setupRecording(
    )  # setup variables to record for each cell (spikes, V traces, etc)

    if output:
        try:
            return (pops, cells, conns, stims, simData)
        except:
            pass