Class for generating Poisson spike trains.
More...
#include <poisson_rate.h>
The PoissonRate class allows a user create spike trains whose inter-spike interval follows a Poisson process. The object can then be linked to a spike generator group (created via CARLsim::createSpikeGeneratorGroup) by calling CARLsim::setSpikeRate.
All firing rates will be initialized to zero. The user then has a number of options to manipulate the mean firing rate of each neuron. The same rate can be applied to all neurons by calling PoissonRate::setRates(float rate). Individual rates can be applied from a vector by calling PoissonRate::setRates(const std::vector<float>& rates). The rate of a single neuron can be manipulated by calling PoissonRate::setRate(int neurId, float rate).
Example usage:
myRate.setRate(42, 20.0f);
myRate.setRates(12.0f);
- Attention
- The mean firing rate will keep getting applied to any instances of CARLsim::runNetwork until the user changes the values and calls CARLsim::setSpikeRate again.
- Note
- A PoissonRate object can be allocated either on the CPU or the GPU. However, GPU allocation is only supported if the CARLsim simulation is run in GPU_MODE.
- Since
- v3.0
Definition at line 88 of file poisson_rate.h.
◆ PoissonRate()
Creates a new instance of class PoissonRate.
- Parameters
-
[in] | nNeur | the number of neurons for which to generate Poisson spike trains |
[in] | onGPU | whether to allocate the rate vector on GPU (true) or CPU (false) |
- Since
- v2.0
Definition at line 227 of file poisson_rate.cpp.
◆ ~PoissonRate()
Cleans up all the memory upon object deletion.
- Since
- v2.0
Definition at line 228 of file poisson_rate.cpp.
◆ getNumNeurons()
This function returns the number of neurons for which to generate Poisson spike trains. This number is defined at initialization and cannot be changed during the object lifetime.
- Returns
- number of neurons
- Since
- v3.0
Definition at line 230 of file poisson_rate.cpp.
◆ getRate()
float getRate |
( |
int |
neurId | ) |
|
This function returns the mean firing rate assigned to a specific neuron ID. The neuron ID is 0-indexed and should thus be in the range [ 0 , getNumNeurons() ). It is completely independent from CARLsim neuron IDs.
- Parameters
-
[in] | neurId | the neuron ID (0-indexed) |
- Returns
- mean firing rate
- Since
- v3.0
Definition at line 231 of file poisson_rate.cpp.
◆ getRatePtrCPU()
float * getRatePtrCPU |
( |
| ) |
|
This function returns a pointer to the underlying firing rate array if allocated on the CPU. This pointer does not exist when the PoissonRate object is allocated on GPU.
- Deprecated:
- This function is deprecated, as it should not be exposed to the high-level UI API. Use PoissonRate::getRates instead.
Definition at line 233 of file poisson_rate.cpp.
◆ getRatePtrGPU()
float * getRatePtrGPU |
( |
| ) |
|
This function returns a pointer to the underlying firing rate array if allocated on the GPU. This pointer does not exist when the PoissonRate object is allocated on CPU.
- Deprecated:
- This function is deprecated, as it should not be exposed to the high-level UI API. Use PoissonRate::getRates instead.
Definition at line 234 of file poisson_rate.cpp.
◆ getRates()
std::vector< float > getRates |
( |
| ) |
|
This function returns all the mean firing rates in a vector, one vector element per neuron.
- Returns
- vector of firing rates
- Since
- v3.0
Definition at line 232 of file poisson_rate.cpp.
◆ isOnGPU()
This function checks whether the firing rates are allocated either on CPU or GPU.
- Returns
- a flag whether allocated on GPU (true) or CPU (false)
- Since
- v3.0
Definition at line 235 of file poisson_rate.cpp.
◆ setRate()
void setRate |
( |
int |
neurId, |
|
|
float |
rate |
|
) |
| |
This function sets the firing rate of a particular neuron ID. The neuron ID is 0-indexed and should thus be in the range [ 0 , getNumNeurons() ). It is completely independent from CARLsim neuron IDs.
- Parameters
-
[in] | neurId | the neuron ID (0-indexed) |
[in] | rate | the firing rate to set |
- Since
- v3.0
Definition at line 236 of file poisson_rate.cpp.
◆ setRates() [1/2]
void setRates |
( |
float |
rate | ) |
|
This function assigns the same firing rate to all the neurons.
- Parameters
-
[in] | rate | the firing rate to set |
- Since
- v3.0
Definition at line 237 of file poisson_rate.cpp.
◆ setRates() [2/2]
void setRates |
( |
const std::vector< float > & |
rates | ) |
|
This function sets the firing rate of each neuron from a vector of firing rates, one rate per neuron.
- Parameters
-
- Since
- v3.0
Definition at line 238 of file poisson_rate.cpp.
The documentation for this class was generated from the following files: