Пример #1
0
    def subplot(self, subplotspec):
        gs = gridspec.GridSpecFromSubplotSpec(2, 4, subplot_spec=subplotspec)
        plots = {}
        dsv = param_filter_query(self.datastore,
                                 sheet_name=[
                                     'V1_Exc_L4', 'V1_Inh_L4', 'V1_Exc_L2/3',
                                     'V1_Inh_L2/3'
                                 ])
        for i, sheet in enumerate(dsv.sheets()):
            dsv1 = param_filter_query(dsv,
                                      sheet_name=sheet,
                                      value_name='LGNAfferentOrientation')
            plots[sheet + 'A'] = (PerNeuronValuePlot(dsv1, ParameterSet({})),
                                  gs[0, i], {})

            dsv1 = param_filter_query(
                dsv,
                sheet_name=sheet,
                value_name='orientation preference',
                analysis_algorithm=
                'PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',
                st_contrast=100)
            plots[sheet + 'B'] = (PerNeuronValuePlot(dsv1, ParameterSet({})),
                                  gs[1, i], {
                                      'title': None
                                  })
        return plots
Пример #2
0
def string_table_ParameterSet(tablestring):
    """Convert a table written as a multi-line string into a dict of dicts."""
    tabledict = ParameterSet({})
    rows = tablestring.strip().split('\n')
    column_headers = rows[0].split()
    for row in rows[1:]:
        row = row.split()
        row_header = row[0]
        tabledict[row_header] = ParameterSet({})
        for col_header, item in zip(column_headers[1:], row[1:]):
            tabledict[row_header][col_header] = float(item)
    return tabledict
Пример #3
0
 def theta_E(self, im, X_, Y_, w):
     try:
         assert (self.slip.N_X == im.shape[1])
     except:
         from NeuroTools.parameters import ParameterSet
         from SLIP import Image
         from LogGabor import LogGabor
         self.slip = Image(
             ParameterSet({
                 'N_X': im.shape[1],
                 'N_Y': im.shape[0]
             }))
         self.lg = LogGabor(self.slip)
     im_ = im.sum(axis=-1)
     im_ = im_ * np.exp(-.5 * ((.5 + .5 * self.slip.x - Y_)**2 +
                               (.5 + .5 * self.slip.y - X_)**2) / w**2)
     E = np.zeros((self.N_theta, ))
     for i_theta, theta in enumerate(self.thetas):
         params = {
             'sf_0': self.sf_0,
             'B_sf': self.B_sf,
             'theta': theta,
             'B_theta': np.pi / self.N_theta
         }
         FT_lg = self.lg.loggabor(0, 0, **params)
         E[i_theta] = np.sum(
             np.absolute(
                 self.slip.FTfilter(np.rot90(im_, -1), FT_lg,
                                    full=True))**2)
     return E
Пример #4
0
def run(parameters, sim_list):
    sim_time = parameters.sim_time
    spike_interval = parameters.spike_interval

    stgen = StGen()
    seed = parameters.seed
    stgen.seed(seed)

    model_parameters = ParameterSet({
        'system':
        parameters.system,
        'input_spike_times':
        stgen.poisson_generator(1000.0 / spike_interval,
                                t_stop=sim_time,
                                array=True),
        'cell_type':
        parameters.cell.type,
        'cell_parameters':
        parameters.cell.params,
        'plasticity': {
            'short_term': None,
            'long_term': None
        },
        'weights':
        parameters.weights,
        'delays':
        parameters.delays,
    })

    networks = MultiSim(sim_list, SimpleNetwork, model_parameters)
    networks.run(sim_time)
    spike_data = networks.get_spikes()
    vm_data = networks.get_v()
    networks.end()
    return spike_data, vm_data, model_parameters
Пример #5
0
 def get_pe(self, pe):
     if type(pe) is tuple:
         return ParameterSet({'N_X': pe[0], 'N_Y': pe[1]})
     elif type(pe) is ParameterSet:
         return pe
     elif type(pe) is dict:
         return ParameterSet(pe)
     elif type(pe) is np.ndarray:
         return ParameterSet({'N_X': pe.shape[0], 'N_Y': pe.shape[1]})
     elif type(pe) is str:
         im = imread(pe)
         if not type(im) is np.ndarray:  #  loading an image failed
             return ParameterSet(pe)
         else:
             return ParameterSet({'N_X': im.shape[0], 'N_Y': im.shape[1]})
     else:
         self.log.error('could not guess what the init variable is')
def setup_experiments(simulation_name,sim):
    # Read parameters
    if len(sys.argv) > 1:
        parameters_url = sys.argv[1]
    else:
        raise ValueError , "No parameter file supplied"
    
    parameters = ParameterSet(parameters_url) 
    
    # Create results directory
    timestamp = datetime.now().strftime('%Y%m%d-%H%M%S')
    Global.root_directory =  parameters.results_dir + simulation_name + '_' + timestamp + '/'
    os.mkdir(Global.root_directory)
    parameters.save(Global.root_directory + "parameters", expand_urls=True)
    
    setup_logging()
    return parameters
Пример #7
0
    def __init__(self, initializer):
        import types
        ps = initializer

        # try to create a ParameterSet from ps if
        # it is not one already
        if not isinstance(ps, ParameterSet):
            # create ParameterSet, but allowing SchemaBase derived objects
            ps = ParameterSet(ps, update_namespace=schema_checkers_namespace)

        # convert each element
        for x in ps.flat():
            key = x[0]
            value = x[1]
            if isinstance(value, SchemaBase):
                self.flat_add(key, value)
            else:
                self.flat_add(key, Subclass(type=type(value)))
Пример #8
0
    def __init__(self, initializer):
        import types
        ps = initializer

        # try to create a ParameterSet from ps if
        # it is not one already
        if not isinstance(ps, ParameterSet):
            # create ParameterSet, but allowing SchemaBase derived objects
            ps = ParameterSet(ps, update_namespace=schema_checkers_namespace)

        # convert each element
        for x in ps.flat():
            key = x[0]
            value = x[1]
            if isinstance(value, SchemaBase):
                self.flat_add(key, value)
            else:
                self.flat_add(key, Subclass(type=type(value)))
Пример #9
0
    def __init__(self, N=100):
        # simulator specific
        simulation_params = ParameterSet({
            'dt': 0.1,  # discretization step in simulations (ms)
            'simtime': 40000 * 0.1,  # float; (ms)
            'syn_delay': 1.0,  # float; (ms)
            'kernelseed': 4321097,  # array with one element per thread
            'connectseed':
            12345789  # seed for random generator(s) used during simulation
        })
        # these may change
        self.params = ParameterSet(
            {
                'simulation': simulation_params,
                'N': N,
                'noise_std':
                6.0,  # (nA??) standard deviation of the internal noise
                'snr': 1.0,  # (nA??) size of the input signal
                'weight': 1.0
            },
            label="fiber_params")

        print self.params.pretty()
Пример #10
0
    def subplot(self, subplotspec):
        gs = gridspec.GridSpecFromSubplotSpec(12,
                                              18,
                                              subplot_spec=subplotspec,
                                              hspace=1.0,
                                              wspace=1.0)

        return {
            'Layer4Exc': (PlotTuningCurve(
                self.datastore,
                ParameterSet({
                    'parameter_name': 'orientation',
                    'neurons': self.parameters.l4_exc_neurons,
                    'sheet_name': 'V1_Exc_L4'
                })), gs[0:3, :], {}),
            'Layer4Inh': (PlotTuningCurve(
                self.datastore,
                ParameterSet({
                    'parameter_name': 'orientation',
                    'neurons': self.parameters.l4_inh_neurons,
                    'sheet_name': 'V1_Inh_L4'
                })), gs[3:6, :], {}),
            'Layer23Exc': (PlotTuningCurve(
                self.datastore,
                ParameterSet({
                    'parameter_name': 'orientation',
                    'neurons': self.parameters.l23_exc_neurons,
                    'sheet_name': 'V1_Exc_L2/3'
                })), gs[6:9, :], {}),
            'Layer23Inh': (PlotTuningCurve(
                self.datastore,
                ParameterSet({
                    'parameter_name': 'orientation',
                    'neurons': self.parameters.l23_inh_neurons,
                    'sheet_name': 'V1_Inh_L2/3'
                })), gs[9:12, :], {}),
        }
def make_param_dict_list():
    """
    create a list of parameter dictionaries for the model network.
    """
    # there is certainly a way to do this with NeuroTools.
    import numpy
    rates = numpy.linspace(start=10., stop=100., num=5)
    weights = numpy.linspace(start=0.1, stop=1.0, num=5)
    from NeuroTools.parameters import ParameterSet, ParameterSpace, ParameterRange
    params = ParameterSpace(
        ParameterSet({
            'rate': ParameterRange(rates),
            'weight': ParameterRange(weights)
        }))
    dictlist = [p.as_dict() for p in params.iter_inner()]
    return dictlist
Пример #12
0
def test(sim):
    
    params = ParameterSet({
        'system': { 'timestep': 0.1, 'min_delay': 0.1, 'max_delay': 10.0 },
        'input_spike_times': numpy.arange(5,105,10.0),
        'cell_type': 'IF_curr_exp',
        'cell_parameters': {},
        'plasticity': { 'short_term': None, 'long_term': None },
        'weights': 0.1,
        'delays': 1.0,
    })
    SimpleNetwork.check_parameters(params)
    net = SimpleNetwork(sim, params)
    sim.run(100.0)
    id = net.get_v()['post'].id_list()[0]
    print id
    print net.get_v()['post'][id]
    def __init__(self,N=100):
        # simulator specific
        simulation_params = ParameterSet({'dt'        : 0.1,# discretization step in simulations (ms)
                    'simtime'   : 40000*0.1,      # float; (ms)
                    'syn_delay' : 1.0,         # float; (ms)
                    'kernelseed' : 4321097,       # array with one element per thread
                    'connectseed' : 12345789  # seed for random generator(s) used during simulation
                    })
        # these may change
        self.params = ParameterSet({'simulation': simulation_params,
                        'N'         : N,
                        'noise_std' : 6.0,       # (nA??) standard deviation of the internal noise
                        'snr'       : 1.0,      # (nA??) size of the input signal
                        'weight'    : 1.0 },
                        label="fiber_params")

        print self.params.pretty()
Пример #14
0
    def subplot(self, subplotspec):
        gs = gridspec.GridSpecFromSubplotSpec(16, 1, subplot_spec=subplotspec)
        plots = {}
        dsv = param_filter_query(self.datastore,
                                 sheet_name=[
                                     'V1_Exc_L4', 'V1_Inh_L4', 'V1_Exc_L2/3',
                                     'V1_Inh_L2/3'
                                 ])
        print dsv.sheets()
        print['V1_Exc_L4', 'V1_Inh_L4', 'V1_Exc_L2/3', 'V1_Inh_L2/3']
        for i, sheet in enumerate(
            ['V1_Exc_L4', 'V1_Inh_L4', 'V1_Exc_L2/3', 'V1_Inh_L2/3']):
            dsv1 = param_filter_query(data_store,
                                      value_name=['orientation HWHH'],
                                      sheet_name=sheet)
            plots[sheet] = (PerNeuronValueScatterPlot(dsv1, ParameterSet({})),
                            gs[i * 4:i * 4 + 3, 0], {})

        return plots
Пример #15
0
from NeuroTools.parameters import ParameterSet
from NeuroTools.parameters import ParameterRange
from NeuroTools.parameters import ParameterTable

p = ParameterSet({})
p.orientation = ParameterTable("""
#           RS  RSa RSb FS FSa FSb 
RS          15. 15. 12  13  12  1
FS          15. 15.  9 2    2  9
LGN          0.  12. 0  2  0  0
V2            3.  2. 2   2  9 7
M1            0.  0. 8 2  2   1
""")
p.a = 23
p.b = ParameterSet({})
p.b.s = ParameterRange([1, 2, 3])
p.b.w = ParameterTable("""
#           RS  FS
all          1. 0.
none         -1. -2.
""")
p.name = 'first experiment'
p.simulator = 'pyNN'

p.export('exported_model_parameters.tex', format='latex', **{'indent': 1.5})
class FiberChannel(object):
    """
    Model class for the fiber of simple neurons.

    """
    def __init__(self,N=100):
        # simulator specific
        simulation_params = ParameterSet({'dt'        : 0.1,# discretization step in simulations (ms)
                    'simtime'   : 40000*0.1,      # float; (ms)
                    'syn_delay' : 1.0,         # float; (ms)
                    'kernelseed' : 4321097,       # array with one element per thread
                    'connectseed' : 12345789  # seed for random generator(s) used during simulation
                    })
        # these may change
        self.params = ParameterSet({'simulation': simulation_params,
                        'N'         : N,
                        'noise_std' : 6.0,       # (nA??) standard deviation of the internal noise
                        'snr'       : 1.0,      # (nA??) size of the input signal
                        'weight'    : 1.0 },
                        label="fiber_params")

        print self.params.pretty()

    def run(self,params, verbose =True):
        tmpdir = tempfile.mkdtemp()
        timer = Timer()
        timer.start() # start timer on construction

        # === Build the network ========================================================
        if verbose: print "Setting up simulation"
        sim.setup(timestep=params.simulation.dt,max_delay=params.simulation.syn_delay, debug=False)

        N = params.N
        #dc_generator
        current_source = sim.DCSource(  amplitude= params.snr,
                                        start=params.simulation.simtime/4,
                                        stop=params.simulation.simtime/4*3)
        
        # internal noise model (NEST specific)
        noise = sim.Population(N,'noise_generator',{'mean':0.,'std':params.noise_std}) 
        # target population
        output = sim.Population(N , sim.IF_cond_exp)

        # initialize membrane potential
        numpy.random.seed(params.simulation.kernelseed)
        V_rest, V_spike = -70., -53.
        output.tset('v_init',V_rest + numpy.random.rand(N,)* (V_spike -V_rest))

        #  Connecting the network
        conn = sim.OneToOneConnector(weights = params.weight)
        sim.Projection(noise, output, conn)

        for cell in output:
            cell.inject(current_source)

        output.record()

        # reads out time used for building
        buildCPUTime= timer.elapsedTime()

        # === Run simulation ===========================================================
        if verbose: print "Running simulation"

        timer.reset() # start timer on construction
        sim.run(params.simulation.simtime)
        simCPUTime = timer.elapsedTime()

        timer.reset()  # start timer on construction

        output_filename = os.path.join(tmpdir,'output.gdf')
        #print output_filename
        output.printSpikes(output_filename)#
        output_DATA = load_spikelist(output_filename,N,
                                        t_start=0.0, t_stop=params.simulation.simtime)
        writeCPUTime = timer.elapsedTime()

        if verbose:
            print "\nFiber Network Simulation:"
            print "Number of Neurons  : ", N
            print "Mean Output rate    : ", output_DATA.mean_rate(), "Hz during ",params.simulation.simtime, "ms"
            print("Build time             : %g s" % buildCPUTime)
            print("Simulation time        : %g s" % simCPUTime)
            print("Writing time           : %g s" % writeCPUTime)

        os.remove(output_filename)
        os.rmdir(tmpdir)

        return output_DATA
Пример #17
0
from NeuroTools.parameters import ParameterSet
from NeuroTools.parameters import ParameterRange
from NeuroTools.parameters import ParameterTable



p = ParameterSet({})
p.orientation = ParameterTable("""
#           RS  RSa RSb FS FSa FSb 
RS          15. 15. 12  13  12  1
FS          15. 15.  9 2    2  9
LGN          0.  12. 0  2  0  0
V2            3.  2. 2   2  9 7
M1            0.  0. 8 2  2   1
""")
p.a = 23
p.b = ParameterSet({})
p.b.s = ParameterRange([1,2,3])
p.b.w = ParameterTable("""
#           RS  FS
all          1. 0.
none         -1. -2.
""")
p.name = 'first experiment'
p.simulator = 'pyNN'



p.export('exportetd_model_parameters.tex',format='latex',**{'indent':1.5})
Пример #18
0
active = None
uuid = None
e = None
sigma = None
v_init = None
section_syn = None
simulated = None
my = None
electrode_r = None
randomseed = None

# Grab command line input
parametersetfile = sys.argv[1]
if not os.path.isfile(parametersetfile):
    raise Exception, 'provide parameterset filename on command line'
PSet = ParameterSet(parametersetfile)

#create some variables from parameter set
for i in PSet.iterkeys():
    vars()[i] = PSet[i]

psetid = PSet['uuid']

print('Current simulation are using ParameterSet:')
print PSet.pretty()

#create folder to save data if it doesnt exist
datafolder = os.path.join('savedata', psetid)
if not os.path.isdir(datafolder):
    os.system('mkdir %s' % datafolder)
    print 'created folder %s!' % datafolder
Пример #19
0
    #jens_model.connectors['V1L4InhL4ExcConnection'].store_connections(data_store)
    #jens_model.connectors['V1L4InhL4InhConnection'].store_connections(data_store)
    #jens_model.connectors['V1ExcL23ExcL23Connection'].store_connections(data_store)
    #jens_model.connectors['V1ExcL23InhL23Connection'].store_connections(data_store)
    #jens_model.connectors['V1InhL23ExcL23Connection'].store_connections(data_store)
    #jens_model.connectors['V1InhL23InhL23Connection'].store_connections(data_store)
    #jens_model.connectors['V1ExcL4ExcL23Connection'].store_connections(data_store)

    logger.info('Saving Datastore')
    if (not MPI) or (mpi_comm.rank == MPI_ROOT):
        data_store.save()
else:
    setup_logging()
    #data_store = PickledDataStore(load=True,parameters=ParameterSet({'root_directory':'/media/antolikjan/New Volume/DATA/mozaik/PushPullCCLISSOMModel/OR'}),replace=True)
    data_store = PickledDataStore(load=True,
                                  parameters=ParameterSet(
                                      {'root_directory': 'E'}),
                                  replace=True)
    logger.info('Loaded data store')

import resource

print "Current memory usage: %iMB" % (
    resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / (1024))

pref_or = numpy.pi / 2

#find neuron with preference closet to pref_or
l4_analog_ids = param_filter_query(
    data_store,
    sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids()
l4_analog_ids_inh = param_filter_query(
Пример #20
0
parameters = ParameterSet({
    'system': {
        'timestep': 0.01,
        'min_delay': 0.1,
        'max_delay': 10.0
    },
    'input_spike_times':
    stgen.poisson_generator(rate=1000.0 / spike_interval,
                            t_stop=sim_time,
                            array=True),
    'trigger_spike_times':
    stgen.poisson_generator(rate=1000.0 / spike_interval,
                            t_stop=sim_time,
                            array=True),
    'cell_type':
    'IF_curr_exp',
    'cell_parameters': {
        'tau_refrac': 10.0,
        'tau_m': 2.0,
        'tau_syn_E': 1.0
    },
    'plasticity': {
        'short_term': None,
        'long_term': {
            'timing_dependence': {
                'model': 'SpikePairRule',
                'params': {
                    'tau_plus': 20.0,
                    'tau_minus': 20.0
                }
            },
            'weight_dependence': {
                'model': 'AdditiveWeightDependence',
                'params': {
                    'w_min': 0,
                    'w_max': 0.1,
                    'A_plus': 0.01,
                    'A_minus': 0.01
                }
            },
            'ddf': 1.0,
        }
    },
    'weights':
    0.01,
    'delays':
    1.0,
})
Пример #21
0
from NeuroTools.parameters import ParameterSet
from NeuroTools.parameters import ParameterRange
import corr_SDNSD as st
import pyNN.nest as sim
from NeuroTools.sandbox import make_name
from NeuroTools.sandbox import check_name
import numpy

p = ParameterSet({})
# Parameters for neuronal features
p.vm = -65.
p.th = -50.
p.tau_synE = 0.3
p.tau_synI = 2.
p.E_ex = 0.
p.E_in = -70.
p.ie = 0.
p.cm = 500.
p.gL = 25.
p.tref = 2.

# Parameters for running
p.timestep = 0.1
p.min_delay = 0.1
p.max_delay = 5.1
p.runtime = 500000.

# Parameters for number and connections
p.r0 = 1400.  # excitatory input rate
p.ri = 1647.  # inhibitory input rate
p.je = 0.015  # excitatory synaptic weight
Пример #22
0
from mozaik.controller import run_experiments, setup_experiments, setup_logging
from mozaik.framework.population_selector import RCRandomPercentage
from mozaik.visualization.plotting import *
from mozaik.analysis.technical import NeuronAnnotationsToPerNeuronValues
from mozaik.storage.datastore import Hdf5DataStore, PickledDataStore
from NeuroTools.parameters import ParameterSet
from mozaik.storage.queries import *
import mozaik

logger = mozaik.getMozaikLogger("Mozaik")

if True:
    params = setup_experiments('FFI', sim)
    jens_model = VogelsAbbott(sim, params)
    l4exc_kick = RCRandomPercentage(jens_model.sheets["V1_Exc_L4"],
                                    ParameterSet({'percentage': 20.0}))
    l4inh_kick = RCRandomPercentage(jens_model.sheets["V1_Inh_L4"],
                                    ParameterSet({'percentage': 20.0}))

    experiment_list = [
        #Lets kick the network up into activation
        PoissonNetworkKick(
            jens_model,
            duration=10 * 10 * 7,
            sheet_list=["V1_Exc_L4", "V1_Inh_L4"],
            recording_configuration_list=[l4exc_kick, l4inh_kick],
            lambda_list=[100, 100]),
        #Spontaneous Activity
        NoStimulation(jens_model, duration=70 * 7),
    ]
    data_store = run_experiments(jens_model, experiment_list)
Пример #23
0
from model import VogelsAbbott
from mozaik.controller import run_experiments, setup_experiments, setup_logging
from mozaik.framework.population_selector import RCRandomPercentage
from mozaik.visualization.plotting import *
from mozaik.analysis.technical import NeuronAnnotationsToPerNeuronValues
from mozaik.storage.datastore import Hdf5DataStore,PickledDataStore
from NeuroTools.parameters import ParameterSet
from mozaik.storage.queries import *
import mozaik

logger = mozaik.getMozaikLogger("Mozaik")

if True:
    params = setup_experiments('FFI',sim)    
    jens_model = VogelsAbbott(sim,params)
    l4exc_kick = RCRandomPercentage(jens_model.sheets["V1_Exc_L4"],ParameterSet({'percentage': 20.0}))
    l4inh_kick = RCRandomPercentage(jens_model.sheets["V1_Inh_L4"],ParameterSet({'percentage': 20.0}))

    experiment_list =   [
                           #Lets kick the network up into activation
                           PoissonNetworkKick(jens_model,duration=70*7,sheet_list=["V1_Exc_L4","V1_Inh_L4"],recording_configuration_list=[l4exc_kick,l4inh_kick],lambda_list=[100,100]),
                           #Spontaneous Activity 
                           NoStimulation(jens_model,duration=70*7),
                        ]
    data_store = run_experiments(jens_model,experiment_list)
    #jens_model.connectors['V1L4ExcL4ExcConnection'].store_connections(data_store)    
    #jens_model.connectors['V1L4ExcL4InhConnection'].store_connections(data_store)    
    #jens_model.connectors['V1L4InhL4ExcConnection'].store_connections(data_store)    
    #jens_model.connectors['V1L4InhL4InhConnection'].store_connections(data_store)    
    logger.info('Saving Datastore')
    data_store.save()
Пример #24
0
 def __init__(self, input=None):
     self.parameters = ParameterSet({'a': 1, 'b': 2})
     self.parameters._url = "http://www.example.com/parameters"
     self.version = 0.1
     self.input = input
     self.data = range(1000)
Пример #25
0
    def __init__(self, N=1000):
        """
        Default parameters for the retina of size NxN.

        Sets up parameters and the whole structure of the dictionary / HDF file in url.
        It contains all relevant parameters and stores them to a dictionary for
         clarity &future compatibility with XML exports.

        """
        #try :
        #    url = "https://neuralensemble.org/svn/NeuroTools/trunk/examples/retina/retina.param"
        #    self.params = ParameterSet(url)
        #    print "Loaded parameters from SVN"
        #except :
        params = {}  # a dictionary containing all parameters
        # === Define parameters ========================================================
        # LUP: get running file name and include script in HDF5?

        params = {
            'description': 'default retina',
            'N':
            N,  # integer;  square of total number of Ganglion Cells LUP: how do we include types and units in parameters? (or by default it is a float in ISO standards) TODO: go rectangular
            'N_ret': .2,  # float;  diameter of Ganglion Cell's RF (max: 1)
            'K_ret': 4.0,  # float; ratio of center vs. surround in DOG
            'dt': 0.1,  # discretization step in simulations (ms)
            'simtime': 40000 * 0.1,  # float; (ms)
            'syn_delay': 1.0,  # float; (ms)
            'noise_std': 5.0,  # (nA) standard deviation of the internal noise
            'snr': 2.0,  # (nA) maximum signal
            'weight': 1.0,  #
            #'threads' : 2, 'kernelseeds' : [43210987, 394780234],      # array with one element per thread
            #'threads' : 1,
            'kernelseed': 4321097,  # array with one element per thread
            # seed for random generator used when building connections
            'connectseed':
            12345789,  # seed for random generator(s) used during simulation
            'initialized': datetime.datetime.now().isoformat(
            )  # the date in ISO 8601 format to avoid overriding old simulations
        }

        # retinal neurons parameters
        params['parameters_gc'] = {
            'Theta': -57.0,
            'Vreset': -70.0,
            'Vinit': -70.0,
            'TauR': 0.5,
            'gL': 28.95,
            'C': 289.5,
            'V_reversal_E': 0.0,
            'V_reversal_I': -75.0,
            'TauSyn_E': 1.5,
            'TauSyn_I': 10.0,
            'V_reversal_sfa': -70.0,
            'q_sfa': 0.,  #14.48,
            'Tau_sfa': 110.0,
            'V_reversal_relref': -70.0,
            'q_relref': 3214.0,
            'Tau_relref': 1.97
        }  #,'python':True}

        ## default input image # TODO add start and stop time
        # define the center of every neuron in normalized visual angle / retinal space

        #X,Y = numpy.meshgrid(numpy.linspace(-N/2, N/2,N),numpy.linspace(-N/2,N/2,N))
        X, Y = numpy.random.rand(N) * 2 - 1, numpy.random.rand(N) * 2 - 1

        # Generate a DOG excitation on the input layer of the GC
        # Based on the assumptions of the DOG model (Enroth-Cugell and Robson, 1966) that ganglion cells linearly add signals from both center and surround mechanisms for all points in space
        # this is the impulse response to a discrete dirac in the center to some specific luminance / excentricity value
        #   easy : extend to input images (simply by convoluting the image with this kernel)
        #   hard : extend to time varrying movies (not only a step)
        params['position'] = [X, Y]
        R2 = X**2 + Y**2
        N, N_ret, K_ret = params['N'], params['N_ret'], params['K_ret']
        amplitude = (numpy.exp(-R2 / (2 * N_ret**2)) - 1 / K_ret**2 *
                     numpy.exp(-R2 /
                               (2 * N_ret**2 * K_ret**2))) / (1 - 1 / K_ret**2)
        #amplitude *=  params['noise_std'] # scaled by the noise variance
        #file.setStructure({'amplitude' : amplitude }, "/build", createparents=True)
        params['amplitude'] = amplitude

        self.params = ParameterSet(params)
Пример #26
0
from NeuroTools.parameters import ParameterSet
import sys
from math import sqrt
from pyNN.space import Space, Grid2D

P = ParameterSet(sys.argv[1])

exec("import pyNN.%s as sim" % P.simulator)

sim.setup()

dx1 = dy1 = 500.0 / sqrt(P.n1)
dx2 = dy2 = 500.0 / sqrt(P.n2)
struct1 = Grid2D(dx=dx1, dy=dy1)
struct2 = Grid2D(dx=dx2, dy=dy2)

p1 = sim.Population(P.n1, sim.IF_cond_exp, structure=struct1)
p2 = sim.Population(P.n2, sim.IF_cond_exp, structure=struct2)

space = Space()
DDPC = sim.DistanceDependentProbabilityConnector
c = DDPC(P.d_expression, P.allow_self_connections, P.weights, P.delays, space,
         P.safe)

prj = sim.Projection(p1, p2, c)

sys.stdout.write(p1.describe().encode('utf-8'))
sys.stdout.write(p2.describe().encode('utf-8'))
sys.stdout.write(prj.describe().encode('utf-8'))

sim.end()
Пример #27
0
def get_LFP_parameters(parameter_set_file, ps_id):
    '''
    get parameter set for LFP sim corresponding to parameter set file
    
    Arguments
    ---------
    parameter_set_file : path
        full path to parameter set file
    ps_id : str
        unique identifier

    Returns
    -------
    PS : ParameterSpace
        neurotools.parameters.ParameterSpace object
    PSET : ParameterSet
        neurotools.parameters.ParameterSet object
    '''        
    #get corresponding parameterSet dictionary
    #iterate over different parameterspaces in dict
    PSET = None
    for key, PS in list(psc.ParameterSpaces.items()):
        for paramset in PS.iter_inner():
            #unique id for each parameter set, constructed from the parameset dict
            #converted to a sorted list of tuples
            id = helpers.get_unique_id(paramset)
            if ps_id == id:
                PSET = ParameterSet(os.path.join(psc.parameterset_dest, 
                                                  '{0}.pset'.format(ps_id)))
                #PSET = ParameterSet(paramset)
    
    if PSET is None:
        try:
            Warning('PSET is None, attempt loading .pset-file')
            PSET = ParameterSet(os.path.join(psc.parameterset_dest, 
                                                  '{0}.pset'.format(ps_id)))
        except NameError as ne:
            raise ne('parameterset id {} not in parameterspace.py or {}.pset file is not existing'.format(ps_id, ps_id))
        

    #set up the analysis class instance
    analysis = dsa.get_network_analysis_object(parameter_set_file, ps_id)
    
    #Set up class object with layer specificity of connections from
    #hybrid scheme implementation.
    
    #It is a convoluted way of doing it, but calculations of layer specificity of
    #connectsion and such rely on a bunch of intermediate calculations, and it
    #is not nice to do so when creating the ParameterSet object below. We'll use
    #it here as a placeholder of different parameters
    PARAMS = general_params(PSET, analysis)
    
    
    ################################################################################
    #Set up main parameters for hybrid scheme methods using the                    #
    #NeuroTools.parameters.ParameterSet class                                      #
    ################################################################################
    
    
    #set up file destinations differentiating between certain output
    PS = ParameterSet(dict(
        #Main folder of simulation output
        savefolder = os.path.join(psc.output_proc_prefix, ps_id),
        
        #make a local copy of main files used in simulations
        sim_scripts_path = os.path.join(psc.output_proc_prefix, ps_id,
                                        'sim_scripts'),
        
        #destination of single-cell output during simulation
        cells_path = os.path.join(psc.output_proc_prefix, ps_id, 'cells'),
        
        #destination of cell- and population-specific signals, i.e., compund LFPs,
        #CSDs etc.
        populations_path = os.path.join(psc.output_proc_prefix, ps_id,
                                        'populations'),
        
        #location of spike output from the network model
        spike_output_path = os.path.join(psc.output_proc_prefix, ps_id),
        
        #destination of figure file output generated during model execution
        figures_path = os.path.join(psc.output_proc_prefix, ps_id, 'figures')
    ))
    
    
    #parameters for class CachedTopoNetwork instance
    PS.update(dict(network_params = dict(
            simtime = PSET.t_sim,
            dt = PSET.dt,
            spike_output_path = PS.spike_output_path,
            label = PSET.spike_detector_label,
            ext = 'gdf',
            GIDs = PARAMS.GIDs,
            X = PARAMS.X,
            label_positions = PSET.position_filename_trunk,
        )))
    
    
    #population (and cell type) specific parameters
    PS.update(dict(
        #list of presynaptic neuron populations (network populations)
        X = PARAMS.X,
        
        #list of postsynaptic neuron populations
        Y = PARAMS.Y,
        
        #list of cell types y in each postsynaptic population Y 
        y = PARAMS.y,
        
        #population-specific LFPy.Cell parameters
        cellParams = PARAMS.yCellParams,
        
        #assuming excitatory cells are pyramidal
        rand_rot_axis = PARAMS.rand_rot_axis,
        
        #population sizes
        N_X = PARAMS.N_X,
        
        #kwargs passed to LFPy.Cell.simulate()
        simulationParams = dict(),
        
        #set up parameters corresponding to cylindrical model populations
        populationParams = PARAMS.populationParams,
        
        #set the boundaries between the "upper" and "lower" layer
        layerBoundaries = PARAMS.layerBoundaries,
        
        #set the geometry of the virtual recording device                       
        electrodeParams = dict(
                #contact locations:
                x = np.mgrid[-18:19:4, -18:19:4][1].flatten()*100,
                y = np.mgrid[-18:19:4, -18:19:4][0].flatten()*100,
                z = np.array([PARAMS.layerBoundaries.mean(axis=1)[1] for x in range(100)]), #center of layer 2/3
                #extracellular conductivity:
                sigma = 0.3,
                #contact surface normals, radius, n-point averaging
                N = [[0, 0, 1]]*100,
                r = 5,
                n = 50,
                seedvalue = None,
                #dendrite line sources, soma as sphere source (Linden et al 2014),
                #and account for periodic boundary conditions also in the LFP to
                #the second order. Must use LFPy from github.com/espenhgn and
                #branch som_as_point_periodic (as the periodic boundaries are
                #just a hack)
                method = 'soma_as_point_periodic' if PSET.pbc else 'soma_as_point',
                periodic_order=2,
                periodic_side_length=PSET.extent_length*1000.,                
        ),
        
        #runtime, cell-specific attributes and output that will be stored
        savelist = [
            'somav',
            'somapos',
            'x',
            'y',
            'z',
            'LFP',
        ],
        
        #flag for switching on calculation of CSD
        calculateCSD = False,
        
        #time resolution of saved signals
        #TODO: find nicer way to make sure we use same dt in analysis and
        #LFP simulation output
        dt_output = PSET.dt*5 
    ))
    
     
    #for each population, define layer- and population-specific connectivity
    #parameters
    PS.update(dict(
        #number of connections from each presynaptic population onto each
        #layer per postsynaptic population, preserving overall indegree
        k_yXL = PARAMS.k_yXL,
        
        #set up table of synapse weights onto postsynaptic cell type y from each
        #possible presynaptic population X 
        J_yX = PARAMS.J_yX,
        
        
        #table of synapse time constants onto postsynaptic cell type y from each
        #possible presynaptic population X
        tau_yX = PARAMS.tau_yX,
        
        #unit synapse weights used for LFP proxy
        J_yX_unit = PARAMS.J_yX_unit,
    
        #set up synapse parameters as derived from the network
        synParams = PARAMS.synParams,
        
        #set up delays, here using fixed delays of network unless value is None
        synDelayLoc = {y : [None for X in PS.X] for y in PS.y},
        
        #distribution of delays added on top of per connection delay using either
        #fixed or linear distance-dependent delays
        synDelayScale = {y : [PSET.sigma_delays['E' not in X] for X in PS.X] for y in PS.y},
        
        
        #For topology-like connectivity. Only exponential and gaussian
        #connectivity and circular
        #masks are supported with fixed indegree given by k_yXL,
        #using information on extent and edge wrap (periodic boundaries). 
        #At present, synapse delays are not distance-dependent. For speed,
        #multapses are always allowed. 
        topology_connections = PARAMS.topology_connections,
    ))
    
    
    #mapping between population type and cell type specificity,
    PS.update(dict(
        mapping_Yy = PARAMS.mapping_Yy
    ))
    
    
    ###### MISC ATTRIBUTES NOT USED FOR SIMULATION ####
    PS.update(dict(
        depths = PARAMS.depths,
        PATH_m_y = PARAMS.PATH_m_y,
        m_y = PARAMS.m_y,
        N_y = PARAMS.N_y,
        full_scale_num_neurons = PARAMS.full_scale_num_neurons,
        
    ))
    
    #### Attributes for LFP proxy stuff####
    PS.update(dict(
        #CachedFixedSpikesTopoNetwork params
        activationtimes=[200, 300, 400, 500, 600, 700, 800, 900, 1000],
        filelabel='population_spikes',
        mask=[-400, 0, -400, 0],
        #output files for TopoPopulation and Postprocess classes
        output_file = '{}_population_{}',
        compound_file='{}sum.h5',
        #parameters for LFP kernel extraction
        nlag = int(20 / PS.dt_output),
        
        #output files for calculating LFP proxies
        output_file_proxy = '{}_proxy_{}',
        compound_file_proxy='{}proxy.h5',
        #output files for estimates from firing rates
        output_file_approx = '{}_population_approx_{}',
        compound_file_approx='{}_approx.h5',
        extent = PSET.extent_length*1E3,
        pbc = PSET.pbc,
        
        #synapse strength in units of pA
        J = PARAMS.J
    ))
    
    return PS, PSET
Пример #28
0
class SimpleNetwork(object):

    required_parameters = ParameterSet({
        'system': dict,
        'input_spike_times': numpy.ndarray,
        'cell_type': str,
        'cell_parameters': dict,
        'plasticity': dict,
        'weights': float,
        'delays': float
    })

    @classmethod
    def check_parameters(cls, parameters):
        assert isinstance(parameters, ParameterSet)
        for name, p_type in cls.required_parameters.flat():
            assert isinstance(
                parameters[name],
                p_type), "%s: expecting %s, got %s" % (name, p_type,
                                                       type(parameters[name]))
        return True

    def __init__(self, sim, parameters):
        self.sim = sim
        self.parameters = parameters
        sim.setup(**parameters.system)
        # Create cells
        self.pre = sim.Population(
            1,
            sim.SpikeSourceArray,
            {'spike_times': parameters.input_spike_times},
            label='pre')
        self.post = sim.Population(1,
                                   getattr(sim, parameters.cell_type),
                                   parameters.cell_parameters,
                                   label='post')
        self._source_populations = set([self.pre])
        self._neuronal_populations = set([self.post])
        # Create synapse model
        if parameters.plasticity.short_term:
            P = parameters.plasticity.short_term
            fast_mech = getattr(sim, P.model)(P.parameters)
        else:
            fast_mech = None
        if parameters.plasticity.long_term:
            P = parameters.plasticity.long_term
            print P.pretty()
            print P.timing_dependence
            print P.timing_dependence.model
            print P.timing_dependence.params
            slow_mech = sim.STDPMechanism(
                timing_dependence=getattr(
                    sim,
                    P.timing_dependence.model)(**P.timing_dependence.params),
                weight_dependence=getattr(
                    sim,
                    P.weight_dependence.model)(**P.weight_dependence.params),
                dendritic_delay_fraction=P.ddf)
        else:
            slow_mech = None
        if fast_mech or slow_mech:
            syn_dyn = sim.SynapseDynamics(fast=fast_mech, slow=slow_mech)
        else:
            syn_dyn = None
        # Create connections
        weights = parameters.weights  # to give approximate parity in numerical values between
        if "_cond_" in parameters.cell_type:  # current- and conductance-based synapses, we divide the
            weights /= 50.0  # weights by 50 (approx the distance in mV between threshold
            # and excitatory reversal potential) for conductance-based.
        connector = sim.AllToAllConnector(weights=weights,
                                          delays=parameters.delays)
        self.prj = [
            sim.Projection(self.pre,
                           self.post,
                           method=connector,
                           synapse_dynamics=syn_dyn)
        ]
        # Setup recording
        self.pre.record()
        self.post.record()
        self.post.record_v()

    def add_population(self, label, dim, cell_type, parameters={}):
        cell_type = getattr(self.sim, cell_type)
        pop = self.sim.Population(dim, cell_type, parameters, label=label)
        setattr(self, label, pop)
        pop.record()
        if cell_type.receptor_types:  # don't record Vm for populations that don't have it
            pop.record_v()
            self._neuronal_populations.add(pop)
        else:
            self._source_populations.add(pop)

    def add_projection(self,
                       src,
                       tgt,
                       connector_name,
                       connector_parameters={}):
        connector = getattr(self.sim, connector_name)(**connector_parameters)
        assert hasattr(self, src)
        assert hasattr(self, tgt)
        prj = self.sim.Projection(getattr(self, src), getattr(self, tgt),
                                  connector)
        self.prj.append(prj)

    def save_weights(self):
        t = self.sim.get_current_time()
        for prj in self.prj:
            w = prj.getWeights()
            w.insert(0, t)
            prj.weights.append(w)

    def get_spikes(self):
        spikes = {}
        for pop in chain(self._neuronal_populations, self._source_populations):
            spike_arr = pop.getSpikes()
            spikes[pop.label] = signals.SpikeList(spike_arr,
                                                  id_list=range(pop.size))
        return spikes

    def get_v(self):
        vm = {}
        for pop in self._neuronal_populations:
            vm_arr = pop.get_v()
            vm[pop.label] = signals.VmList(vm_arr[:, (0, 2)],
                                           id_list=range(pop.size),
                                           dt=self.parameters.system.timestep,
                                           t_start=min(vm_arr[:, 1]),
                                           t_stop=max(vm_arr[:, 1]) +
                                           self.parameters.system.timestep)
        return vm

    def get_weights(self, at_input_spiketimes=False, recording_interval=1.0):
        w = {}
        if at_input_spiketimes:
            presynaptic_spike_times = self.pre.getSpikes()[:, 1]
        for prj in self.prj:
            w[prj.label] = numpy.array(prj.weights)
            if at_input_spiketimes:
                assert isinstance(prj._method.delays, float)
                post_synaptic_potentials = presynaptic_spike_times + prj._method.delays
                mask = numpy.ceil(post_synaptic_potentials /
                                  recording_interval).astype('int')
                w[prj.label] = w[prj.label][mask]
        return w
Пример #29
0
def load_parameters(url):
    return ParameterSet(url)
Пример #30
0
class FiberChannel(object):
    """
    Model class for the fiber of simple neurons.

    """
    def __init__(self, N=100):
        # simulator specific
        simulation_params = ParameterSet({
            'dt': 0.1,  # discretization step in simulations (ms)
            'simtime': 40000 * 0.1,  # float; (ms)
            'syn_delay': 1.0,  # float; (ms)
            'kernelseed': 4321097,  # array with one element per thread
            'connectseed':
            12345789  # seed for random generator(s) used during simulation
        })
        # these may change
        self.params = ParameterSet(
            {
                'simulation': simulation_params,
                'N': N,
                'noise_std':
                6.0,  # (nA??) standard deviation of the internal noise
                'snr': 1.0,  # (nA??) size of the input signal
                'weight': 1.0
            },
            label="fiber_params")

        print self.params.pretty()

    def run(self, params, verbose=True):
        tmpdir = tempfile.mkdtemp()
        timer = Timer()
        timer.start()  # start timer on construction

        # === Build the network ========================================================
        if verbose: print "Setting up simulation"
        sim.setup(timestep=params.simulation.dt,
                  max_delay=params.simulation.syn_delay,
                  debug=False)

        N = params.N
        #dc_generator
        current_source = sim.DCSource(amplitude=params.snr,
                                      start=params.simulation.simtime / 4,
                                      stop=params.simulation.simtime / 4 * 3)

        # internal noise model (NEST specific)
        noise = sim.Population(N, 'noise_generator', {
            'mean': 0.,
            'std': params.noise_std
        })
        # target population
        output = sim.Population(N, sim.IF_cond_exp)

        # initialize membrane potential
        numpy.random.seed(params.simulation.kernelseed)
        V_rest, V_spike = -70., -53.
        output.tset('v_init',
                    V_rest + numpy.random.rand(N, ) * (V_spike - V_rest))

        #  Connecting the network
        conn = sim.OneToOneConnector(weights=params.weight)
        sim.Projection(noise, output, conn)

        for cell in output:
            cell.inject(current_source)

        output.record()

        # reads out time used for building
        buildCPUTime = timer.elapsedTime()

        # === Run simulation ===========================================================
        if verbose: print "Running simulation"

        timer.reset()  # start timer on construction
        sim.run(params.simulation.simtime)
        simCPUTime = timer.elapsedTime()

        timer.reset()  # start timer on construction

        output_filename = os.path.join(tmpdir, 'output.gdf')
        #print output_filename
        output.printSpikes(output_filename)  #
        output_DATA = load_spikelist(output_filename,
                                     N,
                                     t_start=0.0,
                                     t_stop=params.simulation.simtime)
        writeCPUTime = timer.elapsedTime()

        if verbose:
            print "\nFiber Network Simulation:"
            print "Number of Neurons  : ", N
            print "Mean Output rate    : ", output_DATA.mean_rate(
            ), "Hz during ", params.simulation.simtime, "ms"
            print("Build time             : %g s" % buildCPUTime)
            print("Simulation time        : %g s" % simCPUTime)
            print("Writing time           : %g s" % writeCPUTime)

        os.remove(output_filename)
        os.rmdir(tmpdir)

        return output_DATA
Пример #31
0
        FT_lg = self.loggabor(u, v, sf_0, B_sf, theta, B_theta)
        fig, a1, a2 = self.im.show_FT(FT_lg * np.exp(-1j * phase))
        return fig, a1, a2


def _test():
    import doctest
    doctest.testmod()


#####################################
#
if __name__ == '__main__':
    _test()

    #### Main
    """
    Some examples of use for the class

    """
    from pylab import imread
    image = imread('database/lena512.png')[:, :, 0]

    from NeuroTools.parameters import ParameterSet
    pe = ParameterSet('default_param.py')
    pe.N_X, pe.N_Y = image.shape

    from SLIP import Image
    im = Image(pe)
    lg = LogGabor(im)
Пример #32
0
#not execute the network model, but see below.
import brunel_alpha_nest as BN


#set up file destinations differentiating between certain output
PS = ParameterSet(dict(
    #Main folder of simulation output
    savefolder = 'simulation_output_example_brunel',
    
    #make a local copy of main files used in simulations
    sim_scripts_path = os.path.join('simulation_output_example_brunel',
                                    'sim_scripts'),
    
    #destination of single-cell output during simulation
    cells_path = os.path.join('simulation_output_example_brunel', 'cells'),
    
    #destination of cell- and population-specific signals, i.e., compund LFPs,
    #CSDs etc.
    populations_path = os.path.join('simulation_output_example_brunel',
                                    'populations'),
    
    #location of spike output from the network model
    spike_output_path = BN.spike_output_path,
    
    #destination of figure file output generated during model execution
    figures_path = os.path.join('simulation_output_example_brunel', 'figures')
))


#population (and cell type) specific parameters
PS.update(dict(
    #no cell type specificity within each E-I population
Пример #33
0
    def show_loggabor(self, u, v, sf_0, B_sf, theta, B_theta, title='', phase=0.):
        FT_lg = self.loggabor(u, v, sf_0, B_sf, theta, B_theta)
        fig, a1, a2 = self.im.show_FT(FT_lg * np.exp(-1j*phase))
        return fig, a1, a2

def _test():
    import doctest
    doctest.testmod()
#####################################
#
if __name__ == '__main__':
    _test()

    #### Main
    """
    Some examples of use for the class

    """
    from pylab import imread
    image = imread('database/lena512.png')[:,:,0]

    from NeuroTools.parameters import ParameterSet
    pe = ParameterSet('default_param.py')
    pe.N_X, pe.N_Y = image.shape

    from SLIP import Image
    im = Image(pe)
    lg = LogGabor(im)

Пример #34
0
def verify_connectivity(data_store):
    l4_pos = data_store.get_neuron_postions()['V1_Exc_L4']
    l4_inh_pos = data_store.get_neuron_postions()['V1_Inh_L4']

    print find_neuron('center', l4_pos)
    print find_neuron('top_right', l4_pos)
    print find_neuron('top_left', l4_pos)
    print find_neuron('bottom_right', l4_pos)
    print find_neuron('bottom_left', l4_pos)

    ConnectivityPlot(
        data_store,
        ParameterSet({
            'neuron':
            data_store.get_sheet_ids('V1_Exc_L4',
                                     find_neuron('center', l4_pos)),
            'sheet_name':
            'V1_Exc_L4',
            'reversed':
            True
        }),
        param_filter_query(data_store,
                           identifier='PerNeuronValue',
                           value_name='LGNAfferentOrientation')).plot()
    ConnectivityPlot(
        data_store,
        ParameterSet({
            'neuron':
            data_store.get_sheet_ids('V1_Exc_L4',
                                     find_neuron('top_right', l4_pos)),
            'sheet_name':
            'V1_Exc_L4',
            'reversed':
            True
        }),
        param_filter_query(data_store,
                           identifier='PerNeuronValue',
                           value_name='LGNAfferentOrientation')).plot()
    ConnectivityPlot(
        data_store,
        ParameterSet({
            'neuron':
            data_store.get_sheet_ids('V1_Exc_L4',
                                     find_neuron('top_left', l4_pos)),
            'sheet_name':
            'V1_Exc_L4',
            'reversed':
            True
        }),
        param_filter_query(data_store,
                           identifier='PerNeuronValue',
                           value_name='LGNAfferentOrientation')).plot()
    ConnectivityPlot(
        data_store,
        ParameterSet({
            'neuron':
            data_store.get_sheet_ids('V1_Exc_L4',
                                     find_neuron('bottom_right', l4_pos)),
            'sheet_name':
            'V1_Exc_L4',
            'reversed':
            True
        }),
        param_filter_query(data_store,
                           identifier='PerNeuronValue',
                           value_name='LGNAfferentOrientation')).plot()
    ConnectivityPlot(
        data_store,
        ParameterSet({
            'neuron':
            data_store.get_sheet_ids('V1_Exc_L4',
                                     find_neuron('bottom_left', l4_pos)),
            'sheet_name':
            'V1_Exc_L4',
            'reversed':
            True
        }),
        param_filter_query(data_store,
                           identifier='PerNeuronValue',
                           value_name='LGNAfferentOrientation')).plot()

    #ConnectivityPlot(data_store,ParameterSet({'neuron' : data_store.get_sheet_ids('V1_Exc_L4',find_neuron('center',l4_pos)),'sheet_name' : 'V1_Exc_L4','reversed' : True}),param_filter_query(data_store,identifier='PerNeuronValue',value_name='LGNAfferentPhase')).plot()
    #ConnectivityPlot(data_store,ParameterSet({'neuron' : data_store.get_sheet_ids('V1_Exc_L4',find_neuron('center',l4_inh_pos)),'sheet_name' : 'V1_Inh_L4','reversed' : True}),param_filter_query(data_store,identifier='PerNeuronValue',value_name='LGNAfferentOrientation')).plot()
    #ConnectivityPlot(data_store,ParameterSet({'neuron' : data_store.get_sheet_ids('V1_Exc_L4',find_neuron('center',l4_inh_pos)),'sheet_name' : 'V1_Inh_L4','reversed' : True}),param_filter_query(data_store,identifier='PerNeuronValue',value_name='LGNAfferentPhase')).plot()

    verify_push_pull(data_store, 'V1L4ExcL4ExcConnection')
    verify_push_pull(data_store, 'V1L4ExcL4InhConnection')
    verify_push_pull(data_store, 'V1L4InhL4ExcConnection')
    verify_push_pull(data_store, 'V1L4InhL4InhConnection')
Пример #35
0
from NeuroTools.parameters import ParameterSet
from NeuroTools.parameters import ParameterRange
import corr_poisson as st
import pyNN.nest as sim
from NeuroTools.sandbox import make_name
from NeuroTools.sandbox import check_name
import numpy

p = ParameterSet({})
# Parameters for neuronal features
p.vm = -65.
p.th = -50.
p.tau_synE = 0.3
p.tau_synI = 2.
p.E_ex = 0.
p.E_in = -70.
p.ie = 0.
p.cm = 500.
p.gL = 25.
p.tref = 2.

# Parameters for running
p.timestep = 0.1
p.min_delay = 0.1
p.max_delay = 5.1
p.runtime = 100000.

# Parameters for number and connections
p.r0 = 2000.  # excitatory input rate
p.ri = 1647.  # inhibitory input rate
p.je = 0.015  # excitatory synaptic weight