Beispiel #1
0
def run(argv):
  sim = ncs.Simulation()
  excitatory_parameters = sim.addNeuron("label_excitatory",
                                                 "izhikevich",
                                                 { 
                                                  "a": 0.2,
                                                  "b": 0.2,
                                                  "c": -65.0,
                                                  "d": ncs.Uniform(7.0, 9.0),
                                                  "u": ncs.Uniform(-15.0, -11.0),
                                                  "v": ncs.Normal(-60.0, 5.0),
                                                  "threshold": 30,
                                                 }
                                                )
  group_1 = sim.addNeuronGroup("group_1", 100, "label_excitatory", None) # last param is geometry
  group_2 = sim.addNeuronGroup("group_2", 100, excitatory_parameters)

  all_cells = sim.addNeuronAlias("all_cells", [group_1, "group_2"])
  sim.addNeuronAlias("all", all_cells)
  sim.addNeuronAlias("all_2", "all_cells")

  flat_parameters = sim.addSynapse("flat_synapse", 
                                           "flat", 
                                           { "delay": 2,
                                             "current": ncs.Normal(18.0,2.0)
                                           })
  all_to_all = sim.addSynapseGroup("all_to_all", all_cells, "all_2", 0.1, flat_parameters)
  all_to_all_2 = sim.addSynapseGroup("all_to_all_2", 
                             [group_1, group_2], 
                             "all_2", 
                             0.1, 
                             flat_parameters)
  one_to_two = sim.addSynapseGroup("one_to_two", 
                           group_1, 
                           "group_2", 
                           0.1, 
                           "flat_synapse")

  all_connections = sim.addSynapseAlias("all_connections", [all_to_all, one_to_two])

  if not sim.init(argv):
    print "Failed to initialize simulation."
    return

  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, group_1, 0.1, 0.0, 1.0)
  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, "all", 0.1, 0.0, 0.5)
  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, "group_2", 0.1, 0.1, 1.1)

  voltage_report = sim.addReport("group_1", "neuron", "neuron_voltage", 1.0,0.0,0.01)
  voltage_report.toAsciiFile("/tmp/foo.txt")

  fire_report = sim.addReport(all_cells, "neuron", "neuron_fire", 1.0,0.0,0.01)
  fire_report.toStdOut()

  
  sim.run(duration=0.01)
  return
Beispiel #2
0
def Run(argv):
    sim = ncs.Simulation()
    excitatory_parameters = sim.addNeuron(
        "label_excitatory", "izhikevich", {
            "a": 0.2,
            "b": 0.2,
            "c": -65.0,
            "d": ncs.Uniform(7.0, 9.0),
            "u": ncs.Uniform(-15.0, -11.0),
            "v": ncs.Normal(-60.0, 5.0),
            "threshold": 30,
        })
    group_1 = sim.addNeuronGroup("group_1", 1, "label_excitatory",
                                 None)  # last param is geometry
    group_2 = sim.addNeuronGroup("group_2", 1, excitatory_parameters)
    flat_parameters = sim.addNeuron(
        "synapse", "ncs", {
            "utilization": ncs.Normal(0.5, 0.05),
            "redistribution": 1.0,
            "last_prefire_time": 0.0,
            "last_postfire_time": 0.0,
            "tau_facilitation": 0.001,
            "tau_depression": 0.001,
            "tau_ltp": 0.015,
            "tau_ltd": 0.03,
            "A_ltp_minimum": 0.003,
            "A_ltd_minimum": 0.003,
            "max_conductance": 0.004,
            "reversal_potential": 0.0,
            "tau_postsynaptic_conductance": 0.025,
            "psg_waveform_duration": 0.05,
            "delay": ncs.Uniform(1, 5),
        })
    synapse = sim.addSynapseGroup("1_to_2", group_1, "group_2", 1,
                                  flat_parameters)
    if not sim.init(argv):
        print "Failed to initialize simulation."
        return

    sim.addStimulus("rectangular_current", {"amplitude": 18.0}, group_1, 1.0,
                    0.0, 1.0)

    #current_report = sim.addReport(group_2, "neuron", "synaptic_current", 1.0)
    current_report = sim.addReport(group_2, "neuron", "synaptic_current", 1.0,
                                   0.0, 0.05)
    current_report.toStdOut()

    sim.run(duration=0.05)
    return
Beispiel #3
0
def add(sim):
  # TODO(rvhoang): these values aren't yet accurate
  synEE_PCR = {
    "utilization": ncs.Normal(0.5, 0.05),
    "redistribution": 1.0,
    "last_prefire_time": 0.0,
    "last_postfire_time": 0.0,
    "tau_facilitation": 0.0,
    "tau_depression": 0.0,
    "tau_ltp": 0.015,
    "tau_ltd": 0.03,
    "A_ltp_minimum": 0.003,
    "A_ltd_minimum": 0.003,
    "max_conductance": 0.004,
    "reversal_potential": 0.0,
    "tau_postsynaptic_conductance": 0.025,
    "psg_waveform_duration": 0.05,
    "delay": ncs.Uniform(1,5),
  }
  
  synEI_PCR = {
    "utilization": ncs.Normal(0.5, 0.05),
    "redistribution": 1.0,
    "last_prefire_time": 0.0,
    "last_postfire_time": 0.0,
    "tau_facilitation": 0.0,
    "tau_depression": 0.0,
    "tau_ltp": 0.005,
    "tau_ltd": 0.005,
    "A_ltp_minimum": 0.02,
    "A_ltd_minimum": 0.01,
    "max_conductance": 0.004,
    "reversal_potential": 0.0,
    "tau_postsynaptic_conductance": 0.025,
    "psg_waveform_duration": 0.05,
    "delay": ncs.Uniform(1,5),
  }

  synIE_PCR = {
    "utilization": ncs.Normal(0.5, 0.05),
    "redistribution": 1.0,
    "last_prefire_time": 0.0,
    "last_postfire_time": 0.0,
    "tau_facilitation": 0.0,
    "tau_depression": 0.0,
    "tau_ltp": 0.005,
    "tau_ltd": 0.005,
    "A_ltp_minimum": 0.02,
    "A_ltd_minimum": 0.01,
    "max_conductance": 0.004,
    "reversal_potential": 0.0,
    "tau_postsynaptic_conductance": 0.025,
    "psg_waveform_duration": 0.05,
    "delay": ncs.Uniform(1,5),
  }
  synII_PCR = {
    "utilization": ncs.Normal(0.5, 0.05),
    "redistribution": 1.0,
    "last_prefire_time": 0.0,
    "last_postfire_time": 0.0,
    "tau_facilitation": 0.0,
    "tau_depression": 0.0,
    "tau_ltp": 0.005,
    "tau_ltd": 0.005,
    "A_ltp_minimum": 0.02,
    "A_ltd_minimum": 0.01,
    "max_conductance": 0.004,
    "reversal_potential": 0.0,
    "tau_postsynaptic_conductance": 0.025,
    "psg_waveform_duration": 0.05,
    "delay": ncs.Uniform(1,5),
  }
  sim.addModelParameters("synEE_PCR", "ncs", synEE_PCR)
  sim.addModelParameters("synEI_PCR", "ncs", synEI_PCR)
  sim.addModelParameters("synIE_PCR", "ncs", synIE_PCR)
  sim.addModelParameters("synII_PCR", "ncs", synII_PCR)
Beispiel #4
0
def run(argv):
	#ncs.simulation() is required
	sim = ncs.Simulation()

	#start writing model - biology information

        #addNeuron function
        #Parameters for addNeuron function:
        #       1. A neuron name (string)
        #       2. A neuron type (string)
        #               izhikevich, ncs, or hh
        #       3. A map for parameter names to their values(Generators)
        #               Generators can be exact, Normal, uniform
        #               exact example : "a": 0.02
        #               uniform example: "a": ncs.Uniform(min, max)
        #               normal example: "a": ncs.Normal(mean, standard deviation)
        # Example of addNeuron with regular_spiking izhikevich neuron   
	regular_spiking_parameters = sim.addNeuron("regular_spiking","izhikevich",
								{
								 "a": 0.02,
								 "b": 0.2,
								 "c": -65.0,
								 "d": 8.0,
								 "u": -12.0,
								 "v": -60.0,
								 "threshold": 30,
								})

	#addSynapse function
	#Parameters for addSynapse function
	#	1. A synapse name (string)
	#	2. A synapse type (string)
	#		ncs or flat
	#	3. A map for parameter names to their values (Generators)	
	ncs_synapse_parameters = sim.addSynapse("flat_synapse","ncs",{
										
									"utilization": ncs.Normal(0.5,0.05),
									"redistribution": 1.0,
									"last_prefire_time": 0.0,
									"last_postfire_time": 0.0,
									"tau_facilitation": 0.001,
									"tau_depression": 0.001,
									"tau_ltp": 0.015,
									"tau_ltd": 0.03,
									"A_ltp_minimum": 0.003,
									"A_ltd_minimum": 0.003,
									"max_conductance": 0.3,
									"reversal_potential":0.0,
									"tau_postsynaptic_conductance": 0.02,
									"psg_waveform_duration": 0.05,
									"delay": 1,
								})	

	#addNeuronGroup function
        #Parameters for addNeuronGroup function:
        #       1. A name of the group (string)
        #       2. Number of cells (integer)
        #       3. Neuron parameters
        #       4. Geometry generator (optional)
	group_1=sim.addNeuronGroup("group_1",1,regular_spiking_parameters,None)
	group_2=sim.addNeuronGroup("group_2",1,regular_spiking_parameters,None)
	
	#addSynapseGroup function
	#Parameters for addSynapseGroup function:
	#	1. A name of the connection
	#	2. Presynaptic NeuronAlias or NeuronGroup
	#	3. Postsynaptic NeuronAlias or NeuronGroup
	#	4. Probability of connection
	#	5. Parameters for synapse
	connection1=sim.addSynapseGroup("connection1","group_1","group_2",1,"flat_synapse");

	#initialize simulation	
	if not sim.init(argv):
		print "failed to initialize simulation."
		return

	#addStimulus function
        #parameters for addStimulus function:
        #       1. A stimulus type (string) 
        #               rectangular_current, rectangular_voltage, linear_current, linear_voltage, 
        #               sine_current, or sine_voltage
        #       2. A map from parameter names (strings) to their values (Generators)
        #               Parameter names are amplitude, starting_amplitude, ending_amplitude,
        #               delay, current, amplitude_scale, time_scale, phase, amplitude_shift,
        #               etc. based on the stimulus type
        #       3. A set of target neuron groups
        #       4. probability of a neuron receiving input
        #       5. start time for stimulus (seconds)
        #               For example, if you wanted to start stimulus at 1 ms, write 0.01
        #       6. end time for stimulus (seconds)
	sim.addStimulus("rectangular_current",{"amplitude":10},group_1,1,0.01,1.0)

	#addReport function
        #Parameters for addReport function:
        #       1. A set of neuron group or a set of synapse group to report on
        #       2. A target type: "neuron" or "synapses"
        #       3. type of report: synaptic_current, neuron_voltage, neuron_fire, 
        #          input current, etc.
        #       4. Probability (the percentage of elements to report on)
	voltage_report_1=sim.addReport([group_1,group_2],"neuron","neuron_voltage",1.0,0.0,1.0)
	#An example of a report to file
	voltage_report_1.toAsciiFile("reg_voltage_report.txt");	

	#duration (in seconds) - each time step is 1 ms
	sim.run(duration=1.0)

	return
Beispiel #5
0
def run(argv):
  sim = ncs.Simulation()
  excitatory_parameters = sim.addNeuron("label_excitatory",
                                                 "izhikevich",
                                                 { 
                                                  "a": 0.2,
                                                  "b": 0.2,
                                                  "c": -65.0,
                                                  "d": ncs.Uniform(7.0, 9.0),
                                                  "u": ncs.Uniform(-15.0, -11.0), 
                                                  "v": ncs.Normal(-60.0, 5.0),
                                                  "threshold": 30
                                                 }
                                                )
  group_1 = sim.addNeuronGroup("group_1", 100, "label_excitatory", None) # last param is geometry
  group_2 = sim.addNeuronGroup("group_2", 100, excitatory_parameters)

  all_cells = sim.addNeuronAlias("all_cells", [group_1, "group_2"])
  sim.addNeuronAlias("all", all_cells)
  sim.addNeuronAlias("all_2", "all_cells")

  flat_parameters = sim.addSynapse("synapse", 
                                           "ncs", 
                                           { "utilization": ncs.Normal(0.5, 0.05),
                                             "redistribution": 1.0,
                                             "last_prefire_time": 0.0,
                                             "last_postfire_time": 0.0,
                                             "tau_facilitation": 0.001,
                                             "tau_depression": 0.001,
                                             "tau_ltp": 0.015,
                                             "tau_ltd": 0.03,
                                             "A_ltp_minimum": 0.003,
                                             "A_ltd_minimum": 0.003,
                                             "max_conductance": 0.004,
                                             "reversal_potential": 0.0,
                                             "tau_postsynaptic_conductance": 0.025,
                                             "psg_waveform_duration": 0.05,
                                             "delay": ncs.Uniform(1,5)
                                           })
  all_to_all = sim.addSynapseGroup("all_to_all", all_cells, "all_2", 0.1, flat_parameters)
  all_to_all_2 = sim.addSynapseGroup("all_to_all_2", 
                             [group_1, group_2], 
                             "all_2", 
                             0.1, 
                             flat_parameters)
  one_to_two = sim.addSynapseGroup("one_to_two", 
                           group_1, 
                           "group_2", 
                           0.1, 
                           "synapse")

  all_connections = sim.addSynapseAlias("all_connections", [all_to_all, one_to_two])

  if not sim.init(argv):
    print "Failed to initialize simulation."
    return

  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, group_1, 0.1, 0.0, 0.1)
  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, "all", 0.1, 0.0, 0.2)
  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, "group_2", 0.1, 0.1, 0.3)

  voltage_report = sim.addReport("group_1", "neuron", "neuron_voltage", 1.0, 0.0, 0.01)
  voltage_report.toAsciiFile("foo.txt")

  fire_report = sim.addReport(all_cells, "neuron", "neuron_fire", 1.0, 0.0, 0.01)
  fire_report.toStdOut()
  current_report = sim.addReport(all_cells, "neuron", "synaptic_current", 1.0, 0.0, 0.01)
  current_report.toStdOut()

  
  sim.run(duration=0.5)
  del sim
  return