Пример #1
0
 def __init__(self,
              size,
              cellclass,
              cellparams=None,
              structure=None,
              initial_values=None,
              label=None,
              constraints=None,
              additional_parameters=None):
     """
     :param int size: The number of neurons in the population
     :param cellclass: The implementation of the individual neurons.
     :type cellclass: type or AbstractPyNNModel
     :param cellparams: Parameters to pass to ``cellclass`` if it
         is a class to instantiate. Must be ``None`` if ``cellclass`` is an
         instantiated object.
     :type cellparams: dict(str,object) or None
     :param ~pyNN.space.BaseStructure structure:
     :param dict(str,float) initial_values:
         Initial values of state variables
     :param str label: A label for the population
     :param list(~pacman.model.constraints.AbstractConstraint) constraints:
         Any constraints on how the population is deployed to SpiNNaker.
     :param additional_parameters:
         Additional parameters to pass to the vertex creation function.
     :type additional_parameters: dict(str, ...)
     """
     # pylint: disable=too-many-arguments
     moved_in_v6("spynnaker8.models.populations.Population",
                 "spynnaker.pyNN.models.populations.Population")
     super(Population, self).__init__(size, cellclass, cellparams,
                                      structure, initial_values, label,
                                      constraints, additional_parameters)
Пример #2
0
    def __init__(
            self, conn_list, safe=True, verbose=False, column_names=None,
            callback=None):
        """
        :param conn_list:
            a list of tuples, one tuple for each connection. Each tuple should
            contain: `(pre_idx, post_idx, p1, p2, ..., pn)` where `pre_idx` is
            the index (i.e. order in the Population, not the ID) of the
            presynaptic neuron, `post_idx` is the index of the postsynaptic
            neuron, and `p1`, `p2`, etc. are the synaptic parameters (e.g.,
            weight, delay, plasticity parameters).
        :type conn_list: list(tuple(int,int,...)) or ~numpy.ndarray
        :param bool safe:
            if True, check that weights and delays have valid values.
            If False, this check is skipped.
        :param bool verbose:
            Whether to output extra information about the connectivity to a
            CSV file
        :param column_names:
            the names of the parameters `p1`, `p2`, etc. If not provided, it
            is assumed the parameters are `weight, delay` (for backwards
            compatibility).
        :type column_names: tuple(str) or list(str) or None
        :param callable callback:
            if given, a callable that display a progress bar on the terminal.

            .. note::
                Not supported by sPyNNaker.
        """
        moved_in_v6("spynnaker8.models.connectors.FromListConnector",
                    "spynnaker.pyNN.models.neural_projections.connectors"
                    ".FromListConnector")
        _BaseClass.__init__(
            self, conn_list=conn_list, safe=safe, verbose=verbose,
            column_names=column_names, callback=callback)
Пример #3
0
 def __init__(
         self, partner_selection, formation, elimination,
         f_rew=DEFAULT_F_REW, initial_weight=DEFAULT_INITIAL_WEIGHT,
         initial_delay=DEFAULT_INITIAL_DELAY, s_max=DEFAULT_S_MAX,
         seed=None, weight=StaticSynapse.default_parameters['weight'],
         delay=None):
     """
     :param AbstractPartnerSelection partner_selection:
         The partner selection rule
     :param AbstractFormation formation: The formation rule
     :param AbstractElimination elimination: The elimination rule
     :param int f_rew: How many rewiring attempts will be done per second.
     :param float initial_weight:
         Weight assigned to a newly formed connection
     :param initial_delay:
         Delay assigned to a newly formed connection; a single value means
         a fixed delay value, or a tuple of two values means the delay will
         be chosen at random from a uniform distribution between the given
         values
     :type initial_delay: float or tuple(float, float)
     :param int s_max: Maximum fan-in per target layer neuron
     :param int seed: seed the random number generators
     :param float weight: The weight of connections formed by the connector
     :param delay: The delay of connections formed by the connector
     :type delay: float or None
     """
     moved_in_v6("spynnaker8.models.synapse_dynamics"
                 ".SynapseDynamicsStructuralStatic",
                 "spynnaker.pyNN.models.neuron.synapse_dynamics"
                 ".SynapseDynamicsStructuralStatic")
     _BaseClass.__init__(
         self, partner_selection, formation, elimination, f_rew=f_rew,
         initial_weight=initial_weight, initial_delay=initial_delay,
         s_max=s_max, seed=seed, weight=weight, delay=delay)
Пример #4
0
    def __init__(
            self, p_connect, allow_self_connections=True, safe=True,
            verbose=False, rng=None, callback=None):
        """
        :param float p_connect: a number between zero and one. Each potential
            connection is created with this probability.
        :param bool allow_self_connections: if the connector is used to
            connect a Population to itself, this flag determines whether a
            neuron is allowed to connect to itself, or only to other neurons
            in the Population.
        :param bool safe: if True, check that weights and delays have valid
            values. If False, this check is skipped.
        :param ~pyNN.space.Space space: a Space object, needed if you wish to
            specify distance-dependent weights or delays - not implemented
        :param bool verbose:
            Whether to output extra information about the connectivity to a
            CSV file
        :param rng: random number generator
        :type rng: ~pyNN.random.NumpyRNG or None
        :param callable callback:
            if given, a callable that display a progress bar on the terminal.

            .. note::
                Not supported by sPyNNaker.
        """
        # pylint: disable=too-many-arguments
        moved_in_v6("spynnaker8.models.connectors",
                    "spynnaker.pyNN.models.neural_projections.connectors")
        _BaseClass.__init__(
            self, p_connect=p_connect,
            allow_self_connections=allow_self_connections, safe=safe,
            verbose=verbose, rng=rng, callback=callback)
Пример #5
0
    def __init__(self,
                 allow_self_connections=True,
                 safe=True,
                 verbose=None,
                 callback=None):
        """
        :param bool allow_self_connections:
            if the connector is used to connect a Population to itself, this
            flag determines whether a neuron is allowed to connect to itself,
            or only to other neurons in the Population.
        :param bool safe: if True, check that weights and delays have valid
            values. If False, this check is skipped.
        :param bool verbose:
            Whether to output extra information about the connectivity to a
            CSV file
        :param callable callback:
            if given, a callable that display a progress bar on the terminal.

            .. note::
                Not supported by sPyNNaker.
        """
        moved_in_v6(
            "spynnaker8.models.connectors.AllToAllConnector",
            "spynnaker.pyNN.models.neural_projections.connectors"
            ".AllToAllConnector")
        _BaseClass.__init__(self,
                            allow_self_connections=allow_self_connections,
                            safe=safe,
                            verbose=verbose,
                            callback=callback)
Пример #6
0
 def __init__(self,
              n,
              allow_self_connections=True,
              with_replacement=True,
              safe=True,
              verbose=False,
              rng=None):
     """
     :param int n: This is the total number of synapses in the connection.
     :param bool allow_self_connections:
         Allow a neuron to connect to itself or not.
     :param bool with_replacement:
         When selecting, allow a neuron to be re-selected or not.
     :param bool safe:
         Whether to check that weights and delays have valid values.
         If False, this check is skipped.
     :param bool verbose:
         Whether to output extra information about the connectivity to a
         CSV file
     :param rng: random number generator
     :type rng: ~pyNN.random.NumpyRNG or None
     """
     moved_in_v6(
         "spynnaker8.models.connectors.MultapseConnector",
         "spynnaker.pyNN.models.neural_projections.connectors."
         "MultapseConnector")
     super(MultapseConnector,
           self).__init__(n=n,
                          allow_self_connections=allow_self_connections,
                          with_replacement=with_replacement,
                          safe=safe,
                          verbose=verbose,
                          rng=rng)
Пример #7
0
    def __init__(self,
                 timing_dependence,
                 weight_dependence,
                 voltage_dependence=None,
                 dendritic_delay_fraction=1.0,
                 weight=PyNNStaticSynapse.default_parameters['weight'],
                 delay=None,
                 backprop_delay=True):
        """
        :param AbstractTimingDependence timing_dependence:
        :param AbstractWeightDependence weight_dependence:
        :param None voltage_dependence: Unsupported
        :param float dendritic_delay_fraction:
        :param float weight:
        :param delay:
        :type delay: float or None
        :param bool backprop_delay:
        """
        # pylint: disable=too-many-arguments

        # instantiate common functionality.
        moved_in_v6(
            "spynnaker8.models.synapse_dynamics.SynapseDynamicsSTDP",
            "spynnaker.pyNN.models.neuron.synapse_dynamics"
            ".SynapseDynamicsSTDP")
        super(SynapseDynamicsSTDP,
              self).__init__(timing_dependence,
                             weight_dependence,
                             voltage_dependence,
                             dendritic_delay_fraction,
                             weight,
                             delay,
                             backprop_delay=backprop_delay)
Пример #8
0
 def __init__(self,
              pre_synaptic_population,
              post_synaptic_population,
              connector,
              synapse_type=None,
              source=None,
              receptor_type=None,
              space=None,
              label=None):
     """
     :param ~spynnaker.pyNN.models.populations.PopulationBase \
             pre_synaptic_population:
     :param ~spynnaker.pyNN.models.populations.PopulationBase \
             post_synaptic_population:
     :param AbstractConnector connector:
     :param AbstractStaticSynapseDynamics synapse_type:
     :param None source: Unsupported; must be None
     :param str receptor_type:
     :param ~pyNN.space.Space space:
     :param str label:
     """
     moved_in_v6("spynnaker8.models.projection",
                 "spynnaker.pyNN.models.projection")
     super(Projection,
           self).__init__(pre_synaptic_population, post_synaptic_population,
                          connector, synapse_type, source, receptor_type,
                          space, label)
 def __init__(
         self,
         accumulator_depression=_defaults['accumulator_depression'],
         accumulator_potentiation=_defaults['accumulator_potentiation'],
         mean_pre_window=_defaults['mean_pre_window'],
         mean_post_window=_defaults['mean_post_window'],
         dual_fsm=_defaults['dual_fsm'],
         A_plus=0.01,
         A_minus=0.01):
     """
     :param int accumulator_depression:
     :param int accumulator_potentiation:
     :param float mean_pre_window:
     :param float mean_post_window:
     :param bool dual_fsm:
     :param float A_plus: :math:`A^+`
     :param float A_minus: :math:`A^-`
     """
     # pylint: disable=too-many-arguments
     moved_in_v6(
         "spynnaker8.models.synapse_dynamics.timing_dependence."
         "TimingDependenceRecurrent",
         "spynnaker.pyNN.models.neuron.plasticity.stdp."
         "timing_dependence.TimingDependenceRecurrent")
     super(TimingDependenceRecurrent,
           self).__init__(accumulator_depression=accumulator_depression,
                          accumulator_potentiation=accumulator_potentiation,
                          mean_pre_window=mean_pre_window,
                          mean_post_window=mean_post_window,
                          dual_fsm=dual_fsm,
                          A_plus=A_plus,
                          A_minus=A_minus)
 def __init__(self,
              tau_plus,
              tau_minus,
              tau_x,
              tau_y,
              A_plus=0.01,
              A_minus=0.01):
     r"""
     :param float tau_plus: :math:`\tau_+`
     :param float tau_minus: :math:`\tau_-`
     :param float tau_x: :math:`\tau_x`
     :param float tau_y: :math:`\tau_y`
     :param float A_plus: :math:`A^+`
     :param float A_minus: :math:`A^-`
     """
     # pylint: disable=too-many-arguments
     moved_in_v6(
         "spynnaker8.models.synapse_dynamics.timing_dependence."
         "TimingDependencePfisterSpikeTriplet",
         "spynnaker.pyNN.models.neuron.plasticity.stdp."
         "timing_dependence.TimingDependencePfisterSpikeTriplet")
     super(TimingDependencePfisterSpikeTriplet,
           self).__init__(tau_plus=tau_plus,
                          tau_minus=tau_minus,
                          tau_x=tau_x,
                          tau_y=tau_y,
                          A_plus=A_plus,
                          A_minus=A_minus)
Пример #11
0
 def __init__(self, population, vertex):
     """
     :param population: the population to record for
     :type population: ~spynnaker.pyNN.models.populations.Population
     """
     moved_in_v6("spynnaker8.models.recorder",
                 "spynnaker.pyNN.models.recorder")
     super(Recorder, self).__init__(population, vertex)
Пример #12
0
 def __init__(self, w_min=0.0, w_max=1.0):
     r"""
     :param float w_min: :math:`w_\mathrm{min}`
     :param float w_max: :math:`w_\mathrm{max}`
     """
     moved_in_v6("spynnaker8.models.synapse_dynamics.weight_dependence"
                 ".WeightDependenceMultiplicative",
                 "spynnaker.pyNN.models.neuron.plasticity.stdp."
                 "weight_dependence.WeightDependenceMultiplicative")
     super(WeightDependenceMultiplicative, self).__init__(
         w_max=w_max, w_min=w_min)
Пример #13
0
 def __init__(self, *populations, **kwargs):
     """
     :param populations:
         the populations or views to form the assembly out of
     :type populations: ~spynnaker.pyNN.models.populations.Population or
         ~spynnaker.pyNN.models.populations.PopulationView
     :param kwargs: may contain `label` (a string describing the assembly)
     """
     moved_in_v6("spynnaker8.models.populations.Assembly",
                 "spynnaker.pyNN.models.populations.Assembly")
     super(Assembly, self).__init__(*populations, **kwargs)
Пример #14
0
def convert_spiketrains(spiketrains):
    """ Converts a list of spiketrains into spynnaker7 format

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param list(~neo.core.SpikeTrain) spiketrains: List of SpikeTrains
    :rtype: ~numpy.ndarray
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_spiketrains(spiketrains)
Пример #15
0
 def __init__(self,
              weight=PyNNStaticSynapse.default_parameters['weight'],
              delay=None):
     """
     :param float weight:
     :param delay:
     :type delay: float or None
     """
     moved_in_v6(
         "spynnaker8.models.synapse_dynamics.SynapseDynamicsStatic",
         "spynnaker.pyNN.models.neuron.synapse_dynamics"
         ".SynapseDynamicsStatic")
     super(SynapseDynamicsStatic, self).__init__(weight, delay)
Пример #16
0
 def __init__(
         self, alpha, tau=_defaults['tau'], A_plus=0.01, A_minus=0.01):
     r"""
     :param float alpha: :math:`\alpha`
     :param float tau: :math:`\tau`
     :param float A_plus: :math:`A^+`
     :param float A_minus: :math:`A^-`
     """
     moved_in_v6("spynnaker8.models.synapse_dynamics.timing_dependence."
                 "TimingDependenceVogels2011",
                 "spynnaker.pyNN.models.neuron.plasticity.stdp."
                 "timing_dependence.TimingDependenceVogels2011")
     super(TimingDependenceVogels2011, self).__init__(
         tau=tau, alpha=alpha, A_plus=A_plus, A_minus=A_minus)
Пример #17
0
def count_spiketrains(spiketrains):
    """ Help function to count the number of spikes in a list of spiketrains

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param list(~neo.core.SpikeTrain) spiketrains: List of SpikeTrains
    :return: Total number of spikes in all the spiketrains
    :rtype: int
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return sum(map(len, spiketrains))
Пример #18
0
def convert_spikes(neo, run=0):
    """ Extracts the spikes for run one from a Neo Object

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param ~neo.core.Block neo: neo Object including Spike Data
    :param int run: Zero based index of the run to extract data for
    :rtype: ~numpy.ndarray
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_spikes(neo, run)
Пример #19
0
def convert_gsyn(gsyn_exc, gsyn_inh):
    """ Converts two neo objects into the spynnaker7 format

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param ~neo.core.Block gsyn_exc: neo with gsyn_exc data
    :param ~neo.core.Block gsyn_inh: neo with gsyn_exc data
    :rtype: ~numpy.ndarray
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_gsyn(gsyn_exc, gsyn_inh)
Пример #20
0
def plot_spikes_numpy(ax, spikes, label='', **options):
    """ Plot all spikes

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.spynnaker_plotting` instead.

    :param ~matplotlib.axes.Axes ax: An Axes in a matplotlib figure
    :param ~numpy.ndarray spikes: spynakker7 format nparray of spikes
    :param str label: Label for the graph
    :param options: plotting options
    """
    moved_in_v6("spynnaker8.spynnaker_plotting",
                "spynnaker.spynnaker_plotting")
    new_plotting.plot_spikes_numpy(ax, spikes, label, **options)
Пример #21
0
def heat_plot_numpy(ax, data, label='', **options):
    """ Plots neurons, times and values into a heatmap

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.spynnaker_plotting` instead.

    :param ~matplotlib.axes.Axes ax: An Axes in a matplotlib figure
    :param ~numpy.ndarray data: nparray of values in spynnaker7 format
    :param str label: Label for the graph
    :param options: plotting options
    """
    moved_in_v6("spynnaker8.spynnaker_plotting",
                "spynnaker.spynnaker_plotting")
    new_plotting.heat_plot_numpy(ax, data, label, **options)
Пример #22
0
def plot_spiketrains(ax, spiketrains, label='', **options):
    """ Plot all spike trains in a Segment in a raster plot.

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.spynnaker_plotting` instead.

    :param ~matplotlib.axes.Axes ax: An Axes in a matplotlib figure
    :param list(~neo.core.SpikeTrain) spiketrains: List of spiketimes
    :param str label: Label for the graph
    :param options: plotting options
    """
    moved_in_v6("spynnaker8.spynnaker_plotting",
                "spynnaker.spynnaker_plotting")
    new_plotting.plot_spiketrains(ax, spiketrains, label, **options)
Пример #23
0
def convert_analog_signal(signal_array, time_unit):
    """ Converts part of a NEO object into told spynnaker7 format

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param ~neo.core.AnalogSignal signal_array: Extended Quantities object
    :param quantities.unitquantity.UnitTime time_unit:
        Data time unit for time index
    :rtype: ~numpy.ndarray
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_analog_signal(signal_array, time_unit)
Пример #24
0
def heat_plot_neo(ax, signal_array, label='', **options):
    """ Plots neurons, times and values into a heatmap

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.spynnaker_plotting` instead.

    :param ~matplotlib.axes.Axes ax: An Axes in a matplotlib figure
    :param ~neo.core.AnalogSignal signal_array: Neo Signal array Object
    :param str label: Label for the graph
    :param options: plotting options
    """
    moved_in_v6("spynnaker8.spynnaker_plotting",
                "spynnaker.spynnaker_plotting")
    new_plotting.heat_plot_neo(ax, signal_array, label, **options)
Пример #25
0
def plot_segment(axes, segment, label='', **options):
    """ Plots a segment into a plot of spikes or a heatmap

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.spynnaker_plotting` instead.

    :param ~matplotlib.axes.Axes axes: An Axes in a matplotlib figure
    :param ~neo.core.Segment segment: Data for one run to plot
    :param str label: Label for the graph
    :param options: plotting options
    """
    moved_in_v6("spynnaker8.spynnaker_plotting",
                "spynnaker.spynnaker_plotting")
    new_plotting.plot_segment(axes, segment, label, **options)
Пример #26
0
    def __init__(self, safe=True, callback=None):
        """
        :param bool safe: if True, check that weights and delays have valid
            values. If False, this check is skipped.
        :param callable callback: a function that will be called with the
            fractional progress of the connection routine. An example would
            be `progress_bar.set_level`.

            .. note::
                Not supported by sPyNNaker.
        """
        moved_in_v6(
            "spynnaker8.models.connectors.OneToOneConnector",
            "spynnaker.pyNN.models.neural_projections.connectors"
            ".OneToOneConnector")
        _BaseClass.__init__(self, safe=safe, callback=callback)
Пример #27
0
def convert_data(data, name, run=0):
    """ Converts the data into a numpy array in the format ID, time, value

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param ~neo.core.Block data: Data as returned by a getData() call
    :param str name: Name of the data to be extracted.
        Same values as used in getData()
    :param int run: Zero based index of the run to extract data for
    :rtype: ~numpy.ndarray
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_data(data, name, run)
Пример #28
0
 def __init__(self, w_min=0.0, w_max=1.0, A3_plus=0.01, A3_minus=0.01):
     r"""
     :param float w_min: :math:`w_\mathrm{min}`
     :param float w_max: :math:`w_\mathrm{max}`
     :param float A3_plus: :math:`A_3^+`
     :param float A3_minus: :math:`A_3^-`
     """
     moved_in_v6(
         "spynnaker8.models.synapse_dynamics.weight_dependence"
         ".WeightDependenceAdditiveTriplet",
         "spynnaker.pyNN.models.neuron.plasticity.stdp."
         "weight_dependence.WeightDependenceAdditiveTriplet")
     super(WeightDependenceAdditiveTriplet,
           self).__init__(w_max=w_max,
                          w_min=w_min,
                          A3_plus=A3_plus,
                          A3_minus=A3_minus)
Пример #29
0
def convert_v_list(data, runs=None):
    """ Converts the voltage into a list numpy array one per segment (all\
        runs) in the format ID, time, value

    .. deprecated:: 6.0
        Use
        :py:class:`spynnaker.pyNN.utilities.neo_convertor` instead.

    :param ~neo.core.Block data: The data to convert; it must have V data in it
    :param runs: List of Zero based index of the run to extract data for.
        Or None to extract all runs
    :type runs: list(int) or None
    :rtype: list(~numpy.ndarray)
    """
    moved_in_v6("spynnaker8.utilities.neo_convertor",
                "spynnaker.pyNN.utilities.neo_convertor")
    return _convert_data_list(data, "v", runs=runs)
Пример #30
0
    def __init__(self,
                 n,
                 allow_self_connections=True,
                 safe=True,
                 verbose=False,
                 with_replacement=False,
                 rng=None,
                 callback=None):
        """
        :param int n:
            number of random pre-synaptic neurons connected to post-neurons
        :param bool allow_self_connections:
            if the connector is used to connect a Population to itself, this
            flag determines whether a neuron is allowed to connect to itself,
            or only to other neurons in the Population.
        :param bool safe:
            Whether to check that weights and delays have valid values.
            If False, this check is skipped.
        :param bool verbose:
            Whether to output extra information about the connectivity to a
            CSV file
        :param bool with_replacement:
            if False, once a connection is made, it can't be made again; if
            True, multiple connections between the same pair of neurons are
            allowed
        :param rng: random number generator
        :type rng: ~pyNN.random.NumpyRNG or None
        :param callable callback:
            if given, a callable that display a progress bar on the terminal.

            .. note::
                Not supported by sPyNNaker.
        """
        # pylint: disable=too-many-arguments
        moved_in_v6(
            "spynnaker8.models.connectors.FixedNumberPreConnector",
            "spynnaker.pyNN.models.neural_projections.connectors"
            ".FixedNumberPreConnector")
        super(FixedNumberPreConnector,
              self).__init__(n=n,
                             allow_self_connections=allow_self_connections,
                             with_replacement=with_replacement,
                             safe=safe,
                             verbose=verbose,
                             rng=rng)