CARLsim  5.0.0
CARLsim: a GPU-accelerated SNN simulator
CARLsim Class Reference

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...
 
SpikeMonitorgetSpikeMonitor (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...
 
ConnectionMonitorsetConnectionMonitor (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 > &current)
 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...
 
GroupMonitorsetGroupMonitor (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...
 
NeuronMonitorsetNeuronMonitor (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...
 
SpikeMonitorsetSpikeMonitor (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...
 

Detailed Description

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.

Definition at line 138 of file carlsim.h.

Constructor & Destructor Documentation

◆ CARLsim()

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.

Parameters
[in]netNamenetwork name
[in]preferredSimModeCPU_MODE, GPU_MODE, or HYBRID_MODE
[in]loggerModeUSER, DEVELOPER, SILENT, or CUSTOM
[in]ithGPUson which GPU to establish a context (deprecated parameter)
[in]randSeedrandom number generator seed
See also
setLogFile
setLogsFpCustom

Definition at line 1735 of file carlsim.cpp.

◆ ~CARLsim()

~CARLsim ( )

Definition at line 1737 of file carlsim.cpp.

Member Function Documentation

◆ biasWeights()

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).

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdthe connection ID to manipulate
[in]biasthe bias value to add to every synapse
[in]updateWeightRangea 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.
Note
A weight cannot drop below zero, no matter what.
See also
setWeight
scaleWeights
Since
v3.0

Definition at line 1937 of file carlsim.cpp.

◆ connect() [1/3]

short int connect ( int  grpId1,
int  grpId2,
ConnectionGenerator conn,
bool  synWtType = SYN_FIXED 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE
See also
ch4s3_user_defined

Definition at line 1747 of file carlsim.cpp.

◆ connect() [2/3]

short int connect ( int  grpId1,
int  grpId2,
ConnectionGenerator conn,
float  mulSynFast,
float  mulSynSlow,
bool  synWtType = SYN_FIXED 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE
See also
ch4s3_user_defined

Definition at line 1750 of file carlsim.cpp.

◆ connect() [3/3]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpId1ID of the pre-synaptic group
[in]grpId2ID of the post-synaptic group
[in]connTypeconnection 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]wta 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]connProbconnection probability
[in]delayA 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]radRFA 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:
  • Create a 2D Gaussian RF of radius 10 in z-plane: RadiusRF(10, 10, 0) Neuron pre will be connected to neuron post iff (pre.x-post.x)^2+(pre.y-post.y)^2<=100 and pre.z==post.z.
  • Create a 2D heterogeneous Gaussian RF (an ellipse) with semi-axes 10 and 5: RadiusRF(10, 5, 0) Neuron pre will be connected to neuron post iff (pre.x-post.x)/100 + (pre.y-post.y)^2/25 <= 1 and pre.z==post.z.
  • Connect all, no matter the RF (default): RadiusRF(-1, -1, -1)
  • Connect one-to-one: RadiusRF(0, 0, 0) Neuron pre will be connected to neuron post iff pre.x==post.x, pre.y==post.y, pre.z==post.z. Note: Use CARLsim::connect with type "one-to-one" instead.
[in]synWtTypespecifies whether the synapse should be of fixed value (SYN_FIXED) or plastic (SYN_PLASTIC)
[in]mulSynFasta 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]mulSynSlowa 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
Returns
a unique ID associated with the newly created connection
See also
ch4s1_primitive_types

Definition at line 1740 of file carlsim.cpp.

◆ connectCompartments()

short int connectCompartments ( int  grpIdLower,
int  grpIdUpper 
)

first group is in the lower layer; second group is in the upper layer

TODO:
finish docu
Allowed CARLsim states:\n CONFIG

Definition at line 1756 of file carlsim.cpp.

◆ createGroup() [1/2]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpNamethe group name
[in]grida Grid3D struct specifying the dimensions of the 3D lattice
[in]neurTypeeither EXCITATORY_NEURON, INHIBITORY_NEURON or DOPAMINERGIC_NEURON
Since
v3.0

Definition at line 1761 of file carlsim.cpp.

◆ createGroup() [2/2]

int createGroup ( const std::string &  grpName,
int  nNeur,
int  neurType,
int  preferredPartition = ANY,
ComputingBackend  preferredBackend = CPU_CORES 
)
TODO:
finish doc
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1764 of file carlsim.cpp.

◆ createGroupLIF() [1/2]

int createGroupLIF ( const std::string &  grpName,
const Grid3D grid,
int  neurType,
int  preferredPartition = ANY,
ComputingBackend  preferredBackend = CPU_CORES 
)
Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpNamethe group name
[in]grida Grid3D struct specifying the dimensions of the 3D lattice
[in]neurTypeeither EXCITATORY_NEURON, INHIBITORY_NEURON or DOPAMINERGIC_NEURON
Since
v4.0

Definition at line 1769 of file carlsim.cpp.

◆ createGroupLIF() [2/2]

int createGroupLIF ( const std::string &  grpName,
int  nNeur,
int  neurType,
int  preferredPartition = ANY,
ComputingBackend  preferredBackend = CPU_CORES 
)
TODO:
finish doc
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1772 of file carlsim.cpp.

◆ createSpikeGeneratorGroup() [1/2]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
TODO:
finish doc

Definition at line 1777 of file carlsim.cpp.

◆ createSpikeGeneratorGroup() [2/2]

int createSpikeGeneratorGroup ( const std::string &  grpName,
int  nNeur,
int  neurType,
int  preferredPartition = ANY,
ComputingBackend  preferredBackend = CPU_CORES 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1780 of file carlsim.cpp.

◆ getCARLsimState()

CARLsimState getCARLsimState ( )
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Returns the current CARLsim state

A CARLsim simulation goes through the following states:

  • CONFIG_STATE configuration state, where the neural network is configured
  • SETUP_STATE setup state, where the neural network is prepared for execution
  • RUN_STATE execution state, where the simulation is executed

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.

Returns
current CARLsim state

Definition at line 1999 of file carlsim.cpp.

◆ getConductanceAMPA()

std::vector< float > getConductanceAMPA ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::RUN_STATE
Deprecated:
This function is deprecated. It will be replaced by NeuronMonitor.

Definition at line 2002 of file carlsim.cpp.

◆ getConductanceGABAa()

std::vector< float > getConductanceGABAa ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::RUN_STATE
Deprecated:
This function is deprecated. It will be replaced by NeuronMonitor.

Definition at line 2008 of file carlsim.cpp.

◆ getConductanceGABAb()

std::vector< float > getConductanceGABAb ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::RUN_STATE
Deprecated:
This function is deprecated. It will be replaced by NeuronMonitor.

Definition at line 2011 of file carlsim.cpp.

◆ getConductanceNMDA()

std::vector< float > getConductanceNMDA ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::RUN_STATE
Deprecated:
This function is deprecated. It will be replaced by NeuronMonitor.

Definition at line 2005 of file carlsim.cpp.

◆ getDelayRange()

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.

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdconnection ID
Returns
RangeDelay struct
Since
v3.0

Definition at line 2014 of file carlsim.cpp.

◆ getDelays()

uint8_t * getDelays ( int  gIDpre,
int  gIDpost,
int &  Npre,
int &  Npost 
)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2017 of file carlsim.cpp.

◆ getGroupEndNeuronId()

int getGroupEndNeuronId ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2074 of file carlsim.cpp.

◆ getGroupGrid3D()

Grid3D getGroupGrid3D ( int  grpId)
TODO:
: This function is called in SNN::connect() at CONFIG_STATE, which violate the restriction

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.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]grpIdthe group ID for which to get the Grid3D struct
Returns
the 3D grid struct of a group

Definition at line 2022 of file carlsim.cpp.

◆ getGroupId()

int getGroupId ( std::string  grpName)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2024 of file carlsim.cpp.

◆ getGroupName()

std::string getGroupName ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2027 of file carlsim.cpp.

◆ getGroupNeuromodulatorInfo()

GroupNeuromodulatorInfo getGroupNeuromodulatorInfo ( int  grpId)

This function returns the current setting for neuromodulators.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
See also
GroupNeuromodulatorInfo

Definition at line 2083 of file carlsim.cpp.

◆ getGroupNumNeurons()

int getGroupNumNeurons ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2077 of file carlsim.cpp.

◆ getGroupStartNeuronId()

int getGroupStartNeuronId ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2071 of file carlsim.cpp.

◆ getGroupSTDPInfo()

GroupSTDPInfo getGroupSTDPInfo ( int  grpId)

This function returns the current STDP setting of a group.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
See also
GroupSTDPInfo

Definition at line 2080 of file carlsim.cpp.

◆ getLogFpDeb()

const FILE * getLogFpDeb ( )

Definition at line 1919 of file carlsim.cpp.

◆ getLogFpErr()

const FILE * getLogFpErr ( )

Definition at line 1918 of file carlsim.cpp.

◆ getLogFpInf()

const FILE * getLogFpInf ( )

Definition at line 1917 of file carlsim.cpp.

◆ getLogFpLog()

const FILE * getLogFpLog ( )

Definition at line 1920 of file carlsim.cpp.

◆ getMaxNumCompConnections()

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 2038 of file carlsim.cpp.

◆ getNeuronLocation3D() [1/2]

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).

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::EXE_STATE
Parameters
[in]grpIdthe group ID
[in]relNeurIdthe neuron ID (relative to the group) for which the 3D location should be returned
Returns
the 3D location a neuron codes for as a Point3D struct

Definition at line 2033 of file carlsim.cpp.

◆ getNeuronLocation3D() [2/2]

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).

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::EXE_STATE
Parameters
[in]neurIdthe neuron ID for which the 3D location should be returned
Returns
the 3D location a neuron codes for as a Point3D struct

Definition at line 2030 of file carlsim.cpp.

◆ getNumConnections()

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.

Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Returns
the number of connections (pairs of pre-post groups) in the network

Definition at line 2036 of file carlsim.cpp.

◆ getNumGroups()

int getNumGroups ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2044 of file carlsim.cpp.

◆ getNumNeurons()

int getNumNeurons ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2047 of file carlsim.cpp.

◆ getNumNeuronsGen()

int getNumNeuronsGen ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2059 of file carlsim.cpp.

◆ getNumNeuronsGenExc()

int getNumNeuronsGenExc ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2062 of file carlsim.cpp.

◆ getNumNeuronsGenInh()

int getNumNeuronsGenInh ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2065 of file carlsim.cpp.

◆ getNumNeuronsReg()

int getNumNeuronsReg ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2050 of file carlsim.cpp.

◆ getNumNeuronsRegExc()

int getNumNeuronsRegExc ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2053 of file carlsim.cpp.

◆ getNumNeuronsRegInh()

int getNumNeuronsRegInh ( )
Note
This number might change throughout CARLsim state CONFIG_STATE, up to calling setupNetwork).
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2056 of file carlsim.cpp.

◆ getNumSynapses()

int getNumSynapses ( )
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE

Definition at line 2068 of file carlsim.cpp.

◆ getNumSynapticConnections()

int getNumSynapticConnections ( short int  connectionId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2041 of file carlsim.cpp.

◆ getSimTime()

int getSimTime ( )
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2087 of file carlsim.cpp.

◆ getSimTimeMsec()

int getSimTimeMsec ( )
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2091 of file carlsim.cpp.

◆ getSimTimeSec()

int getSimTimeSec ( )
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2089 of file carlsim.cpp.

◆ getSpikeMonitor()

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:

// During CONFIG state, create a neuron group with 10 neurons.
int g0 = sim.createGroup("group0", 10, EXCITATORY_NEURON);
// Set up a SpikeCounter on group g0 that counts the number
// of spikes in bins of 50 ms
sim.setSpikeCounter(g0, 50);
// move to setup state
// run the network for a bit, say 32 ms
sim.runNetwork(0,32);
// get the number of spikes in these 32 ms
int* spkArr = sim.getSpikeCounter(g0);
// print number of spikes for each neuron in the group
for (int i=0; i<10; i++)
printf("Neuron %d has %d spikes\n",i,spkArr[i]);
Allowed CARLsim states:\n ::RUN_STATE
Parameters
[in]grpIdthe group for which you want the spikes (cannot be ALL)
Returns
pointer to array of ints if SpikeCounter exists, else NULL. Number of elements in array is the number of neurons in group. Each entry is the number of spikes for this neuron (int) since the last reset.
See also
CARLsim::setSpikeCounter
CARLsim::resetSpikeCounter

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.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]grpIdthe group ID
Returns
pointer to SpikeMonitor object if exists, NULL else
Since
v3.0

Definition at line 2094 of file carlsim.cpp.

◆ getWeightRange()

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.

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdconnection ID
Returns
RangeWeight struct
Since
v3.0

Definition at line 2097 of file carlsim.cpp.

◆ isConnectionPlastic()

bool isConnectionPlastic ( short int  connId)

This function returns whether the synapses in a certain connection ID are fixed (false) or plastic (true).

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdconnection ID
Since
v3.1

Definition at line 2100 of file carlsim.cpp.

◆ isExcitatoryGroup()

bool isExcitatoryGroup ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2105 of file carlsim.cpp.

◆ isGroupWithHomeostasis()

bool isGroupWithHomeostasis ( int  grpId)

This functions returns whether a group has homeostasis enabled (true) or not (false).

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
[in]grpIdgroup ID
Since
v3.1

Definition at line 2103 of file carlsim.cpp.

◆ isInhibitoryGroup()

bool isInhibitoryGroup ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2107 of file carlsim.cpp.

◆ isPoissonGroup()

bool isPoissonGroup ( int  grpId)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE

Definition at line 2109 of file carlsim.cpp.

◆ loadSimulation()

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]fidfile pointer to a save file created with CARLsim::saveSimulation
Note
In order for CARLsim::loadSimulation to work, the configured network must have the identical number of groups, connections, and neurons as the one stored with CARLsim::saveSimulation.
In addition, CARLsim::saveSimulation must have been called with flag saveSynapseInfo set to true.
Attention
Wait with calling fclose on the file pointer until SETUP_STATE!
See also
CARLsim::saveSimulation
Since
v2.0

Definition at line 1942 of file carlsim.cpp.

◆ runNetwork()

int runNetwork ( int  nSec,
int  nMsec = 0,
bool  printRunSummary = true 
)
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE. First call to runNetwork will make CARLsim state switch from ::SETUP_STATE to ::RUN_STATE.
Parameters
[in]nSecnumber of seconds to run the network
[in]nMsecnumber of milliseconds to run the network
[in]printRunSummaryenable the printing of a summary at the end of this run

Definition at line 1910 of file carlsim.cpp.

◆ saveSimulation()

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.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]fileNamestring of filename of saved simulation data.
[in]saveSynapseInfoboolean 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.
See also
CARLsim::loadSimulation
Since
v2.0

Definition at line 1923 of file carlsim.cpp.

◆ scaleWeights()

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:

sim.resetSpikeCounters(-1); // reset for all groups, -1==ALL
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
grpIdthe group for which to reset the spike counts. Set to ALL if you want to reset all SpikeCounters.
See also
CARLsim::setSpikeCounter
CARLsim::getSpikeCounter

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).

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdthe connection ID to manipulate
[in]scalethe scaling factor to apply to every synapse (cannot be negative)
[in]updateWeightRangea 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.
Note
A weight cannot drop below zero, no matter what.
See also
setWeight
biasWeights
Since
v3.0

Definition at line 1945 of file carlsim.cpp.

◆ setCompartmentParameters()

void setCompartmentParameters ( int  grpId,
float  couplingUp,
float  couplingDown 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]couplingUpCoupling constant for "up" compartmental connection
[in]couplingDownCoupling constant for "down" compartmental connection

Definition at line 1784 of file carlsim.cpp.

◆ setConductances() [1/3]

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).

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]isSeta flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false)

Definition at line 1789 of file carlsim.cpp.

◆ setConductances() [2/3]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]isSeta flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false)
[in]tdAMPAtime constant for AMPA decay (ms)
[in]tdNMDAtime constant for NMDA decay (ms)
[in]tdGABAatime constant for GABAa decay (ms)
[in]tdGABAbtime constant for GABAb decay (ms)

Definition at line 1792 of file carlsim.cpp.

◆ setConductances() [3/3]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]isSeta flag to inform whether to run simulation in COBA mode (true) or CUBA mode (false)
[in]tdAMPAtime constant for AMPA decay (ms)
[in]trNMDAtime constant for NMDA rise (ms), must be smaller than tdNMDA
[in]tdNMDAtime constant for NMDA decay (ms)
[in]tdGABAatime constant for GABAa decay (ms)
[in]trGABAbtime constant for GABAb rise (ms), must be smaller than tdGABAb
[in]tdGABAbtime constant for GABAb decay (ms)

Definition at line 1795 of file carlsim.cpp.

◆ setConnectionMonitor()

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.

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE
Parameters
[in]grpIdPrethe pre-synaptic group ID
[in]grpIdPostthe post-synaptic group ID
[in]fnamefile name of the binary to be created
See also
ch7s2_connection_monitor
ch9s1_matlab_oat

Definition at line 1950 of file carlsim.cpp.

◆ setDefaultConductanceTimeConstants()

void setDefaultConductanceTimeConstants ( int  tdAMPA,
int  trNMDA,
int  tdNMDA,
int  tdGABAa,
int  trGABAb,
int  tdGABAb 
)
Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]tdAMPAtime constant for AMPA decay (ms)
[in]trNMDAtime constant for NMDA rise (ms)
[in]tdNMDAtime constant for NMDA decay (ms)
[in]tdGABAatime constant for GABAa decay (ms)
[in]trGABAbtime constant for GABAb rise (ms)
[in]tdGABAbtime constant for GABAb decay (ms)

Definition at line 2111 of file carlsim.cpp.

◆ setDefaultESTDPparams()

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Deprecated:
For clearness, setting STDP parameters using setESTDP and setISTDP is strongly recommended.

Definition at line 2133 of file carlsim.cpp.

◆ setDefaultHomeostasisParams()

void setDefaultHomeostasisParams ( float  homeoScale,
float  avgTimeScale 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 2118 of file carlsim.cpp.

◆ setDefaultISTDPparams()

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Deprecated:
For clearness, setting STDP parameters using setESTDP and setISTDP is strongly recommended.

Definition at line 2138 of file carlsim.cpp.

◆ setDefaultSaveOptions()

void setDefaultSaveOptions ( std::string  fileName,
bool  saveSynapseInfo 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 2123 of file carlsim.cpp.

◆ setDefaultSTDPparams()

void setDefaultSTDPparams ( float  alphaPlus,
float  tauPlus,
float  alphaMinus,
float  tauMinus,
STDPType  stdpType 
)

Sets default STDP parameters. Do not use this function, it is deprecated.

Allowed CARLsim states:\n ::CONFIG_STATE
Deprecated:
For clearness, setting STDP parameters using setESTDP and setISTDP is strongly recommended.

Definition at line 2128 of file carlsim.cpp.

◆ setDefaultSTPparams()

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

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]neurTypeeither EXCITATORY_NEURON or INHIBITORY_NEURON
[in]STP_Udefault value for increment of u induced by a spike
[in]STP_tau_udefault value for decay constant of u
[in]STP_tau_xdefault value for decay constant of x
See also
setSTP(int, bool)
setSTP(int, bool, float, float, float)
Since
v3.0

Definition at line 2143 of file carlsim.cpp.

◆ setESTDP() [1/3]

void setESTDP ( int  grpId,
bool  isSet 
)

Set E-STDP parameters using default settings. Do not use this function, it is deprecated.

Allowed CARLsim states:\n ::CONFIG_STATE
Deprecated:
For clearness, please do not use default STDP settings.
Since
v3.0

Definition at line 1868 of file carlsim.cpp.

◆ setESTDP() [2/3]

void setESTDP ( int  grpId,
bool  isSet,
STDPType  type,
ExpCurve  curve 
)
Parameters
[in]grpIdthe group ID of group for which these settings are applied
[in]isSetthe flag indicating if E-STDP is enabled
[in]typethe flag indicating if E-STDP is modulated by dopamine (i.e., DA-STDP)
[in]curvethe struct defining the exponential curve
Allowed CARLsim states:\n ::CONFIG_STATE
See also
STDPType
ExpCurve
Since
v3.0

Definition at line 1871 of file carlsim.cpp.

◆ setESTDP() [3/3]

void setESTDP ( int  grpId,
bool  isSet,
STDPType  type,
TimingBasedCurve  curve 
)
Parameters
[in]grpIdthe group ID of group for which these settings are applied
[in]isSetthe flag indicating if E-STDP is enabled
[in]typethe flag indicating if E-STDP is modulated by dopamine (i.e., DA-STDP)
[in]curvethe struct defining the timing-based curve
Allowed CARLsim states:\n ::CONFIG_STATE
See also
STDPType
TimingBasedCurve
Since
v3.0

Definition at line 1876 of file carlsim.cpp.

◆ setExternalCurrent() [1/2]

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

// 5mA for 50 ms, 10 neurons in the group
std::vector<float> current(10, 5.0f);
snn.setExternalCurrent(g0, current);
snn.runNetwork(0,50);
// 0mA for 10 sec, use convenience function for reset
snn.setExternalCurrent(g0, 0.0f);
snn.runNetwork(10,0);
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]grpIdthe group ID
[in]currenta float vector of current amounts (mA), one value per neuron in the group
Note
This method cannot be applied to SpikeGenerator groups.
If all neurons in the group should receive the same amount of current, you can use the convenience function setExternalCurrent(int grpId, float current).
Attention
Make sure to reset current after use (i.e., for the next call to runNetwork), otherwise the current will keep getting applied to the group.
See also
setExternalCurrent(int grpId, float current)
setSpikeRate
setSpikeGenerator
6.2 Generating Current

Definition at line 1955 of file carlsim.cpp.

◆ setExternalCurrent() [2/2]

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

// 4.5 mA for 500 ms
snn.setExternalCurrent(g0, 4.5f);
snn.runNetwork(0,500);
// don't forget to reset current afterwards if necessary
snn.setExternalCurrent(g0, 0.0f);
snn.runNetwork(10,0); // zero external current
Note
This method cannot be applied to SpikeGenerator groups.
If each neuron in the group should receive a different amount of current, you can use the method setExternalCurrent(int grpId, const std::vector<float>& current) instead.
Attention
Make sure to reset current after use (i.e., for the next call to runNetwork), otherwise the current will keep getting applied to the group.
See also
setExternalCurrent(int grpId, const std::vector<float>& current)
setSpikeRate
setSpikeGenerator
6.2 Generating Current

Definition at line 1960 of file carlsim.cpp.

◆ setGroupMonitor()

GroupMonitor * setGroupMonitor ( int  grpId,
const std::string &  fname 
)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE

Definition at line 1963 of file carlsim.cpp.

◆ setHomeoBaseFiringRate()

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe group ID of group for which these settings are applied
[in]baseFiringtarget firing rate of every neuron in this group
[in]baseFiringSDstandard deviation of target firing rate of every neuron in this group

Definition at line 1806 of file carlsim.cpp.

◆ setHomeostasis() [1/2]

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

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe group ID of group to which homeostasis is applied
[in]isSeta boolean, setting it to true/false enables/disables homeostasis

Definition at line 1803 of file carlsim.cpp.

◆ setHomeostasis() [2/2]

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

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe group ID of group to which homeostasis is applied
[in]isSeta boolean, setting it to true/false enables/disables homeostasis
[in]homeoScalescaling factor multiplied to weight change due to homeostasis
[in]avgTimeScaletime in seconds over which average firing rate for neurons in this group is averaged

Definition at line 1800 of file carlsim.cpp.

◆ setIntegrationMethod()

void setIntegrationMethod ( integrationMethod_t  method,
int  numStepsPerMs 
)

Definition at line 1810 of file carlsim.cpp.

◆ setISTDP() [1/3]

void setISTDP ( int  grpId,
bool  isSet 
)

Set I-STDP parameters using default settings. Do not use this function, it is deprecated.

Allowed CARLsim states:\n ::CONFIG_STATE
Deprecated:
For clearness, please do not use default STDP settings.
Since
v3.0

Definition at line 1881 of file carlsim.cpp.

◆ setISTDP() [2/3]

void setISTDP ( int  grpId,
bool  isSet,
STDPType  type,
ExpCurve  curve 
)
Parameters
[in]grpIdthe group ID of group for which these settings are applied
[in]isSetthe flag indicating if I-STDP is enabled
[in]typethe flag indicating if I-STDP is modulated by dopamine (i.e., DA-STDP)
[in]curvethe struct defining the exponential curve
Allowed CARLsim states:\n ::CONFIG_STATE
See also
STDPType
ExpCurve
Since
v3.0

Definition at line 1884 of file carlsim.cpp.

◆ setISTDP() [3/3]

void setISTDP ( int  grpId,
bool  isSet,
STDPType  type,
PulseCurve  curve 
)
Parameters
[in]grpIdthe group ID of group for which these settings are applied
[in]isSetthe flag indicating if I-STDP is enabled
[in]typethe flag indicating if I-STDP is modulated by dopamine (i.e., DA-STDP)
[in]curvethe struct defining the pulse curve
Allowed CARLsim states:\n ::CONFIG_STATE
See also
STDPType
PulseCurve
Since
v3.0

Definition at line 1889 of file carlsim.cpp.

◆ setLogFile()

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".

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
fileNamethe name of the log file
Note
This function cannot be called in LoggerMode CUSTOM. In this case, use setLogsFpCustom instead
Attention
Make sure the directory exists!
See also
setLogsFpCustom

Definition at line 1928 of file carlsim.cpp.

◆ setLogsFpCustom()

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).

Allowed CARLsim states:\n ::CONFIG_STATE, ::SETUP_STATE, ::RUN_STATE
Parameters
[in]fpInffile pointer for status info
[in]fpErrfile pointer for errors/warnings
[in]fpDebfile pointer for debug info
[in]fpLogfile pointer for debug log file that contains all the above info
Note
This function can be called only in LoggerMode CUSTOM.
Use NULL in order not to change current file pointers.
Attention
Make sure to fclose the file pointers. But, do not fclose stdout or stderr, or they will remain closed for the remainder of the process.

Definition at line 1931 of file carlsim.cpp.

◆ setNeuromodulator() [1/2]

void setNeuromodulator ( int  grpId,
float  baseDP,
float  tauDP,
float  base5HT,
float  tau5HT,
float  baseACh,
float  tauACh,
float  baseNE,
float  tauNE 
)
Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe symbolic name of a group
[in]baseDPthe baseline concentration of Dopamine
[in]tauDPthe decay time constant of Dopamine
[in]base5HTthe baseline concentration of Serotonin
[in]tau5HTthe decay time constant of Serotonin
[in]baseAChthe baseline concentration of Acetylcholine
[in]tauAChthe decay time constant of Acetylcholine
[in]baseNEthe baseline concentration of Noradrenaline
[in]tauNEthe decay time constant of Noradrenaline

Definition at line 1846 of file carlsim.cpp.

◆ setNeuromodulator() [2/2]

void setNeuromodulator ( int  grpId,
float  tauDP = 100.0f,
float  tau5HT = 100.0f,
float  tauACh = 100.0f,
float  tauNE = 100.0f 
)
TODO:
: this should be implemented via default arguments as members of the class, so that the user can call setDefaultNeuromodulators()
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1853 of file carlsim.cpp.

◆ setNeuronMonitor()

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).

Allowed CARLsim states:\n ::SETUP_STATE
Parameters
[in]grpIdthe group ID
[in]fileNamename 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: ""
Returns
NeuronMonitor* pointer to a NeuronMonitor object, which can be used to calculate neuron state statistics or retrieve all spikes in AER format
Note
Only one NeuronMonitor is allowed per group. NeuronMonitor cannot be placed on groups with >100 (LARGE_NEURON_MON_GRP_SIZE) neurons
Attention
Using NeuronMonitor::startRecording and NeuronMonitor::stopRecording might significantly slow down the simulation. It is unwise to use this mechanism to record a large number of neuron state values (voltage, recovery, and total current values) over a long period of time.
See also
???
ch9s1_matlab_oat

Definition at line 1978 of file carlsim.cpp.

◆ setNeuronParameters() [1/4]

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 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1816 of file carlsim.cpp.

◆ setNeuronParameters() [2/4]

void setNeuronParameters ( int  grpId,
float  izh_a,
float  izh_b,
float  izh_c,
float  izh_d 
)
TODO:
finish docu
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1821 of file carlsim.cpp.

◆ setNeuronParameters() [3/4]

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 
)
Allowed CARLsim states:\n CONFIG
Parameters
[in]grpIdthe group ID of a group for which these settings are applied
[in]izh_CMembrane capacitance parameter
[in]izh_C_sdStandard deviation for membrane capacitance parameter
[in]izh_kCoefficient present in equation for voltage
[in]izh_k_sdStandard deviation for coefficient present in equation for voltage
[in]izh_vrResting membrane potential parameter
[in]izh_vr_sdStandard deviation for resting membrane potential parameter
[in]izh_vtInstantaneous threshold potential parameter
[in]izh_vt_sdStandard deviation for instantaneous threshold potential parameter
[in]izh_aRecovery time constant
[in]izh_a_sdStandard deviation for recovery time constant
[in]izh_bCoefficient present in equation for voltage
[in]izh_b_sdStandard deviation for coefficient present in equation for voltage
[in]izh_vpeakThe spike cutoff value parameter
[in]izh_vpeak_sdStandard deviation for the spike cutoff value parameter
[in]izh_cThe voltage reset value parameter
[in]izh_c_sdStandard deviation for the voltage reset value parameter
[in]izh_dParameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior
[in]izh_d_sdStandard deviation for the parameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior
Since
v3.1

Definition at line 1831 of file carlsim.cpp.

◆ setNeuronParameters() [4/4]

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 
)
Allowed CARLsim states:\n CONFIG
Parameters
[in]grpIdthe group ID of a group for which these settings are applied
[in]izh_CMembrane capacitance parameter
[in]izh_kCoefficient present in equation for voltage
[in]izh_vrResting membrane potential parameter
[in]izh_vtInstantaneous threshold potential parameter
[in]izh_aRecovery time constant
[in]izh_bCoefficient present in equation for voltage
[in]izh_vpeakThe spike cutoff value parameter
[in]izh_cThe voltage reset value parameter
[in]izh_dParameter describing the total amount of outward minus inward currents activated during the spike and affecting the after spike behavior
Since
v3.1

Definition at line 1825 of file carlsim.cpp.

◆ setNeuronParametersLIF()

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) 
)
Parameters
[in]grpIdgroup ID
[in]tau_mMembrane time constant in ms (controls decay/leak)
[in]tau_refabsolute refractory period in ms
[in]vThThreshold voltage for firing (must be > vReset)
[in]vResetMembrane potential resets to this value immediately after spike
[in]rMemRange of total membrane resistance of the neuron group, uniformly distributed or fixed for the whole group
Allowed CARLsim states:\n ::CONFIG_STATE

Definition at line 1841 of file carlsim.cpp.

◆ setSpikeGenerator()

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe group for which you want to enable a SpikeCounter
[in]recordDurnumber 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.
See also
CARLsim::getSpikeCounter
CARLsim::resetSpikeCounter

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdthe group with which to associate a SpikeGenerator object
[in]spikeGenFuncpointer to a custom SpikeGenerator object
See also
6.1 Generating Spikes

Definition at line 1968 of file carlsim.cpp.

◆ setSpikeMonitor()

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).

Allowed CARLsim states:\n ::SETUP_STATE
Parameters
[in]grpIdthe group ID
[in]fileNamename 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: ""
Returns
SpikeMonitor* pointer to a SpikeMonitor object, which can be used to calculate spike statistics (such as group firing rate, number of silent neurons, etc.) or retrieve all spikes in AER format
Note
Only one SpikeMonitor is allowed per group.
Attention
Using SpikeMonitor::startRecording and SpikeMonitor::stopRecording might significantly slow down the simulation. It is unwise to use this mechanism to record a large number of spikes over a long period of time.
See also
ch7s1_spike_monitor
ch9s1_matlab_oat

Definition at line 1973 of file carlsim.cpp.

◆ setSpikeRate()

void setSpikeRate ( int  grpId,
PoissonRate spikeRate,
int  refPeriod = 1 
)
TODO:
finish docu
Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]grpIdgroup ID
[in]spikeRatepointer to PoissonRate object
[in]refPeriodrefactory period (ms). Default: 1ms.
Note
This method can only be applied to SpikeGenerator groups.
setSpikeRate will not take over ownership of PoissonRate. In other words, if you allocate the PoissonRate object on the heap, you are responsible for correctly deallocating it.
Attention
Make sure to reset spike rate after use (i.e., for the next call to runNetwork), otherwise the rate will keep getting applied to the group.
See also
setExternalCurrent
setSpikeGenerator

Definition at line 1983 of file carlsim.cpp.

◆ setSTDP() [1/2]

void setSTDP ( int  grpId,
bool  isSet 
)

Set STDP parameters. Do not use this function, it is deprecated.

See also
setESTDP
Deprecated:
For clearness, do not use default STDP settings.
Since
v2.1

Definition at line 1858 of file carlsim.cpp.

◆ setSTDP() [2/2]

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.

See also
setESTDP
Deprecated:
For clearness, please use CARLsim::setESTDP() with E-STDP curve struct.
Since
v2.1

Definition at line 1861 of file carlsim.cpp.

◆ setSTP() [1/2]

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.

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdpre-synaptic group ID
[in]isSeta flag whether to enable/disable STP
Note
STP will be applied to all outgoing synapses of all neurons in this group.
All outgoing synapses of a certain (pre-synaptic) neuron share the resources of that same neuron.
See also
setDefaultSTPparams
setSTP(int, bool, float, float, float)
Since
v3.0

Definition at line 1899 of file carlsim.cpp.

◆ setSTP() [2/2]

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)

\begin{eqnarray} \frac{du}{dt} & = & \frac{-u}{STP\_tau\_u} + STP\_U (1-u^-) \delta(t-t_{spk}) \\ \frac{dx}{dt} & = & \frac{1-x}{STP\_tau\_x} - u^+ x^- \delta(t-t_{spk}) \\ \frac{dI}{dt} & = & \frac{-I}{\tau_S} + A u^+ x- \delta(t-t_{spk}) \end{eqnarray}

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

Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]grpIdpre-synaptic group ID
[in]isSeta flag whether to enable/disable STP
[in]STP_Uincrement of u induced by a spike
[in]STP_tau_udecay constant of u (tau_F)
[in]STP_tau_xdecay constant of x (tau_D)
Note
STP will be applied to all outgoing synapses of all neurons in this group.
All outgoing synapses of a certain (pre-synaptic) neuron share the resources of that same neuron.

Definition at line 1894 of file carlsim.cpp.

◆ setupNetwork()

void setupNetwork ( )
Allowed CARLsim states:\n ::CONFIG_STATE. Will make CARLsim state switch from ::CONFIG_STATE to ::SETUP_STATE.

Definition at line 1915 of file carlsim.cpp.

◆ setWeight()

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).

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]connIdthe connection ID to manipulate
[in]neurIdPrepre-synaptic neuron ID (zero-indexed)
[in]neurIdPostpost-synaptic neuron ID (zero-indexed)
[in]weightthe weight value to set for this synapse
[in]updateWeightRangea 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.
Note
Neuron IDs should be zero-indexed (first neuron in the group should have ID 0).
A weight cannot drop below zero, no matter what.
Attention
Make sure this function is called on a synapse that actually exists!
See also
biasWeights
scaleWeights
Since
v3.0

Definition at line 1988 of file carlsim.cpp.

◆ setWeightAndWeightChangeUpdate()

void setWeightAndWeightChangeUpdate ( UpdateInterval  wtANDwtChangeUpdateInterval,
bool  enableWtChangeDecay,
float  wtChangeDecay = 0.9f 
)
Allowed CARLsim states:\n ::CONFIG_STATE
Parameters
[in]wtANDwtChangeUpdateIntervalthe interval between two wt (weight) and wtChange (weight change) update.
[in]enableWtChangeDecayenable weight change decay
[in]wtChangeDecaythe decay ratio of weight change (wtChange)

Definition at line 1902 of file carlsim.cpp.

◆ startTesting()

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.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Parameters
[in]updateWeightswhether to apply the accumulated weight changes before entering the testing phase
Note
Calling this function on a simulation with no plastic synapses will have no effect.
See also
CARLsim::stopTesting
Since
v3.1

Definition at line 1993 of file carlsim.cpp.

◆ stopTesting()

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.

Allowed CARLsim states:\n ::SETUP_STATE, ::RUN_STATE
Note
Calling this function on a simulation with no plastic synapses will have no effect.
See also
CARLsim::startTesting
Since
v3.1

Definition at line 1996 of file carlsim.cpp.


The documentation for this class was generated from the following files:
CARLsim::runNetwork
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
Definition: carlsim.cpp:1910
EXCITATORY_NEURON
#define EXCITATORY_NEURON
Definition: carlsim_definitions.h:77
CARLsim::setupNetwork
void setupNetwork()
build the network
Definition: carlsim.cpp:1915
CARLsim::createGroup
int createGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a group of Izhikevich spiking neurons
Definition: carlsim.cpp:1764