Esempio n. 1
0
    def get_neuron_from_gid(blue_config, gid):
        """Return a BBP neuron structure from its input GID.

        :param blue_config:
            Input circuit configuration file.
        :param gid:
            Input neuron GID.
        :return:
            A reference to the BBP neuron
        """

        # Import BBP-SDK module inside the function to avoid the BBP tree complexity for non-BBP
        # morphologies.
        import bbp

        # Create a new experiment
        bbp_experiment = bbp.Experiment()

        # Open the blue-config file
        bbp_experiment.open(blue_config)

        # Create a micro-circuit
        bbp_microcircuit = bbp_experiment.microcircuit()

        # Set the cell target to the given gid
        bbp_cell_target = bbp.Cell_Target()
        bbp_cell_target.insert(int(gid))

        # Load the circuit
        bbp_microcircuit.load(bbp_cell_target, bbp.Loading_Flags.NEURONS)

        # Get the neuron from the microcircuit
        bbp_neuron = bbp_microcircuit.neurons()

        # Return a reference to the BBP neuron
        return bbp_neuron
##
## Responsible Authors: Juan Hernando <*****@*****.**>

# This script instantiates a NEST steering proxy and sends a stimulus
# injection event after a 4 second pause. If not run from the command line,
# the event is not sent, but the event parameters are still set.
# The function send_stimulus can be invoked to send the predefined stimulus
# injection.

import monsteer.Nesteer
import bbp
import nest
import numpy

simulator = isc.Nesteer.Simulator('monsteer-nesteer://')

params = nest.GetDefaults('poisson_generator')
params['rate'] = 50000.0

cells = bbp.Cell_Target()
for i in range(1000):
    cells.insert(i + 1)

def send_stimulus():
    simulator.injectStimulus(params, cells)

if __name__ == '__main__':
    import time
    time.sleep(4) # Waiting for connection
    send_stimulus()