CARLsim
4.1.0
CARLsim: a GPU-accelerated SNN simulator
|
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore source code. Example networks that use this methodology can be found in the examples/ directory. Documentation is available on our website. More...
#include <carlsim.h>
Classes | |
class | Impl |
Public Member Functions | |
CARLsim (const std::string &netName="SNN", SimMode preferredSimMode=CPU_MODE, LoggerMode loggerMode=USER, int ithGPUs=0, int randSeed=-1) | |
CARLsim constructor. Creates a new instance of class CARLsim. All input arguments are optional, but if specified will be constant throughout the lifetime of the CARLsim object. More... | |
~CARLsim () | |
void | biasWeights (short int connId, float bias, bool updateWeightRange=false) |
Adds a constant bias to the weight of every synapse in the connection. More... | |
short int | connect (int grpId1, int grpId2, ConnectionGenerator *conn, bool synWtType=SYN_FIXED) |
Shortcut to make connections with custom connectivity profile but omit scaling factors for synaptic conductances (default is 1.0 for both) More... | |
short int | connect (int grpId1, int grpId2, ConnectionGenerator *conn, float mulSynFast, float mulSynSlow, bool synWtType=SYN_FIXED) |
make connections with custom connectivity profile More... | |
short int | connect (int grpId1, int grpId2, const std::string &connType, const RangeWeight &wt, float connProb, const RangeDelay &delay=RangeDelay(1), const RadiusRF &radRF=RadiusRF(-1.0), bool synWtType=SYN_FIXED, float mulSynFast=1.0f, float mulSynSlow=1.0f) |
Connects a presynaptic to a postsynaptic group using fixed/plastic weights and a range of delay values. More... | |
short int | connectCompartments (int grpIdLower, int grpIdUpper) |
make a compartmental connection between two compartmentally enabled groups Note: all compartmentally connected groups must be located on the same partition. More... | |
int | createGroup (const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
Create a group of Izhikevich spiking neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1) More... | |
int | createGroup (const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
creates a group of Izhikevich spiking neurons More... | |
int | createGroupLIF (const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
Create a group of LIF spiking neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1) More... | |
int | createGroupLIF (const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
creates a group of Leaky-Integrate-and-Fire (LIF) spiking neurons More... | |
int | createSpikeGeneratorGroup (const std::string &grpName, const Grid3D &grid, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
create a group of spike generators on a 3D grid More... | |
int | createSpikeGeneratorGroup (const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES) |
creates a spike generator group More... | |
CARLsimState | getCARLsimState () |
Writes population weights from gIDpre to gIDpost to file fname in binary. More... | |
std::vector< float > | getConductanceAMPA (int grpId) |
gets AMPA vector of a group More... | |
std::vector< float > | getConductanceGABAa (int grpId) |
gets GABAa vector of a group More... | |
std::vector< float > | getConductanceGABAb (int grpId) |
gets GABAb vector of a group More... | |
std::vector< float > | getConductanceNMDA (int grpId) |
gets NMDA vector of a group More... | |
RangeDelay | getDelayRange (short int connId) |
returns the RangeDelay struct for a specific connection ID More... | |
uint8_t * | getDelays (int gIDpre, int gIDpost, int &Npre, int &Npost) |
gets delays More... | |
int | getGroupEndNeuronId (int grpId) |
returns the last neuron id of a groupd specified by grpId More... | |
Grid3D | getGroupGrid3D (int grpId) |
returns the 3D grid struct of a group More... | |
int | getGroupId (std::string grpName) |
finds the ID of the group with name grpName More... | |
std::string | getGroupName (int grpId) |
gets group name More... | |
GroupNeuromodulatorInfo | getGroupNeuromodulatorInfo (int grpId) |
returns the neuromodulator information of a group specified by grpId More... | |
int | getGroupNumNeurons (int grpId) |
returns the number of neurons of a group specified by grpId More... | |
int | getGroupStartNeuronId (int grpId) |
returns the first neuron id of a groupd specified by grpId More... | |
GroupSTDPInfo | getGroupSTDPInfo (int grpId) |
returns the stdp information of a group specified by grpId More... | |
const FILE * | getLogFpDeb () |
returns file pointer to debug log More... | |
const FILE * | getLogFpErr () |
returns file pointer to error log More... | |
const FILE * | getLogFpInf () |
returns file pointer to info log More... | |
const FILE * | getLogFpLog () |
returns file pointer to log file More... | |
int | getMaxNumCompConnections () |
Returns the maximum number of allowed compartmental connections per group. More... | |
Point3D | getNeuronLocation3D (int grpId, int relNeurId) |
returns the 3D location a neuron codes for More... | |
Point3D | getNeuronLocation3D (int neurId) |
returns the 3D location a neuron codes for More... | |
int | getNumConnections () |
Returns the number of connections (pairs of pre-post groups) in the network. More... | |
int | getNumGroups () |
returns the number of groups in the network More... | |
int | getNumNeurons () |
returns the total number of allocated neurons in the network More... | |
int | getNumNeuronsGen () |
returns the total number of spike generator neurons More... | |
int | getNumNeuronsGenExc () |
returns the total number of excitatory spike generator neurons More... | |
int | getNumNeuronsGenInh () |
returns the total number of inhibitory spike generator neurons More... | |
int | getNumNeuronsReg () |
returns the total number of regular (Izhikevich) neurons More... | |
int | getNumNeuronsRegExc () |
returns the total number of regular (Izhikevich) excitatory neurons More... | |
int | getNumNeuronsRegInh () |
returns the total number of regular (Izhikevich) inhibitory neurons More... | |
int | getNumSynapses () |
returns the total number of allocated synaptic connections in the network More... | |
int | getNumSynapticConnections (short int connectionId) |
returns the number of connections associated with a connection ID More... | |
int | getSimTime () |
returns More... | |
int | getSimTimeMsec () |
returns More... | |
int | getSimTimeSec () |
returns More... | |
SpikeMonitor * | getSpikeMonitor (int grpId) |
Returns the number of spikes per neuron for a certain group. More... | |
RangeWeight | getWeightRange (short int connId) |
returns the RangeWeight struct for a specific connection ID More... | |
bool | isConnectionPlastic (short int connId) |
Returns whether a connection is fixed or plastic. More... | |
bool | isExcitatoryGroup (int grpId) |
returns More... | |
bool | isGroupWithHomeostasis (int grpId) |
Returns whether a group has homeostasis enabled. More... | |
bool | isInhibitoryGroup (int grpId) |
returns More... | |
bool | isPoissonGroup (int grpId) |
returns More... | |
void | loadSimulation (FILE *fid) |
Loads a simulation (and network state) from file. The file pointer fid must point to a valid CARLsim network save file (created with CARLsim::saveSimulation). More... | |
int | runNetwork (int nSec, int nMsec=0, bool printRunSummary=true) |
run the simulation for time=(nSec*seconds + nMsec*milliseconds) More... | |
void | saveSimulation (const std::string &fileName, bool saveSynapseInfo=true) |
Saves important simulation and network infos to file. More... | |
void | scaleWeights (short int connId, float scale, bool updateWeightRange=false) |
reset Spike Counter to zero More... | |
void | setCompartmentParameters (int grpId, float couplingUp, float couplingDown) |
Sets coupling constants G_u and G_d for the compartment. More... | |
void | setConductances (bool isSet) |
Sets default values for conduction decay and rise times or disables COBA alltogether. More... | |
void | setConductances (bool isSet, int tdAMPA, int tdNMDA, int tdGABAa, int tdGABAb) |
Sets custom values for conduction decay times (instantaneous rise time) or disables COBA alltogether. More... | |
void | setConductances (bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb) |
Sets custom values for conduction rise and decay times or disables COBA alltogether. More... | |
ConnectionMonitor * | setConnectionMonitor (int grpIdPre, int grpIdPost, const std::string &fname) |
Sets a connection monitor for a group, custom ConnectionMonitor class. More... | |
void | setDefaultConductanceTimeConstants (int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb) |
Sets default values for conductance time constants. More... | |
void | setDefaultESTDPparams (float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType) |
sets default values for E-STDP params More... | |
void | setDefaultHomeostasisParams (float homeoScale, float avgTimeScale) |
Sets default homeostasis params. More... | |
void | setDefaultISTDPparams (float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType) |
sets default values for I-STDP params More... | |
void | setDefaultSaveOptions (std::string fileName, bool saveSynapseInfo) |
Sets default options for save file. More... | |
void | setDefaultSTDPparams (float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType) |
sets default STDP params More... | |
void | setDefaultSTPparams (int neurType, float STP_U, float STP_tau_u, float STP_tau_x) |
Sets default values for STP params U, tau_u, and tau_x of a neuron group (pre-synaptically) More... | |
void | setESTDP (int grpId, bool isSet) |
Sets default E-STDP mode and parameters. More... | |
void | setESTDP (int grpId, bool isSet, STDPType type, ExpCurve curve) |
Sets E-STDP with the exponential curve. More... | |
void | setESTDP (int grpId, bool isSet, STDPType type, TimingBasedCurve curve) |
Sets E-STDP with the timing-based curve. More... | |
void | setExternalCurrent (int grpId, const std::vector< float > ¤t) |
Sets the amount of current (mA) to inject into a group. More... | |
void | setExternalCurrent (int grpId, float current) |
Sets the amount of current (mA) to inject to each neuron in a group. More... | |
GroupMonitor * | setGroupMonitor (int grpId, const std::string &fname) |
Sets a group monitor for a group, custom GroupMonitor class. More... | |
void | setHomeoBaseFiringRate (int grpId, float baseFiring, float baseFiringSD=0.0f) |
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling) More... | |
void | setHomeostasis (int grpId, bool isSet) |
Sets default values for implementation of homeostatic synaptic scaling. More... | |
void | setHomeostasis (int grpId, bool isSet, float homeoScale, float avgTimeScale) |
Sets custom values for implementation of homeostatic synaptic scaling. More... | |
void | setIntegrationMethod (integrationMethod_t method, int numStepsPerMs) |
void | setISTDP (int grpId, bool isSet) |
Sets default I-STDP mode and parameters. More... | |
void | setISTDP (int grpId, bool isSet, STDPType type, ExpCurve curve) |
Sets I-STDP with the exponential curve. More... | |
void | setISTDP (int grpId, bool isSet, STDPType type, PulseCurve curve) |
Sets I-STDP with the pulse curve. More... | |
void | setLogFile (const std::string &fileName) |
Sets the name of the log file. More... | |
void | setLogsFpCustom (FILE *fpInf=NULL, FILE *fpErr=NULL, FILE *fpDeb=NULL, FILE *fpLog=NULL) |
Sets the file pointers for all log files in CUSTOM mode. More... | |
void | setNeuromodulator (int grpId, float baseDP, float tauDP, float base5HT, float tau5HT, float baseACh, float tauACh, float baseNE, float tauNE) |
Sets baseline concentration and decay time constant of neuromodulators (DP, 5HT, ACh, NE) for a neuron group. More... | |
void | setNeuromodulator (int grpId, float tauDP=100.0f, float tau5HT=100.0f, float tauACh=100.0f, float tauNE=100.0f) |
Sets default neuromodulators. More... | |
NeuronMonitor * | setNeuronMonitor (int grpId, const std::string &fileName) |
Sets a Neuron Monitor for a groups, print voltage, recovery, and total current values to binary file. More... | |
void | setNeuronParameters (int grpId, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd, float izh_c, float izh_c_sd, float izh_d, float izh_d_sd) |
Sets Izhikevich params a, b, c, and d with as mean +- standard deviation. More... | |
void | setNeuronParameters (int grpId, float izh_a, float izh_b, float izh_c, float izh_d) |
Sets Izhikevich params a, b, c, and d of a neuron group. More... | |
void | setNeuronParameters (int grpId, float izh_C, float izh_C_sd, float izh_k, float izh_k_sd, float izh_vr, float izh_vr_sd, float izh_vt, float izh_vt_sd, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd, float izh_vpeak, float izh_vpeak_sd, float izh_c, float izh_c_sd, float izh_d, float izh_d_sd) |
Sets Izhikevich params C, k, vr, vt, a, b, vpeak, c, and d with as mean +- standard deviation C must be positive. There are no limits imposed on other parameters This is a nine parameter Izhikevich simple spiking model. More... | |
void | setNeuronParameters (int grpId, float izh_C, float izh_k, float izh_vr, float izh_vt, float izh_a, float izh_b, float izh_vpeak, float izh_c, float izh_d) |
Sets Izhikevich params C, k, vr, vt, a, b, vpeak, c, and d of a neuron group C must be positive. There are no limits imposed on other parameters This is a nine parameter Izhikevich simple spiking model. More... | |
void | setNeuronParametersLIF (int grpId, int tau_m, int tau_ref=0, float vTh=1.0f, float vReset=0.0f, const RangeRmem &rMem=RangeRmem(1.0f)) |
Sets neuron parameters for a group of LIF spiking neurons. More... | |
void | setSpikeGenerator (int grpId, SpikeGenerator *spikeGenFunc) |
A SpikeCounter keeps track of the number of spikes per neuron in a group. More... | |
SpikeMonitor * | setSpikeMonitor (int grpId, const std::string &fileName) |
Sets a Spike Monitor for a groups, prints spikes to binary file. More... | |
void | setSpikeRate (int grpId, PoissonRate *spikeRate, int refPeriod=1) |
Sets a spike rate. More... | |
void | setSTDP (int grpId, bool isSet) |
Sets default STDP mode and params. More... | |
void | setSTDP (int grpId, bool isSet, STDPType type, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus) |
Sets STDP params for a group, custom. More... | |
void | setSTP (int grpId, bool isSet) |
Sets STP params U, tau_u, and tau_x of a neuron group (pre-synaptically) using default values. More... | |
void | setSTP (int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x) |
Sets STP params U, tau_u, and tau_x of a neuron group (pre-synaptically) More... | |
void | setupNetwork () |
build the network More... | |
void | setWeight (short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false) |
Sets the weight value of a specific synapse. More... | |
void | setWeightAndWeightChangeUpdate (UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f) |
Sets the weight and weight change update parameters. More... | |
void | startTesting (bool updateWeights=true) |
Enters a testing phase in which all weight changes are disabled. More... | |
void | stopTesting () |
Exits a testing phase, making weight changes possible again. More... | |
This class provides a user interface to the public sections of CARLsimCore source code. Example networks that use this methodology can be found in the examples/ directory. Documentation is available on our website. This file is organized into different sections in the following way:
* ├── Public section * │ ├── Public methods * │ │ ├── Constructor / destructor * │ │ ├── Setting up a simulation * │ │ ├── Running a simulation * │ │ ├── Plotting / logging * │ │ ├── Interacting with a simulation * │ │ ├── Getters / setters * │ │ └── Set defaults * │ └── Public properties * └── Private section * ├── Private methods * └── Private properties *
Within these sections, methods and properties are ordered alphabetically.
CARLsim | ( | const std::string & | netName = "SNN" , |
SimMode | preferredSimMode = CPU_MODE , |
||
LoggerMode | loggerMode = USER , |
||
int | ithGPUs = 0 , |
||
int | randSeed = -1 |
||
) |
CARLsim allows execution on both generic x86 CPUs and standard off-the-shelf GPUs by specifying the simulation mode (CPU_MODE and GPU_MODE, respectively). When using the latter in a multi-GPU system, the user can also specify which CUDA device to use (param numGPUs, 0-indexed).
The logger mode defines where to print all status, error, and debug messages. Logger mode can either be USER (for experiment-oriented simulations), DEVELOPER (for developing and debugging code), SHOWTIME (where only warnings and errors are printed to console), SILENT (e.g., for benchmarking, where no output is generated at all), or CUSTOM (where the user can specify the file pointers of all log files). In summary, messages are printed to the following locations, depending on the logger mode:
* | USER | DEVELOPER | SHOWTIME | SILENT | CUSTOM * ----------------|------------|------------|------------|------------|--------- * Status msgs | stdout | stdout | /dev/null | /dev/null | ? * Errors/warnings | stderr | stderr | stderr | /dev/null | ? * Debug msgs | /dev/null | stdout | /dev/null | /dev/null | ? * All msgs | debug.log | debug.log | debug.log | debug.log | ? *
Location of the CARLsim log file can be set in any mode using setLogFile. In mode CUSTOM, the other file pointers can be set using setLogsFpCustom.
[in] | netName | network name |
[in] | preferredSimMode | CPU_MODE, GPU_MODE, or HYBRID_MODE |
[in] | loggerMode | USER, DEVELOPER, SILENT, or CUSTOM |
[in] | ithGPUs | on which GPU to establish a context (deprecated parameter) |
[in] | randSeed | random number generator seed |
Definition at line 1734 of file carlsim.cpp.
~CARLsim | ( | ) |
Definition at line 1736 of file carlsim.cpp.
void biasWeights | ( | short int | connId, |
float | bias, | ||
bool | updateWeightRange = false |
||
) |
This method adds a constant bias to the weight of every synapse in the connection specified by connId. The bias can be positive or negative. If a bias is specified that makes any weight+bias lie outside the range [minWt,maxWt] of this connection, the range will be updated accordingly if the flag updateWeightRange is set to true. If the flag is set to false, then the specified weight value will be corrected to lie on the boundary (either minWt or maxWt).
[in] | connId | the connection ID to manipulate |
[in] | bias | the bias value to add to every synapse |
[in] | updateWeightRange | a flag specifying what to do when the specified weight+bias lies outside the range [minWt,maxWt]. Set to true to update the range accordingly. Set to false to adjust the weight to be either minWt or maxWt. Default: false. |
Definition at line 1936 of file carlsim.cpp.
short int connect | ( | int | grpId1, |
int | grpId2, | ||
ConnectionGenerator * | conn, | ||
bool | synWtType = SYN_FIXED |
||
) |
Definition at line 1746 of file carlsim.cpp.
short int connect | ( | int | grpId1, |
int | grpId2, | ||
ConnectionGenerator * | conn, | ||
float | mulSynFast, | ||
float | mulSynSlow, | ||
bool | synWtType = SYN_FIXED |
||
) |
Definition at line 1749 of file carlsim.cpp.
short int connect | ( | int | grpId1, |
int | grpId2, | ||
const std::string & | connType, | ||
const RangeWeight & | wt, | ||
float | connProb, | ||
const RangeDelay & | delay = RangeDelay(1) , |
||
const RadiusRF & | radRF = RadiusRF(-1.0) , |
||
bool | synWtType = SYN_FIXED , |
||
float | mulSynFast = 1.0f , |
||
float | mulSynSlow = 1.0f |
||
) |
This function is a shortcut to create synaptic connections from a pre-synaptic group grpId1 to a post-synaptic group grpId2 using a pre-defined primitive type (such as "full", "one-to-one", or "random"). Synapse weights will stay the same throughout the simulation (SYN_FIXED, no plasticity). All synapses will have the same delay. For more flexibility, see the other connect() calls.
[in] | grpId1 | ID of the pre-synaptic group |
[in] | grpId2 | ID of the post-synaptic group |
[in] | connType | connection type. "random": random connectivity. "one-to-one": connect the i-th neuron in pre to the i-th neuron in post. "full": connect all neurons in pre to all neurons in post. "full-no-direct": same as "full", but i-th neuron of grpId1 will not be connected to the i-th neuron of grpId2. "gaussian": distance-dependent weights depending on the RadiusRF struct, where neurons coding for the same location have weight initWt, and neurons lying on the border of the RF have weight 0.1*initWt. |
[in] | wt | a struct specifying the range of weight magnitudes (initial value and max value). Weights range from 0 to maxWt, and are initialized with initWt. All weight values should be non-negative (equivalent to weight magnitudes), even for inhibitory connections. Examples: RangeWeight(0.1) => all weights will be 0.1 (wt.min=0.1, wt.max=0.1, wt.init=0.1) RangeWeight(0.0,0.2) => If pre is excitatory: all weights will be in range [0.0,0.2], and wt.init=0.0. If pre is inhibitory: all weights will be in range [-0.2,0.0], and wt.init=0.0. RangeWeight(0.0,0.1,0.2) => If pre is excitatory: all weights will be in range [0.0,0.2], and wt.init=0.1. If pre is inhibitory: all weights will be in range [-0.2,0.0], and wt.init=0.0. |
[in] | connProb | connection probability |
[in] | delay | A struct specifying the range of delay values (ms). Synaptic delays must be greater than or equal to 1 ms. Examples: RangeDelay(2) => all delays will be 2 (delay.min=2, delay.max=2) RangeDelay(1,10) => delays will be in range [1,10] |
[in] | radRF | A struct specifying the radius of the receptive field (RF). A radius can be specified in 3 dimensions x, y, and z (following the topographic organization of neurons as specified by Grid3D). Receptive fields will be circular with radius as specified. The 3 dimensions follow the ones defined by Grid3D. If the radius in one dimension is 0, no connections will be made in this dimension. If the radius in one dimension is -1, then all possible connections will be made in this dimension (effectively making RF of infinite size). Otherwise, if the radius is a positive real number, the RF radius will be exactly this number. Call RadiusRF with only one argument to make that radius apply to all 3 dimensions. Examples:
|
[in] | synWtType | specifies whether the synapse should be of fixed value (SYN_FIXED) or plastic (SYN_PLASTIC) |
[in] | mulSynFast | a multiplication factor to be applied to the fast synaptic current (AMPA in the case of excitatory, and GABAa in the case of inhibitory connections). Default: 1.0 |
[in] | mulSynSlow | a multiplication factor to be applied to the slow synaptic current (NMDA in the case of excitatory, and GABAb in the case of inhibitory connections). Default: 1.0 |
Definition at line 1739 of file carlsim.cpp.
short int connectCompartments | ( | int | grpIdLower, |
int | grpIdUpper | ||
) |
first group is in the lower layer; second group is in the upper layer
Definition at line 1755 of file carlsim.cpp.
int createGroup | ( | const std::string & | grpName, |
const Grid3D & | grid, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
Neurons of a group can be arranged topographically, so that they virtually lie on a 3D grid. Connections can then be specified depending on the relative placement of neurons via CARLsim::connect. This allows for the creation of networks with complex spatial structure.
Each neuron in the group gets assigned a (x,y,z) location on a 3D grid centered around the origin, so that calling Grid3D(Nx,Ny,Nz) creates coordinates that fall in the range [-(Nx-1)/2, (Nx-1)/2], [-(Ny-1)/2, (Ny-1)/2], and [-(Nz-1)/2, (Nz-1)/2]. The resulting grid is a primitive cubic Bravais lattice with cubic side length 1 (arbitrary units). The primitive (or simple) cubic crystal system consists of one lattice point (neuron) on each corner of the cube. Each neuron at a lattice point is then shared equally between eight adjacent cubes.
[in] | grpName | the group name |
[in] | grid | a Grid3D struct specifying the dimensions of the 3D lattice |
[in] | neurType | either EXCITATORY_NEURON, INHIBITORY_NEURON or DOPAMINERGIC_NEURON |
Definition at line 1760 of file carlsim.cpp.
int createGroup | ( | const std::string & | grpName, |
int | nNeur, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
Definition at line 1763 of file carlsim.cpp.
int createGroupLIF | ( | const std::string & | grpName, |
const Grid3D & | grid, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
[in] | grpName | the group name |
[in] | grid | a Grid3D struct specifying the dimensions of the 3D lattice |
[in] | neurType | either EXCITATORY_NEURON, INHIBITORY_NEURON or DOPAMINERGIC_NEURON |
Definition at line 1768 of file carlsim.cpp.
int createGroupLIF | ( | const std::string & | grpName, |
int | nNeur, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
Definition at line 1771 of file carlsim.cpp.
int createSpikeGeneratorGroup | ( | const std::string & | grpName, |
const Grid3D & | grid, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
Neurons of a group can be arranged topographically, so that they virtually lie on a 3D grid. This simplifies the creation of topographic connections in the network. Each neuron thus gets assigned a (x,y,z) location on a 3D grid (integer coordinates). Neuron numbers will be assigned to location in order; where the first dimension specifies the width, the second dimension is height, and the third dimension is depth. Grid3D(2,2,2) would thus assign neurId 0 to location (0,0,0), neurId 1 to (1,0,0), neurId 3 to (0,1,0), neurId 6 to (2,2,1), and so on. The third dimension can be thought of as a depth (z-coordinate in 3D), a cortical column (each of which consists of a 2D arrangement of neurons on a plane), or a channel (such as RGB channels, each of which consists of a 2D arrangements of neurons coding for (x,y) coordinates of an image). For the user's convenience, the struct thus provides members Grid3D::depth, Grid3D::column, and Grid3D::channels, which differ only semantically.
Definition at line 1776 of file carlsim.cpp.
int createSpikeGeneratorGroup | ( | const std::string & | grpName, |
int | nNeur, | ||
int | neurType, | ||
int | preferredPartition = ANY , |
||
ComputingBackend | preferredBackend = CPU_CORES |
||
) |
Definition at line 1779 of file carlsim.cpp.
CARLsimState getCARLsimState | ( | ) |
Returns the current CARLsim state
A CARLsim simulation goes through the following states:
Certain methods can only be called in certain states. Check their documentation to see which method can be called in which state.
Certain methods perform state transitions. setupNetwork will change the state from CONFIG_STATE to SETUP_STATE. The first call to runNetwork will change the state from SETUP_STATE to RUN_STATE.
Definition at line 1998 of file carlsim.cpp.
std::vector< float > getConductanceAMPA | ( | int | grpId | ) |
Definition at line 2001 of file carlsim.cpp.
std::vector< float > getConductanceGABAa | ( | int | grpId | ) |
Definition at line 2007 of file carlsim.cpp.
std::vector< float > getConductanceGABAb | ( | int | grpId | ) |
Definition at line 2010 of file carlsim.cpp.
std::vector< float > getConductanceNMDA | ( | int | grpId | ) |
Definition at line 2004 of file carlsim.cpp.
RangeDelay getDelayRange | ( | short int | connId | ) |
This function returns the RangeDelay struct for a specific connection ID. The RangeDelay struct contains fields for the minimum and maximum synaptic delay in the connection.
[in] | connId | connection ID |
Definition at line 2013 of file carlsim.cpp.
uint8_t * getDelays | ( | int | gIDpre, |
int | gIDpost, | ||
int & | Npre, | ||
int & | Npost | ||
) |
Definition at line 2016 of file carlsim.cpp.
int getGroupEndNeuronId | ( | int | grpId | ) |
Definition at line 2073 of file carlsim.cpp.
Grid3D getGroupGrid3D | ( | int | grpId | ) |
This function returns the Grid3D struct of a particular neuron group. Neurons of a group can be arranged topographically, so that they virtually lie on a 3D grid. This simplifies the creation of topographic connections in the network. The dimensions of the grid can thus be retrieved by calling Grid3D.width, Grid3D.height, and Grid3D.depth. The total number of neurons is given by Grid3D.N. See createGroup and Grid3D for more information.
[in] | grpId | the group ID for which to get the Grid3D struct |
Definition at line 2021 of file carlsim.cpp.
int getGroupId | ( | std::string | grpName | ) |
Definition at line 2023 of file carlsim.cpp.
std::string getGroupName | ( | int | grpId | ) |
Definition at line 2026 of file carlsim.cpp.
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo | ( | int | grpId | ) |
This function returns the current setting for neuromodulators.
Definition at line 2082 of file carlsim.cpp.
int getGroupNumNeurons | ( | int | grpId | ) |
Definition at line 2076 of file carlsim.cpp.
int getGroupStartNeuronId | ( | int | grpId | ) |
Definition at line 2070 of file carlsim.cpp.
GroupSTDPInfo getGroupSTDPInfo | ( | int | grpId | ) |
This function returns the current STDP setting of a group.
Definition at line 2079 of file carlsim.cpp.
const FILE * getLogFpDeb | ( | ) |
Definition at line 1918 of file carlsim.cpp.
const FILE * getLogFpErr | ( | ) |
Definition at line 1917 of file carlsim.cpp.
const FILE * getLogFpInf | ( | ) |
Definition at line 1916 of file carlsim.cpp.
const FILE * getLogFpLog | ( | ) |
Definition at line 1919 of file carlsim.cpp.
int getMaxNumCompConnections | ( | ) |
A compartmentally enabled neuron group cannot have more than this number of compartmental connections. This value is controlled by MAX_NUM_COMP_CONN in carlsim_definitions.h.
Definition at line 2037 of file carlsim.cpp.
Point3D getNeuronLocation3D | ( | int | grpId, |
int | relNeurId | ||
) |
This function returns the (x,y,z) location that a neuron with ID relNeurId (relative to the group) codes for. Note that neurID is relative to the ID of the first neuron in the group; that is, the first neuron in the group has relNeurId 0, the second one has relNeurId 1, etc. In other words: relNeurId = neurId - sim.getGroupStartNeuronId();
The location is determined by the actual neuron ID (the first neuron in the group coding for the origin (0,0,0), and by the dimensions of the 3D grid the group is allocated on (integer coordinates). Neuron numbers are assigned to location in order; where the first dimension specifies the width, the second dimension is height, and the third dimension is depth.
For more information see createGroup and the Grid3D struct. See also getNeuronLocation3D(int neurId).
[in] | grpId | the group ID |
[in] | relNeurId | the neuron ID (relative to the group) for which the 3D location should be returned |
Definition at line 2032 of file carlsim.cpp.
Point3D getNeuronLocation3D | ( | int | neurId | ) |
This function returns the (x,y,z) location that a neuron with ID neurID (global) codes for. Note that neurID is global; that is, the first neuron in the group does not necessarily have ID 0.
The location is determined by the actual neuron ID (the first neuron in the group coding for the origin (0,0,0), and by the dimensions of the 3D grid the group is allocated on (integer coordinates). Neuron numbers are assigned to location in order; where the first dimension specifies the width, the second dimension is height, and the third dimension is depth.
For more information see createGroup and the Grid3D struct. See also getNeuronLocation3D(int grpId, int relNeurId).
[in] | neurId | the neuron ID for which the 3D location should be returned |
Definition at line 2029 of file carlsim.cpp.
int getNumConnections | ( | ) |
This function returns the number of connections (pairs of pre-post groups) in the network. Each pre-post pair of neuronal groups has its own connection ID, which is returned by a call to connect.
Definition at line 2035 of file carlsim.cpp.
int getNumGroups | ( | ) |
Definition at line 2043 of file carlsim.cpp.
int getNumNeurons | ( | ) |
Definition at line 2046 of file carlsim.cpp.
int getNumNeuronsGen | ( | ) |
Definition at line 2058 of file carlsim.cpp.
int getNumNeuronsGenExc | ( | ) |
Definition at line 2061 of file carlsim.cpp.
int getNumNeuronsGenInh | ( | ) |
Definition at line 2064 of file carlsim.cpp.
int getNumNeuronsReg | ( | ) |
Definition at line 2049 of file carlsim.cpp.
int getNumNeuronsRegExc | ( | ) |
Definition at line 2052 of file carlsim.cpp.
int getNumNeuronsRegInh | ( | ) |
Definition at line 2055 of file carlsim.cpp.
int getNumSynapses | ( | ) |
Definition at line 2067 of file carlsim.cpp.
int getNumSynapticConnections | ( | short int | connectionId | ) |
Definition at line 2040 of file carlsim.cpp.
int getSimTime | ( | ) |
Definition at line 2086 of file carlsim.cpp.
int getSimTimeMsec | ( | ) |
Definition at line 2090 of file carlsim.cpp.
int getSimTimeSec | ( | ) |
Definition at line 2088 of file carlsim.cpp.
SpikeMonitor * getSpikeMonitor | ( | int | grpId | ) |
A SpikeCounter keeps track of all spikes per neuron binned into a certain time period (recordDur). This function allows to query the spike array at any point in time. It will return a pointer to an int array if the group has a valid SpikeCounter, or NULL otherwise. The number of elements in the int array is the number of neurons in the group.
Before this function can be used, a SpikeCounter must be set up for the group via CARLsim::setSpikeCounter.
Usage example:
[in] | grpId | the group for which you want the spikes (cannot be ALL) |
returns pointer to previously allocated SpikeMonitor object, NULL else
This function returns a pointer to a SpikeMonitor object that has previously been created using the method setSpikeMonitor. If the group does not have a SpikeMonitor, NULL is returned.
[in] | grpId | the group ID |
Definition at line 2093 of file carlsim.cpp.
RangeWeight getWeightRange | ( | short int | connId | ) |
This function returns the RangeWeight struct for a specific connection ID. The RangeWeight struct contains fields for the minimum, initial, and maximum weight in the connection.
[in] | connId | connection ID |
Definition at line 2096 of file carlsim.cpp.
bool isConnectionPlastic | ( | short int | connId | ) |
This function returns whether the synapses in a certain connection ID are fixed (false) or plastic (true).
[in] | connId | connection ID |
Definition at line 2099 of file carlsim.cpp.
bool isExcitatoryGroup | ( | int | grpId | ) |
Definition at line 2104 of file carlsim.cpp.
bool isGroupWithHomeostasis | ( | int | grpId | ) |
This functions returns whether a group has homeostasis enabled (true) or not (false).
[in] | grpId | group ID |
Definition at line 2102 of file carlsim.cpp.
bool isInhibitoryGroup | ( | int | grpId | ) |
Definition at line 2106 of file carlsim.cpp.
bool isPoissonGroup | ( | int | grpId | ) |
Definition at line 2108 of file carlsim.cpp.
void loadSimulation | ( | FILE * | fid | ) |
Past CARLsim networks can be loaded from file by setting up the same number of groups, connections, and neurons as was used to store the network via CARLsim::saveSimulation, and then calling CARLsim::loadSimulation to overwrite all corresponding synaptic weight and delay values from file.
[in] | fid | file pointer to a save file created with CARLsim::saveSimulation |
saveSynapseInfo
set to true
. Definition at line 1941 of file carlsim.cpp.
int runNetwork | ( | int | nSec, |
int | nMsec = 0 , |
||
bool | printRunSummary = true |
||
) |
[in] | nSec | number of seconds to run the network |
[in] | nMsec | number of milliseconds to run the network |
[in] | printRunSummary | enable the printing of a summary at the end of this run |
Definition at line 1909 of file carlsim.cpp.
void saveSimulation | ( | const std::string & | fileName, |
bool | saveSynapseInfo = true |
||
) |
The network state consists of all the synaptic connections, weights, delays, and whether the connections are plastic or fixed. As an option, the user can choose whether or not to save the synaptic weight information (which could be a large amount of data) with the saveSynapseInfo argument. The value of this argument is true by default which causes the synaptic weight values to be output by default along with the rest of the network information.
[in] | fileName | string of filename of saved simulation data. |
[in] | saveSynapseInfo | boolean value that determines if the weight values are written to the data file or not. The weight values are written if the boolean value is true. |
Definition at line 1922 of file carlsim.cpp.
void scaleWeights | ( | short int | connId, |
float | scale, | ||
bool | updateWeightRange = false |
||
) |
Manually resets the spike buffers of a Spike Counter to zero (for a specific group). Buffers get reset to zero automatically after recordDur
(see CARLsim::setSpikeCounter). However, the buffer can be manually reset at any point in time (during SETUP_STATE and RUN_STATE).
At any point in time (during SETUP_STATE or RUN_STATE), all SpikeCounters can be reset via:
grpId | the group for which to reset the spike counts. Set to ALL if you want to reset all SpikeCounters. |
Multiplies the weight of every synapse in the connection with a scaling factor
This method scales the weight of every synapse in the connection specified by connId with a scaling factor. The scaling factor cannot be negative. If a scaling factor is specified that makes any weight*scale lie outside the range [minWt,maxWt] of this connection, the range will be updated accordingly if the flag updateWeightRange is set to true. If the flag is set to false, then the specified weight value will be corrected to lie on the boundary (either minWt or maxWt).
[in] | connId | the connection ID to manipulate |
[in] | scale | the scaling factor to apply to every synapse (cannot be negative) |
[in] | updateWeightRange | a flag specifying what to do when the specified weight*scale lies outside the range [minWt,maxWt]. Set to true to update the range accordingly. Set to false to adjust the weight to be either minWt or maxWt. Default: false. |
Definition at line 1944 of file carlsim.cpp.
void setCompartmentParameters | ( | int | grpId, |
float | couplingUp, | ||
float | couplingDown | ||
) |
[in] | couplingUp | Coupling constant for "up" compartmental connection |
[in] | couplingDown | Coupling constant for "down" compartmental connection |
Definition at line 1783 of file carlsim.cpp.
void setConductances | ( | bool | isSet | ) |
This function sets the time constants for the decay of AMPA, NMDA, GABA, and GABAb, and the rise times for NMDA and GABAb. These constants will be applied to all connections in the network. Set isSet to false to run your simulation in CUBA mode. Use setDefaultConductanceTimeConstants to set default values for all time constants. If you call this function without setting your own defaults, then the following defaults will be used: tdAMPA=5ms, trNMDA=0, tdNMDA=150ms, tdGABAa=6ms, trGABAb=0, tdGABAb=150ms (instantaneous rise time).
[in] | isSet | a flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false) |
Definition at line 1788 of file carlsim.cpp.
void setConductances | ( | bool | isSet, |
int | tdAMPA, | ||
int | tdNMDA, | ||
int | tdGABAa, | ||
int | tdGABAb | ||
) |
This function sets the time constants for the decay of AMPA, NMDA, GABAa, and GABAb. The decay constants will be applied to all connections in the network. Set isSet to false to run your simulation in CUBA mode. The NMDA current is voltage dependent (see Izhikevich et al., 2004). Use setConductances(true) to use default decay values. Use the other setConductances to enable non-zero rise times for NMDA and GABAb.
[in] | isSet | a flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false) |
[in] | tdAMPA | time constant for AMPA decay (ms) |
[in] | tdNMDA | time constant for NMDA decay (ms) |
[in] | tdGABAa | time constant for GABAa decay (ms) |
[in] | tdGABAb | time constant for GABAb decay (ms) |
Definition at line 1791 of file carlsim.cpp.
void setConductances | ( | bool | isSet, |
int | tdAMPA, | ||
int | trNMDA, | ||
int | tdNMDA, | ||
int | tdGABAa, | ||
int | trGABAb, | ||
int | tdGABAb | ||
) |
This function sets the time constants for the rise and decay time of AMPA, NMDA, GABAa, and GABAb. AMPA and GABAa will always have instantaneous rise time. The rise times of NMDA and GABAb can be set manually. They need to be strictly smaller than the decay time. Set isSet to false to run your simulation in CUBA mode. We do not provide non-zero rise times for AMPA and GABAa, because these rise times are typically on the order of 1 ms, which is equal to the simulation time step. The NMDA current is voltage dependent (see Izhikevich et al., 2004). Use setConductances(true) to use default decay values.
[in] | isSet | a flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false) |
[in] | tdAMPA | time constant for AMPA decay (ms) |
[in] | trNMDA | time constant for NMDA rise (ms), must be smaller than tdNMDA |
[in] | tdNMDA | time constant for NMDA decay (ms) |
[in] | tdGABAa | time constant for GABAa decay (ms) |
[in] | trGABAb | time constant for GABAb rise (ms), must be smaller than tdGABAb |
[in] | tdGABAb | time constant for GABAb decay (ms) |
Definition at line 1794 of file carlsim.cpp.
ConnectionMonitor * setConnectionMonitor | ( | int | grpIdPre, |
int | grpIdPost, | ||
const std::string & | fname | ||
) |
To retrieve connection status, a connection-monitoring callback mechanism is used. This mechanism allows the user to monitor connection status between groups. Connection monitors are registered for two groups (i.e., pre- and post- synaptic groups) and are called automatically by the simulator every second.
CARLsim supports two different recording mechanisms: Recording to a weight file (binary) and recording to a ConnectionMonitor object. The former is useful for off-line analysis of synaptic weights (e.g., using Chapter 9: MATLAB Offline Analysis Toolbox (OAT)). The latter is useful to calculate different weight metrics and statistics on-line, such as the percentage of weight values that fall in a certain weight range, or the number of weights that have been changed since the last snapshot.
A file name can be specified via variable fileName (make sure the specified directory exists). The easiest way is to set fileName to string "DEFAULT", in which case a default file name will be created in the results directory: "results/conn_{preGrpName}_{postGrpName}.dat", where preGrpName is the name assigned to the pre-synaptic group at initialization, and postGrpName is the name assigned to the post-synaptic group at initialization. If no binary file shall be created, set fileName equal to the string "NULL".
The function returns a pointer to a ConnectionMonitor object, which can be used to calculate weight changes and other connection stats. See 7.2 Connection Monitor of the User Guide for more information on how to use ConnectionMonitor.
[in] | grpIdPre | the pre-synaptic group ID |
[in] | grpIdPost | the post-synaptic group ID |
[in] | fname | file name of the binary to be created |
Definition at line 1949 of file carlsim.cpp.
void setDefaultConductanceTimeConstants | ( | int | tdAMPA, |
int | trNMDA, | ||
int | tdNMDA, | ||
int | tdGABAa, | ||
int | trGABAb, | ||
int | tdGABAb | ||
) |
[in] | tdAMPA | time constant for AMPA decay (ms) |
[in] | trNMDA | time constant for NMDA rise (ms) |
[in] | tdNMDA | time constant for NMDA decay (ms) |
[in] | tdGABAa | time constant for GABAa decay (ms) |
[in] | trGABAb | time constant for GABAb rise (ms) |
[in] | tdGABAb | time constant for GABAb decay (ms) |
Definition at line 2110 of file carlsim.cpp.
void setDefaultESTDPparams | ( | float | alphaPlus, |
float | tauPlus, | ||
float | alphaMinus, | ||
float | tauMinus, | ||
STDPType | stdpType | ||
) |
Sets default E-STDP parameters. Do not use this function, it is deprecated.
Definition at line 2132 of file carlsim.cpp.
void setDefaultHomeostasisParams | ( | float | homeoScale, |
float | avgTimeScale | ||
) |
Definition at line 2117 of file carlsim.cpp.
void setDefaultISTDPparams | ( | float | betaLTP, |
float | betaLTD, | ||
float | lambda, | ||
float | delta, | ||
STDPType | stdpType | ||
) |
Sets default I-STDP parameters. Do not use this function, it is deprecated.
Definition at line 2137 of file carlsim.cpp.
void setDefaultSaveOptions | ( | std::string | fileName, |
bool | saveSynapseInfo | ||
) |
Definition at line 2122 of file carlsim.cpp.
void setDefaultSTDPparams | ( | float | alphaPlus, |
float | tauPlus, | ||
float | alphaMinus, | ||
float | tauMinus, | ||
STDPType | stdpType | ||
) |
Sets default STDP parameters. Do not use this function, it is deprecated.
Definition at line 2127 of file carlsim.cpp.
void setDefaultSTPparams | ( | int | neurType, |
float | STP_U, | ||
float | STP_tau_u, | ||
float | STP_tau_x | ||
) |
This function sets the default values for STP parameters U tau_u, and tau_x. These values will then apply to all subsequent calls to setSTP(int, bool).
CARLsim will automatically assign the following values, which can be changed at any time during CONFIG_STATE: The default parameters for an excitatory neuron are U=0.45, tau_u=50.0, tau_f=750.0 (depressive). The default parameters for an inhibitory neuron are U=0.15, tau_u=750.0, tau_f=50.0 (facilitative).
Source: Misha Tsodyks and Si Wu (2013) Short-term synaptic plasticity. Scholarpedia, 8(10):3153., rev #136920
[in] | neurType | either EXCITATORY_NEURON or INHIBITORY_NEURON |
[in] | STP_U | default value for increment of u induced by a spike |
[in] | STP_tau_u | default value for decay constant of u |
[in] | STP_tau_x | default value for decay constant of x |
Definition at line 2142 of file carlsim.cpp.
void setESTDP | ( | int | grpId, |
bool | isSet | ||
) |
Set E-STDP parameters using default settings. Do not use this function, it is deprecated.
Definition at line 1867 of file carlsim.cpp.
[in] | grpId | the group ID of group for which these settings are applied |
[in] | isSet | the flag indicating if E-STDP is enabled |
[in] | type | the flag indicating if E-STDP is modulated by dopamine (i.e., DA-STDP) |
[in] | curve | the struct defining the exponential curve |
Definition at line 1870 of file carlsim.cpp.
void setESTDP | ( | int | grpId, |
bool | isSet, | ||
STDPType | type, | ||
TimingBasedCurve | curve | ||
) |
[in] | grpId | the group ID of group for which these settings are applied |
[in] | isSet | the flag indicating if E-STDP is enabled |
[in] | type | the flag indicating if E-STDP is modulated by dopamine (i.e., DA-STDP) |
[in] | curve | the struct defining the timing-based curve |
Definition at line 1875 of file carlsim.cpp.
void setExternalCurrent | ( | int | grpId, |
const std::vector< float > & | current | ||
) |
This method injects current, specified on a per-neuron basis, into the soma of each neuron in the group, at each timestep of the simulation. current is a float vector of current amounts (mA), one element per neuron in the group.
To input different currents into a neuron over time, the idea is to run short periods of runNetwork and subsequently calling setExternalCurrent again with updated current values.
For example: Inject 5mA for 50 ms, then 0mA for 10 sec
[in] | grpId | the group ID |
[in] | current | a float vector of current amounts (mA), one value per neuron in the group |
Definition at line 1954 of file carlsim.cpp.
void setExternalCurrent | ( | int | grpId, |
float | current | ||
) |
This methods injects a specific amount of current into the soma of every neuron in the group. current is a float value in mA. The same current is applied to every neuron in the group.
For example: inject 4.5 mA into every neuron in the group, for 500 ms
Definition at line 1959 of file carlsim.cpp.
GroupMonitor * setGroupMonitor | ( | int | grpId, |
const std::string & | fname | ||
) |
Definition at line 1962 of file carlsim.cpp.
void setHomeoBaseFiringRate | ( | int | grpId, |
float | baseFiring, | ||
float | baseFiringSD = 0.0f |
||
) |
This function allows the user to set the homeostatic target firing with or without a standard deviation. All neurons in the group will use homeostatic synaptic scaling to attain the target firing rate. You can have a standard deviation to the base firing rate or you can leave this argument blank, which will set the standard deviation to 0. It should be noted that the baseFiringSD only sets the base firing rate to a single value within that standard deviation. It does not vary the value of the base firing rate from this value or within a particular range. For more information on this implementation please see: Carlson, et al. (2013). Proc. of IJCNN 2013.
[in] | grpId | the group ID of group for which these settings are applied |
[in] | baseFiring | target firing rate of every neuron in this group |
[in] | baseFiringSD | standard deviation of target firing rate of every neuron in this group |
Definition at line 1805 of file carlsim.cpp.
void setHomeostasis | ( | int | grpId, |
bool | isSet | ||
) |
This function allows the user to set homeostasis with default values for a particular neuron group. For more information, read the setHomeostasis function description above.
Default values are: homeoScale = 0.1 avgTimeScale = 10 seconds
[in] | grpId | the group ID of group to which homeostasis is applied |
[in] | isSet | a boolean, setting it to true/false enables/disables homeostasis |
Definition at line 1802 of file carlsim.cpp.
void setHomeostasis | ( | int | grpId, |
bool | isSet, | ||
float | homeoScale, | ||
float | avgTimeScale | ||
) |
This function allows the user to set homeostasis for a particular neuron group. All the neurons in this group scale their weights in an attempt to attain a target base firing rate set with the setHomeoBaseFiringRate function. Each neuron keeps track of their own average firing rate. The time over which this average is computed should be on the scale of seconds to minutes to hours as opposed to ms if one is to claim it is biologically realistic. The homeoScale sets the scaling factor applied to the weight change of the synapse due to homeostasis. If you want to make homeostasis stronger than STDP, you increase this value. Scaling of the synaptic weights is multiplicative. For more information on this implementation please see: Carlson, et al. (2013). Proc. of IJCNN 2013.
Reasonable values to start homeostasis with are: homeoScale = 0.1-1.0 avgTimeScale = 5-10 seconds
Default values are: homeoScale = 0.1 avgTimeScale = 10 seconds
[in] | grpId | the group ID of group to which homeostasis is applied |
[in] | isSet | a boolean, setting it to true/false enables/disables homeostasis |
[in] | homeoScale | scaling factor multiplied to weight change due to homeostasis |
[in] | avgTimeScale | time in seconds over which average firing rate for neurons in this group is averaged |
Definition at line 1799 of file carlsim.cpp.
void setIntegrationMethod | ( | integrationMethod_t | method, |
int | numStepsPerMs | ||
) |
Definition at line 1809 of file carlsim.cpp.
void setISTDP | ( | int | grpId, |
bool | isSet | ||
) |
Set I-STDP parameters using default settings. Do not use this function, it is deprecated.
Definition at line 1880 of file carlsim.cpp.
[in] | grpId | the group ID of group for which these settings are applied |
[in] | isSet | the flag indicating if I-STDP is enabled |
[in] | type | the flag indicating if I-STDP is modulated by dopamine (i.e., DA-STDP) |
[in] | curve | the struct defining the exponential curve |
Definition at line 1883 of file carlsim.cpp.
void setISTDP | ( | int | grpId, |
bool | isSet, | ||
STDPType | type, | ||
PulseCurve | curve | ||
) |
[in] | grpId | the group ID of group for which these settings are applied |
[in] | isSet | the flag indicating if I-STDP is enabled |
[in] | type | the flag indicating if I-STDP is modulated by dopamine (i.e., DA-STDP) |
[in] | curve | the struct defining the pulse curve |
Definition at line 1888 of file carlsim.cpp.
void setLogFile | ( | const std::string & | fileName | ) |
This function sets a new path/name for the CARLsim log file. By default, the log file name is given depending on the LoggerMode specified in CARLsim. However, it can be manually overridden using this function. In order to disable the log file, pass string "NULL".
fileName | the name of the log file |
Definition at line 1927 of file carlsim.cpp.
void setLogsFpCustom | ( | FILE * | fpInf = NULL , |
FILE * | fpErr = NULL , |
||
FILE * | fpDeb = NULL , |
||
FILE * | fpLog = NULL |
||
) |
In LoggerMode CUSTOM, custom file pointers can be used for the info, error, and debug log streams. In this case, CARLsim does not take ownership of the file pointers; that is, the user should fclose them. Setting a file pointer to NULL will not change the currently assigned file pointer (default value points to the bit bucket).
[in] | fpInf | file pointer for status info |
[in] | fpErr | file pointer for errors/warnings |
[in] | fpDeb | file pointer for debug info |
[in] | fpLog | file pointer for debug log file that contains all the above info |
Definition at line 1930 of file carlsim.cpp.
void setNeuromodulator | ( | int | grpId, |
float | baseDP, | ||
float | tauDP, | ||
float | base5HT, | ||
float | tau5HT, | ||
float | baseACh, | ||
float | tauACh, | ||
float | baseNE, | ||
float | tauNE | ||
) |
[in] | grpId | the symbolic name of a group |
[in] | baseDP | the baseline concentration of Dopamine |
[in] | tauDP | the decay time constant of Dopamine |
[in] | base5HT | the baseline concentration of Serotonin |
[in] | tau5HT | the decay time constant of Serotonin |
[in] | baseACh | the baseline concentration of Acetylcholine |
[in] | tauACh | the decay time constant of Acetylcholine |
[in] | baseNE | the baseline concentration of Noradrenaline |
[in] | tauNE | the decay time constant of Noradrenaline |
Definition at line 1845 of file carlsim.cpp.
void setNeuromodulator | ( | int | grpId, |
float | tauDP = 100.0f , |
||
float | tau5HT = 100.0f , |
||
float | tauACh = 100.0f , |
||
float | tauNE = 100.0f |
||
) |
Definition at line 1852 of file carlsim.cpp.
NeuronMonitor * setNeuronMonitor | ( | int | grpId, |
const std::string & | fileName | ||
) |
To retrieve outputs, a neuron-monitoring callback mechanism is used. This mechanism allows the user to calculate basic statistics, store voltage/recovery/current values, or perform more complicated output monitoring. Neuron monitors are registered for a group and are called automatically by the simulator every second. Similar to an address event representation (AER), the neuron monitor indicates neuron's state by using the neuron ID within a group (0-indexed). Only one neuron monitor is allowed per group.
CARLsim supports two different recording mechanisms: Recording to a neuron state (voltage, recovery, and current) file (binary) and recording to a NeuronMonitor object. The former is useful for off-line analysis of activity (e.g., using Chapter 9: MATLAB Offline Analysis Toolbox (OAT)). The latter is useful to calculate different neuron state metrics and statistics on-line.
A file name can be specified via variable fileName (make sure the specified directory exists). The easiest way is to set fileName to string "DEFAULT", in which case a default file name will be created in the results directory: "results/nrnstate_{group name}.dat", where group name is the name assigned to the group at initialization (can be retrieved via getGroupName). If no binary file shall be created, set fileName equal to the string "NULL".
The function returns a pointer to a NeuronMonitor object, which can be used to calculate neuron statistics or retrieve all neuron state values from a particular time window. See ??? of the User Guide for more information on how to use NeuronMonitor.
If you call setNeuronMonitor twice on the same group, the same NeuronMonitor pointer will be returned, and the name of the neuron state file will be updated. This is the same as calling NeuronMonitor::setLogFile directly, and allows you to redirect the spike file stream mid-simulation (see 7.1.3 Redirecting File Streams).
[in] | grpId | the group ID |
[in] | fileName | name of the binary file to be created. Leave empty for default name "results/nrnstate_{grpName}.dat". Set to string "NULL" to suppress file creation. Default: "" |
Definition at line 1977 of file carlsim.cpp.
void setNeuronParameters | ( | int | grpId, |
float | izh_a, | ||
float | izh_a_sd, | ||
float | izh_b, | ||
float | izh_b_sd, | ||
float | izh_c, | ||
float | izh_c_sd, | ||
float | izh_d, | ||
float | izh_d_sd | ||
) |
Definition at line 1815 of file carlsim.cpp.
void setNeuronParameters | ( | int | grpId, |
float | izh_a, | ||
float | izh_b, | ||
float | izh_c, | ||
float | izh_d | ||
) |
Definition at line 1820 of file carlsim.cpp.
void setNeuronParameters | ( | int | grpId, |
float | izh_C, | ||
float | izh_C_sd, | ||
float | izh_k, | ||
float | izh_k_sd, | ||
float | izh_vr, | ||
float | izh_vr_sd, | ||
float | izh_vt, | ||
float | izh_vt_sd, | ||
float | izh_a, | ||
float | izh_a_sd, | ||
float | izh_b, | ||
float | izh_b_sd, | ||
float | izh_vpeak, | ||
float | izh_vpeak_sd, | ||
float | izh_c, | ||
float | izh_c_sd, | ||
float | izh_d, | ||
float | izh_d_sd | ||
) |
[in] | grpId | the group ID of a group for which these settings are applied |
[in] | izh_C | Membrane capacitance parameter |
[in] | izh_C_sd | Standard deviation for membrane capacitance parameter |
[in] | izh_k | Coefficient present in equation for voltage |
[in] | izh_k_sd | Standard deviation for coefficient present in equation for voltage |
[in] | izh_vr | Resting membrane potential parameter |
[in] | izh_vr_sd | Standard deviation for resting membrane potential parameter |
[in] | izh_vt | Instantaneous threshold potential parameter |
[in] | izh_vt_sd | Standard deviation for instantaneous threshold potential parameter |
[in] | izh_a | Recovery time constant |
[in] | izh_a_sd | Standard deviation for recovery time constant |
[in] | izh_b | Coefficient present in equation for voltage |
[in] | izh_b_sd | Standard deviation for coefficient present in equation for voltage |
[in] | izh_vpeak | The spike cutoff value parameter |
[in] | izh_vpeak_sd | Standard deviation for the spike cutoff value parameter |
[in] | izh_c | The voltage reset value parameter |
[in] | izh_c_sd | Standard deviation for the voltage reset value parameter |
[in] | izh_d | Parameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior |
[in] | izh_d_sd | Standard deviation for the parameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior |
Definition at line 1830 of file carlsim.cpp.
void setNeuronParameters | ( | int | grpId, |
float | izh_C, | ||
float | izh_k, | ||
float | izh_vr, | ||
float | izh_vt, | ||
float | izh_a, | ||
float | izh_b, | ||
float | izh_vpeak, | ||
float | izh_c, | ||
float | izh_d | ||
) |
[in] | grpId | the group ID of a group for which these settings are applied |
[in] | izh_C | Membrane capacitance parameter |
[in] | izh_k | Coefficient present in equation for voltage |
[in] | izh_vr | Resting membrane potential parameter |
[in] | izh_vt | Instantaneous threshold potential parameter |
[in] | izh_a | Recovery time constant |
[in] | izh_b | Coefficient present in equation for voltage |
[in] | izh_vpeak | The spike cutoff value parameter |
[in] | izh_c | The voltage reset value parameter |
[in] | izh_d | Parameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior |
Definition at line 1824 of file carlsim.cpp.
void setNeuronParametersLIF | ( | int | grpId, |
int | tau_m, | ||
int | tau_ref = 0 , |
||
float | vTh = 1.0f , |
||
float | vReset = 0.0f , |
||
const RangeRmem & | rMem = RangeRmem(1.0f) |
||
) |
[in] | grpId | group ID |
[in] | tau_m | Membrane time constant in ms (controls decay/leak) |
[in] | tau_ref | absolute refractory period in ms |
[in] | vTh | Threshold voltage for firing (must be > vReset) |
[in] | vReset | Membrane potential resets to this value immediately after spike |
[in] | rMem | Range of total membrane resistance of the neuron group, uniformly distributed or fixed for the whole group |
Definition at line 1840 of file carlsim.cpp.
void setSpikeGenerator | ( | int | grpId, |
SpikeGenerator * | spikeGenFunc | ||
) |
A SpikeCounter keeps track of all spikes per neuron for a certain time period (recordDur). After that, the spike buffers get reset to zero number of spikes.
This function works for Izhikevich neurons as well as Spike Generators.
The recording time can be set to any x number of ms, so that after x ms the spike counts will be reset to zero. If x==-1, then the spike counts will never be reset (should only overflow after 97 days of sim). Also, spike counts can be manually reset at any time by calling CARLsim::resetSpikeCounter(grpId);
At any point in time (during RUN_STATE), CARLsim::getSpikeCounter can be called to get an integer array that contains the number of spikes for each neuron in the group.
There can be only SpikeCounter per group. However, a group can have both a SpikeMonitor and a SpikeCounter.
[in] | grpId | the group for which you want to enable a SpikeCounter |
[in] | recordDur | number of ms for which to record spike numbers. Spike numbers will be reset to zero after this. Set frameDur to -1 to never reset spike counts. Default: -1. |
Associates a SpikeGenerator object with a group
A custom SpikeGenerator object can be used to allow for more fine-grained control overs spike generation by specifying individual spike times for each neuron in a group.
In order to specify spike times, a new class must be defined first that derives from the SpikeGenerator class and implements the virtual method SpikeGenerator::nextSpikeTime. Then, in order for a custom SpikeGenerator to be associated with a SpikeGenerator group, CARLsim::setSpikeGenerator must be called on the group in CONFIG_STATE:.
A number of interesting Spike Generators is provided in the tools/spike_generators
directory, such as PeriodicSpikeGenerator, SpikeGeneratorFromVector, and SpikeGeneratorFromFile.
[in] | grpId | the group with which to associate a SpikeGenerator object |
[in] | spikeGenFunc | pointer to a custom SpikeGenerator object |
Definition at line 1967 of file carlsim.cpp.
SpikeMonitor * setSpikeMonitor | ( | int | grpId, |
const std::string & | fileName | ||
) |
To retrieve outputs, a spike-monitoring callback mechanism is used. This mechanism allows the user to calculate basic statistics, store spike trains, or perform more complicated output monitoring. Spike monitors are registered for a group and are called automatically by the simulator every second. Similar to an address event representation (AER), the spike monitor indicates which neurons spiked by using the neuron ID within a group (0-indexed) and the time of the spike. Only one spike monitor is allowed per group.
CARLsim supports two different recording mechanisms: Recording to a spike file (binary) and recording to a SpikeMonitor object. The former is useful for off-line analysis of activity (e.g., using Chapter 9: MATLAB Offline Analysis Toolbox (OAT)). The latter is useful to calculate different spike metrics and statistics on-line, such as mean firing rate and standard deviation, or the number of neurons whose firing rate lies in a certain interval.
A file name can be specified via variable fileName (make sure the specified directory exists). The easiest way is to set fileName to string "DEFAULT", in which case a default file name will be created in the results directory: "results/spk_{group name}.dat", where group name is the name assigned to the group at initialization (can be retrieved via getGroupName). If no binary file shall be created, set fileName equal to the string "NULL".
The function returns a pointer to a SpikeMonitor object, which can be used to calculate spike statistics (such group firing rate, number of silent neurons, etc.) or retrieve all spikes from a particular time window. See 7.1 Spike Monitor of the User Guide for more information on how to use SpikeMonitor.
If you call setSpikeMonitor twice on the same group, the same SpikeMonitor pointer will be returned, and the name of the spike file will be updated. This is the same as calling SpikeMonitor::setLogFile directly, and allows you to redirect the spike file stream mid-simulation (see 7.1.3 Redirecting File Streams).
[in] | grpId | the group ID |
[in] | fileName | name of the binary file to be created. Leave empty for default name "results/spk_{grpName}.dat". Set to string "NULL" to suppress file creation. Default: "" |
Definition at line 1972 of file carlsim.cpp.
void setSpikeRate | ( | int | grpId, |
PoissonRate * | spikeRate, | ||
int | refPeriod = 1 |
||
) |
[in] | grpId | group ID |
[in] | spikeRate | pointer to PoissonRate object |
[in] | refPeriod | refactory period (ms). Default: 1ms. |
Definition at line 1982 of file carlsim.cpp.
void setSTDP | ( | int | grpId, |
bool | isSet | ||
) |
Set STDP parameters. Do not use this function, it is deprecated.
Definition at line 1857 of file carlsim.cpp.
void setSTDP | ( | int | grpId, |
bool | isSet, | ||
STDPType | type, | ||
float | alphaPlus, | ||
float | tauPlus, | ||
float | alphaMinus, | ||
float | tauMinus | ||
) |
Set STDP parameters. Do not use this function, it is deprecated.
Definition at line 1860 of file carlsim.cpp.
void setSTP | ( | int | grpId, |
bool | isSet | ||
) |
This function enables/disables STP on a specific pre-synaptic group and assign default values to all STP parameters. The default parameters for an excitatory neuron are U=0.45, tau_u=50.0, tau_f=750.0 (depressive). The default parameters for an inhibitory neuron are U=0.15, tau_u=750.0, tau_f=50.0 (facilitative).
Source: Misha Tsodyks and Si Wu (2013) Short-term synaptic plasticity. Scholarpedia, 8(10):3153., rev #136920
These default values can be overridden using setDefaultSTPparams.
[in] | grpId | pre-synaptic group ID |
[in] | isSet | a flag whether to enable/disable STP |
Definition at line 1898 of file carlsim.cpp.
void setSTP | ( | int | grpId, |
bool | isSet, | ||
float | STP_U, | ||
float | STP_tau_u, | ||
float | STP_tau_x | ||
) |
CARLsim implements the short-term plasticity model of (Tsodyks & Markram, 1998; Mongillo, Barak, & Tsodyks, 2008)
where u- means value of variable u right before spike update, and x+ means value of variable x right after the spike update, and A is the synaptic weight. The STD effect is modeled by a normalized variable (0<=x<=1), denoting the fraction of resources that remain available after neurotransmitter depletion. The STF effect is modeled by a utilization parameter u, representing the fraction of available resources ready for use (release probability). Following a spike, (i) u increases due to spike-induced calcium influx to the presynaptic terminal, after which (ii) a fraction u of available resources is consumed to produce the post-synaptic current. Between spikes, u decays back to zero with time constant STP_tau_u (tau_F), and x recovers to value one with time constant STP_tau_x (tau_D).
Source: Misha Tsodyks and Si Wu (2013) Short-term synaptic plasticity. Scholarpedia, 8(10):3153., rev #136920
[in] | grpId | pre-synaptic group ID |
[in] | isSet | a flag whether to enable/disable STP |
[in] | STP_U | increment of u induced by a spike |
[in] | STP_tau_u | decay constant of u (tau_F) |
[in] | STP_tau_x | decay constant of x (tau_D) |
Definition at line 1893 of file carlsim.cpp.
void setupNetwork | ( | ) |
Definition at line 1914 of file carlsim.cpp.
void setWeight | ( | short int | connId, |
int | neurIdPre, | ||
int | neurIdPost, | ||
float | weight, | ||
bool | updateWeightRange = false |
||
) |
This method sets the weight value of the synapse that belongs to connection connId and connects pre-synaptic neuron neurIdPre to post-synaptic neuron neurIdPost. Neuron IDs should be zero-indexed, so that the first neuron in the group has ID 0.
If a weight value is specified that lies outside the range [minWt,maxWt] of this connection, the range will be updated accordingly if the flag updateWeightRange is set to true. If the flag is set to false, then the specified weight value will be corrected to lie on the boundary (either minWt or maxWt).
[in] | connId | the connection ID to manipulate |
[in] | neurIdPre | pre-synaptic neuron ID (zero-indexed) |
[in] | neurIdPost | post-synaptic neuron ID (zero-indexed) |
[in] | weight | the weight value to set for this synapse |
[in] | updateWeightRange | a flag specifying what to do when the specified weight lies outside the range [minWt,maxWt]. Set to true to update the range accordingly. Set to false to adjust the weight to be either minWt or maxWt. Default: false. |
Definition at line 1987 of file carlsim.cpp.
void setWeightAndWeightChangeUpdate | ( | UpdateInterval | wtANDwtChangeUpdateInterval, |
bool | enableWtChangeDecay, | ||
float | wtChangeDecay = 0.9f |
||
) |
[in] | wtANDwtChangeUpdateInterval | the interval between two wt (weight) and wtChange (weight change) update. |
[in] | enableWtChangeDecay | enable weight change decay |
[in] | wtChangeDecay | the decay ratio of weight change (wtChange) |
Definition at line 1901 of file carlsim.cpp.
void startTesting | ( | bool | updateWeights = true | ) |
This function can be used to temporarily disable all weight updates (such as from STDP or homeostasis) in the network. This can be useful in an experimental setting that consists of 1) a training phase, where STDP or other plasticity mechanisms learn some input stimulus set, and 2) a testing phase, where the learned synaptic weights are evaluated (without making any further weight modifications) by presenting some test stimuli.
An optional parameter specifies whether the accumulated weight updates so far should be applied to the weights before entering the testing phase. Recall that although weight changes are accumulated every millisecond, they are only applied to the weights every so often (see CARLsim::setWeightAndWeightChangeUpdate). If updateWeights is set to true, then the accumulated weight changes will be applied to the weights, even if CARLsim::startTesting is called off the weight update grid.
[in] | updateWeights | whether to apply the accumulated weight changes before entering the testing phase |
Definition at line 1992 of file carlsim.cpp.
void stopTesting | ( | ) |
This function can be used to exit a testing phase (in which all weight changes were disabled), after which weight modifications are possible again. This can be useful in an experimental setting with multiple training phases followed by testing phases.
Definition at line 1995 of file carlsim.cpp.