Example #1
0
def get_current_time():
    """ Gets the time within the simulation

    :return: returns the current time
    """
    globals_variables.check_simulator()
    return __pynn["get_current_time"]()
Example #2
0
def record(variables,
           source,
           filename,
           sampling_interval=None,
           annotations=None):
    """ Sets variables to be recorded.

    :param variables: may be either a single variable name or a list of
        variable names. For a given celltype class, celltype.recordable
        contains a list of variables that can be recorded for that celltype.
    :type variables: str or list(str)
    :param source: where to record from
    :type source: ~spynnaker.pyNN.models.populations.Population or
        ~spynnaker.pyNN.models.populations.PopulationView
    :param str filename: file name to write data to
    :param sampling_interval:
        how often to sample the recording, not ignored so far
    :param annotations: the annotations to data writers
    :type annotations: dict(str, ...)
    :return: neo object
    :rtype: ~neo.core.Block
    """
    globals_variables.check_simulator()
    return __pynn["record"](variables, source, filename, sampling_interval,
                            annotations)
Example #3
0
def get_machine():
    """ Get the SpiNNaker machine in use.

    :return: the machine object
    :rtype: ~spinn_machine.Machine
    """
    globals_variables.check_simulator()
    return globals_variables.get_simulator().machine
Example #4
0
def get_time_step():
    """ The integration time step

    :return: get the time step of the simulation (in ms)
    :rtype: float
    """
    globals_variables.check_simulator()
    return float(__pynn["get_time_step"]())
Example #5
0
def run_until(tstop):
    """ Run until a (simulation) time period has completed.

    :param float tstop: the time to stop at (in milliseconds)
    :return: the actual simulation time that the simulation stopped at
    :rtype: float
    """
    globals_variables.check_simulator()
    return __pynn["run_until"](tstop)
Example #6
0
def get_min_delay():
    """ The minimum allowed synaptic delay; delays will be clamped to be at\
        least this.

    :return: returns the min delay of the simulation
    :rtype: int
    """
    globals_variables.check_simulator()
    return __pynn["get_min_delay"]()
Example #7
0
def initialize(cells, **initial_values):
    """ Sets cells to be initialised to the given values

    :param cells: the cells to change params on
    :type cells: ~spynnaker.pyNN.models.populations.Population or
        ~spynnaker.pyNN.models.populations.PopulationView
    :param initial_values: the params and their values to change
    """
    globals_variables.check_simulator()
    pynn_common.initialize(cells, **initial_values)
Example #8
0
def run(simtime, callbacks=None):
    """ The run() function advances the simulation for a given number of \
        milliseconds, e.g.:

    :param float simtime: time to run for (in milliseconds)
    :param callbacks: callbacks to run
    :return: the actual simulation time that the simulation stopped at
    :rtype: float
    """
    globals_variables.check_simulator()
    return __pynn["run"](simtime, callbacks=callbacks)
Example #9
0
def reset(annotations=None):
    """ Resets the simulation to t = 0

    :param annotations: the annotations to the data objects
    :type annotations: dict(str, ...)
    :rtype: None
    """
    if annotations is None:
        annotations = {}
    globals_variables.check_simulator()
    __pynn["reset"](annotations)
Example #10
0
def rank():
    """ The MPI rank of the current node.

    .. note::
        Always 0 on SpiNNaker, which doesn't use MPI.

    :return: MPI rank
    :rtype: int
    """
    globals_variables.check_simulator()
    return __pynn["rank"]()
Example #11
0
def num_processes():
    """ The number of MPI processes.

    .. note::
        Always 1 on SpiNNaker, which doesn't use MPI.

    :return: the number of MPI processes
    :rtype: int
    """
    globals_variables.check_simulator()
    return __pynn["num_processes"]()
Example #12
0
def create(cellclass, cellparams=None, n=1):
    """ Builds a population with certain params

    :param cellclass: population class
    :type cellclass: type or AbstractPyNNModel
    :param cellparams: population params.
    :param int n: n neurons
    :rtype: ~spynnaker.pyNN.models.populations.Population
    """
    globals_variables.check_simulator()
    return __pynn["create"](cellclass, cellparams, n)
Example #13
0
def connect(pre,
            post,
            weight=0.0,
            delay=None,
            receptor_type=None,
            p=1,
            rng=None):
    """ Builds a projection

    :param ~spynnaker.pyNN.models.populations.Population pre: source pop
    :param ~spynnaker.pyNN.models.populations.Population post: destination pop
    :param float weight: weight of the connections
    :param float delay: the delay of the connections
    :param str receptor_type: excitatory / inhibitory
    :param float p: probability
    :param ~pyNN.random.NumpyRNG rng: random number generator
    """
    # pylint: disable=too-many-arguments
    globals_variables.check_simulator()
    __pynn["connect"](pre, post, weight, delay, receptor_type, p, rng)