Ejemplo n.º 1
0
    def __init__(
            self, n_neurons, machine_time_step, timescale_factor,
            constraints=None, label="SpikeSourcePoisson", rate=1.0, start=0.0,
            duration=None, seed=None):
        """
        Creates a new SpikeSourcePoisson Object.
        """
        AbstractPartitionableVertex.__init__(
            self, n_atoms=n_neurons, label=label, constraints=constraints,
            max_atoms_per_core=self._model_based_max_atoms_per_core)
        AbstractDataSpecableVertex.__init__(
            self, machine_time_step=machine_time_step,
            timescale_factor=timescale_factor)
        AbstractSpikeRecordable.__init__(self)
        AbstractReceiveBuffersToHost.__init__(self)

        # Store the parameters
        self._rate = rate
        self._start = start
        self._duration = duration
        self._rng = numpy.random.RandomState(seed)

        # Prepare for recording, and to get spikes
        self._spike_recorder = SpikeRecorder(machine_time_step)
        self._spike_buffer_max_size = config.getint(
            "Buffers", "spike_buffer_size")
        self._buffer_size_before_receive = config.getint(
            "Buffers", "buffer_size_before_receive")
        self._time_between_requests = config.getint(
            "Buffers", "time_between_requests")
    def __init__(
            self, buffering_output, resources_required, label,
            constraints=None):
        """
        :param buffering_output: True if the vertex is set to buffer output,\
                    False otherwise
        :param resources_required: The approximate resources needed for\
                    the vertex
        :type resources_required:\
                    :py:class:`pacman.models.resources.resource_container.ResourceContainer`
        :param label: The name of the subvertex
        :type label: str
        :param constraints: The constraints of the subvertex
        :type constraints: iterable of\
                    :py:class:`pacman.model.constraints.abstract_constraint\
                    .AbstractConstraint`
        :raise pacman.exceptions.PacmanInvalidParameterException:
                    * If one of the constraints is not valid
        """
        AbstractReceiveBuffersToHost.__init__(self)
        PartitionedVertex.__init__(
            self, resources_required=resources_required, label=label,
            constraints=constraints)

        self._buffering_output = buffering_output
    def __init__(self, resample_factor, seed, n_fibres, ear_index, profile, fs,
                 n_lsr, n_msr, n_hsr, n_buffers_in_sdram_total, seq_size,
                 ihcan_neuron_recorder, ihcan_atom_slice, timer_period):
        """ constructor

        :param resample_factor: resample factor
        :param seed: the seed used for its random number generator in SpiNNaker
        :param n_fibres: how many fibres to simulate
        :param ear_index: which ear its based on
        :param profile: bool flag for profiling
        :param fs: sample freq
        :param n_lsr: number of low freq hair cells
        :param n_msr: number of med freq hair cells
        :param n_hsr: number of high freq hair cells
        :param n_buffers_in_sdram_total: the total number of sdram buffers in \
        the sdram edge
        :param seg_size: the seq size
        :param ihcan_neuron_recorder: recorder for the ihcan recordings
        :param ihcan_atom_slice: the slice of atoms for the ihcan vertex from \
        the global.
        """

        MachineVertex.__init__(self, label="IHCAN Node", constraints=None)
        AbstractProvidesNKeysForPartition.__init__(self)
        AbstractEarProfiled.__init__(self, profile, self.REGIONS.PROFILE.value)
        ProvidesProvenanceDataFromMachineImpl.__init__(self)
        AbstractHasAssociatedBinary.__init__(self)
        AbstractGeneratesDataSpecification.__init__(self)
        AbstractReceiveBuffersToHost.__init__(self)

        self._ihcan_neuron_recorder = ihcan_neuron_recorder
        self._ihcan_recording_atom_slice = ihcan_atom_slice
        self._ear_index = ear_index

        self._re_sample_factor = resample_factor
        self._fs = fs
        self._dt = 1.0 / self._fs
        self._n_atoms = n_fibres
        self._n_buffers_in_sdram_total = n_buffers_in_sdram_total
        self._seq_size = seq_size
        self._timer_period = timer_period

        if n_lsr + n_msr + n_hsr > n_fibres:
            raise Exception(
                self.N_FIBRES_ERROR.format(n_fibres, n_lsr, n_msr, n_hsr))

        self._n_lsr = n_lsr
        self._n_msr = n_msr
        self._n_hsr = n_hsr
        self._seed = seed