Пример #1
0
from neuromllite import Network, Cell, InputSource, Population, Synapse
from neuromllite import Projection, RandomConnectivity, Input, Simulation
import sys

################################################################################
###   Build new network

net = Network(id='PopExample')
net.notes = 'Testing...'

net.seed = 1234

net.parameters = { 'N': 10, 'fractionE': 0.8, 'weightInput': 1, 'Wei':0.01, 'Wie':0.01}


cell = Cell(id='iafcell', pynn_cell='IF_cond_alpha')
cell.parameters = { "tau_refrac":0}
net.cells.append(cell)


input_source = InputSource(id='poissonFiringSyn100Hz', neuroml2_source_file='inputs.nml')
net.input_sources.append(input_source)

                           
net.input_sources.append(input_source)


pE = Population(id='Epop', size='int(N*fractionE)', component=cell.id, properties={'color':'.7 0 0'})
pI = Population(id='Ipop', size='N - int(N*fractionE)', component=cell.id, properties={'color':'0 0 .7'})
Пример #2
0
def generate(ref, np2=0, np5=0, nb2=0, nb5=0, recordTraces='*'):
    ################################################################################
    ###   Build new network

    net = Network(id=ref)
    net.notes = 'Example: %s...' % ref

    net.seed = 7890
    net.temperature = 32

    net.parameters = {
        'np2': np2,
        'np5': np5,
        'nb2': nb2,
        'nb5': nb5,
        'offset_curr_l2p': -0.05,
        'weight_bkg_l2p': 0.01,
        'weight_bkg_l5p': 0.01
    }

    l2p_cell = Cell(id='CELL_HH_reduced_L2Pyr',
                    neuroml2_source_file='../CELL_HH_reduced_L2Pyr.cell.nml')
    net.cells.append(l2p_cell)
    l5p_cell = Cell(id='CELL_HH_reduced_L5Pyr',
                    neuroml2_source_file='../CELL_HH_reduced_L5Pyr.cell.nml')
    net.cells.append(l5p_cell)
    l2b_cell = Cell(id='CELL_HH_simple_L2Basket',
                    neuroml2_source_file='../CELL_HH_simple_L2Basket.cell.nml')
    net.cells.append(l2b_cell)
    l5b_cell = Cell(id='CELL_HH_simple_L5Basket',
                    neuroml2_source_file='../CELL_HH_simple_L5Basket.cell.nml')
    net.cells.append(l5b_cell)

    input_source_poisson100 = InputSource(id='poissonFiringSyn100Hz',
                                          neuroml2_source_file='../inputs.nml')
    net.input_sources.append(input_source_poisson100)

    input_offset_curr_l2p = InputSource(id='input_offset_curr_l2p',
                                        pynn_input='DCSource',
                                        parameters={
                                            'amplitude': 'offset_curr_l2p',
                                            'start': 0,
                                            'stop': 1e9
                                        })

    net.input_sources.append(input_offset_curr_l2p)

    l2 = RectangularRegion(id='L2',
                           x=0,
                           y=1000,
                           z=0,
                           width=1000,
                           height=10,
                           depth=1000)
    net.regions.append(l2)
    l5 = RectangularRegion(id='L5',
                           x=0,
                           y=0,
                           z=0,
                           width=1000,
                           height=10,
                           depth=1000)
    net.regions.append(l5)

    #https://github.com/OpenSourceBrain/OpenCortex
    import opencortex.utils.color as occ

    pop_l2p = Population(id='pop_l2p',
                         size='np2',
                         component=l2p_cell.id,
                         properties={'color': occ.L23_PRINCIPAL_CELL},
                         random_layout=RandomLayout(region=l2.id))
    net.populations.append(pop_l2p)
    pop_l5p = Population(id='pop_l5p',
                         size='np5',
                         component=l5p_cell.id,
                         properties={'color': occ.L5_PRINCIPAL_CELL},
                         random_layout=RandomLayout(region=l5.id))
    net.populations.append(pop_l5p)
    pop_l2b = Population(id='pop_l2b',
                         size='nb2',
                         component=l2b_cell.id,
                         properties={'color': occ.L23_INTERNEURON},
                         random_layout=RandomLayout(region=l2.id))
    net.populations.append(pop_l2b)
    pop_l5b = Population(id='pop_l5b',
                         size='nb5',
                         component=l5b_cell.id,
                         properties={'color': occ.L5_INTERNEURON},
                         random_layout=RandomLayout(region=l5.id))
    net.populations.append(pop_l5b)

    # L2 -> L2
    _add_projection(pop_l2p,
                    pop_l2b,
                    'AMPA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l2b,
                    pop_l2p,
                    'L2Pyr_GABAA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l2b,
                    pop_l2p,
                    'L2Pyr_GABAB',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)

    # L2 -> L5
    _add_projection(pop_l2p,
                    pop_l5p,
                    'L5Pyr_AMPA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l2p,
                    pop_l5b,
                    'AMPA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l2b,
                    pop_l5p,
                    'L5Pyr_GABAA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)

    # L5 -> L5
    _add_projection(pop_l5p,
                    pop_l5b,
                    'AMPA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l5b,
                    pop_l5p,
                    'L5Pyr_GABAA',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)
    _add_projection(pop_l5b,
                    pop_l5p,
                    'L5Pyr_GABAB',
                    delay=0,
                    weight=0.001,
                    probability=0.8,
                    net=net)

    net.inputs.append(
        Input(id='stim_%s' % pop_l2p.id,
              input_source=input_source_poisson100.id,
              population=pop_l2p.id,
              percentage=100,
              weight='weight_bkg_l2p'))
    net.inputs.append(
        Input(id='stim_%s' % pop_l5p.id,
              input_source=input_source_poisson100.id,
              population=pop_l5p.id,
              percentage=100,
              weight='weight_bkg_l5p'))

    print(net.to_json())
    new_file = net.to_json_file('%s.json' % net.id)

    ################################################################################
    ###   Build Simulation object & save as JSON

    sim = Simulation(id='Sim%s' % net.id,
                     network=new_file,
                     duration='500',
                     seed='1111',
                     dt='0.025',
                     recordTraces={'all': recordTraces},
                     recordSpikes={'all': '*'})

    sim.to_json_file()
    print(sim.to_json())

    return sim, net
Пример #3
0
from neuromllite import Network, Cell, InputSource, Population, Synapse
from neuromllite import Projection, RandomConnectivity, Input, Simulation
import sys

################################################################################
###   Build new network

net = Network(id="Example8_Extension")
net.notes = "Example 8: general testing..."

net.seed = 7890
net.temperature = 32.0

net.parameters = {"N": 10, "fractionE": 0.8, "weightInput": 1}

cell = Cell(id="hhcell", neuroml2_source_file="test_files/hhcell.cell.nml")
net.cells.append(cell)


input_source = InputSource(
    id="poissonFiringSyn", neuroml2_source_file="test_files/inputs.nml"
)
net.input_sources.append(input_source)
"""
input_source = InputSource(id='iclamp0',
                           pynn_input='DCSource',
                           parameters={'amplitude':0.2, 'start':100., 'stop':900.})"""

net.input_sources.append(input_source)