CARLsim  3.0.3
CARLsim: a GPU-accelerated SNN simulator
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
carlsim.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 Regents of the University of California. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * 3. The names of its contributors may not be used to endorse or promote
16  * products derived from this software without specific prior written
17  * permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * *********************************************************************************************** *
32  * CARLsim
33  * created by: (MDR) Micah Richert, (JN) Jayram M. Nageswaran
34  * maintained by: (MA) Mike Avery <averym@uci.edu>, (MB) Michael Beyeler <mbeyeler@uci.edu>,
35  * (KDC) Kristofor Carlson <kdcarlso@uci.edu>
36  * (TSC) Ting-Shuo Chou <tingshuc@uci.edu>
37  *
38  * CARLsim available from http://socsci.uci.edu/~jkrichma/CARLsim/
39  * Ver 2/21/2014
40  */
41 
42 #ifndef _CARLSIM_H_
43 #define _CARLSIM_H_
44 
45 #include <stdint.h> // uint64_t, uint32_t, etc.
46 #include <string> // std::string
47 #include <vector> // std::vector
48 
49 #include <callback.h>
50 #include <carlsim_definitions.h>
51 #include <carlsim_datastructures.h>
52 
53 // include the following core functionalities instead of forward-declaring, so that the user only needs to include
54 // carlsim.h
55 #include <poisson_rate.h>
56 #include <spike_monitor.h>
57 #include <connection_monitor.h>
58 #include <group_monitor.h>
59 #include <linear_algebra.h>
60 
61 // Cross-platform definition (Linux, Windows)
62 #if defined(WIN32) || defined(WIN64)
63 #include <Windows.h>
64 
65 #include <algorithm>
66 #define fmin (std::min)
67 #define fmax (std::max)
68 
69 #include <float.h>
70 #include <time.h>
71 
72 #ifndef isnan
73 #define isnan(x) _isnan(x)
74 #endif
75 
76 #ifndef isinf
77 #define isinf(x) (!_finite(x))
78 #endif
79 
80 #ifndef srand48
81 #define srand48(x) srand(x)
82 #endif
83 
84 #ifndef drand48
85 #define drand48() (double(rand())/RAND_MAX)
86 #endif
87 
88 #ifdef _MSC_VER
89 #define INFINITY (DBL_MAX+DBL_MAX)
90 #define NAN (INFINITY-INFINITY)
91 #endif
92 
93 #else
94 #include <interactive_spikegen.h>
96 #include <periodic_spikegen.h>
97 #include <spikegen_from_file.h>
98 #include <spikegen_from_vector.h>
99 #include <simple_weight_tuner.h>
100 #include <visual_stimulus.h>
101 
102 #include <pthread.h>
103 #endif
104 
105 // \TODO: complete documentation
106 
107 
108 
109 
110 class CpuSNN; // forward-declaration of implementation
111 class GroupMonitorCore;
112 class ConnectionMonitorCore;
113 class ConnectionGeneratorCore;
114 class SpikeGeneratorCore;
115 
142 class CARLsim {
143 public:
144  // +++++ PUBLIC METHODS: CONSTRUCTOR / DESTRUCTOR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
145 
179  CARLsim(const std::string& netName="SNN", simMode_t simMode=CPU_MODE, loggerMode_t loggerMode=USER, int ithGPU=0,
180  int randSeed=-1);
181  ~CARLsim();
182 
183 
184 
185  // +++++ PUBLIC METHODS: SETTING UP A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
186 
252  short int connect(int grpId1, int grpId2, const std::string& connType, const RangeWeight& wt, float connProb,
253  const RangeDelay& delay=RangeDelay(1), const RadiusRF& radRF=RadiusRF(-1), bool synWtType=SYN_FIXED,
254  float mulSynFast=1.0f, float mulSynSlow=1.0f);
255 
263  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, bool synWtType=SYN_FIXED, int maxM=0,
264  int maxPreM=0);
265 
272  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, float mulSynFast, float mulSynSlow,
273  bool synWtType=SYN_FIXED, int maxM=0,int maxPreM=0);
274 
275 
281  int createGroup(const std::string& grpName, int nNeur, int neurType);
282 
304  int createGroup(const std::string& grpName, const Grid3D& grid, int neurType);
305 
311  int createSpikeGeneratorGroup(const std::string& grpName, int nNeur, int neurType);
312 
329  int createSpikeGeneratorGroup(const std::string& grpName, const Grid3D& grid, int neurType);
330 
331 
345  void setConductances(bool isSet);
346 
363  void setConductances(bool isSet, int tdAMPA, int tdNMDA, int tdGABAa, int tdGABAb);
364 
385  void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
386 
415  void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale);
416 
431  void setHomeostasis(int grpId, bool isSet);
432 
450  void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f);
451 
458  void setNeuronParameters(int grpId, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd,
459  float izh_c, float izh_c_sd, float izh_d, float izh_d_sd);
460 
467  void setNeuronParameters(int grpId, float izh_a, float izh_b, float izh_c, float izh_d);
468 
484  void setNeuromodulator(int grpId, float baseDP, float tauDP, float base5HT, float tau5HT,
485  float baseACh, float tauACh, float baseNE, float tauNE);
486 
495  void setNeuromodulator(int grpId, float tauDP = 100.0f, float tau5HT = 100.0f,
496  float tauACh = 100.0f, float tauNE = 100.0f);
497 
507  void setSTDP(int grpId, bool isSet);
508 
518  void setSTDP(int grpId, bool isSet, stdpType_t type, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus);
519 
529  void setESTDP(int grpId, bool isSet);
530 
544  void setESTDP(int grpId, bool isSet, stdpType_t type, ExpCurve curve);
545 
559  void setESTDP(int grpId, bool isSet, stdpType_t type, TimingBasedCurve curve);
560 
570  void setISTDP(int grpId, bool isSet);
571 
585  void setISTDP(int grpId, bool isSet, stdpType_t type, ExpCurve curve);
586 
600  void setISTDP(int grpId, bool isSet, stdpType_t type, PulseCurve curve);
601 
631  void setSTP(int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x);
632 
654  void setSTP(int grpId, bool isSet);
655 
664  void setWeightAndWeightChangeUpdate(updateInterval_t wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f);
665 
666 
667  // +++++ PUBLIC METHODS: RUNNING A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
668 
678  int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true, bool copyState=false);
679 
686  void setupNetwork(bool removeTempMemory = true);
687 
688  // +++++ PUBLIC METHODS: LOGGING / PLOTTING +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
689 
690  const FILE* getLogFpInf();
691  const FILE* getLogFpErr();
692  const FILE* getLogFpDeb();
693  const FILE* getLogFpLog();
694 
712  void saveSimulation(const std::string& fileName, bool saveSynapseInfo=true);
713 
728  void setLogFile(const std::string& fileName);
729 
748  void setLogsFpCustom(FILE* fpInf=NULL, FILE* fpErr=NULL, FILE* fpDeb=NULL, FILE* fpLog=NULL);
749 
750 
751 
752  // +++++ PUBLIC METHODS: INTERACTING WITH A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
753 
776  void biasWeights(short int connId, float bias, bool updateWeightRange=false);
777 
797  void loadSimulation(FILE* fid);
798 
816  void resetSpikeCounter(int grpId);
817 
840  void scaleWeights(short int connId, float scale, bool updateWeightRange=false);
841 
874  ConnectionMonitor* setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string& fname);
875 
913  void setExternalCurrent(int grpId, const std::vector<float>& current);
914 
943  void setExternalCurrent(int grpId, float current);
944 
951  GroupMonitor* setGroupMonitor(int grpId, const std::string& fname);
952 
977  void setSpikeCounter(int grpId, int recordDur=-1);
978 
998  void setSpikeGenerator(int grpId, SpikeGenerator* spikeGen);
999 
1038  SpikeMonitor* setSpikeMonitor(int grpId, const std::string& fileName);
1039 
1057  void setSpikeRate(int grpId, PoissonRate* spikeRate, int refPeriod=1);
1058 
1085  void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false);
1086 
1093  void writePopWeights(std::string fname, int gIDpre, int gIDpost);
1094 
1095 
1096 
1097  // +++++ PUBLIC METHODS: GETTERS / SETTERS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1098 
1114  carlsimState_t getCARLsimState() { return carlsimState_; }
1115 
1123  std::vector<float> getConductanceAMPA(int grpId);
1124 
1132  std::vector<float> getConductanceNMDA(int grpId);
1133 
1141  std::vector<float> getConductanceGABAa(int grpId);
1142 
1150  std::vector<float> getConductanceGABAb(int grpId);
1151 
1163  RangeDelay getDelayRange(short int connId);
1164 
1171  uint8_t* getDelays(int gIDpre, int gIDpost, int& Npre, int& Npost, uint8_t* delays=NULL);
1172 
1185  Grid3D getGroupGrid3D(int grpId);
1186 
1193  int getGroupId(std::string grpName);
1194 
1201  std::string getGroupName(int grpId);
1202 
1221  Point3D getNeuronLocation3D(int neurId);
1222 
1244  Point3D getNeuronLocation3D(int grpId, int relNeurId);
1245 
1255  int getNumConnections();
1256 
1263  int getNumSynapticConnections(short int connectionId);
1264 
1272  int getNumGroups();
1273 
1281  int getNumNeurons();
1282 
1290  int getNumNeuronsReg();
1291 
1299  int getNumNeuronsRegExc();
1300 
1308  int getNumNeuronsRegInh();
1309 
1317  int getNumNeuronsGen();
1318 
1326  int getNumNeuronsGenExc();
1327 
1335  int getNumNeuronsGenInh();
1336 
1343  int getNumPreSynapses();
1344 
1351  int getNumPostSynapses();
1352 
1359  int getGroupStartNeuronId(int grpId);
1360 
1367  int getGroupEndNeuronId(int grpId);
1368 
1375  int getGroupNumNeurons(int grpId);
1376 
1384  GroupSTDPInfo_t getGroupSTDPInfo(int grpId);
1385 
1395 
1405 
1412  uint64_t getSimTime();
1413 
1420  uint32_t getSimTimeSec();
1421 
1428  uint32_t getSimTimeMsec();
1429 
1470  int* getSpikeCounter(int grpId);
1471 
1483  SpikeMonitor* getSpikeMonitor(int grpId);
1484 
1496  RangeWeight getWeightRange(short int connId);
1497 
1504  bool isExcitatoryGroup(int grpId);
1505 
1512  bool isInhibitoryGroup(int grpId);
1513 
1520  bool isPoissonGroup(int grpId);
1521 
1522  // +++++ PUBLIC METHODS: SET DEFAULTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1523 
1535  void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
1536 
1543  void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale);
1544 
1551  void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo);
1552 
1561  void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, stdpType_t stdpType);
1562 
1571  void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, stdpType_t stdpType);
1572 
1581  void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, stdpType_t stdpType);
1582 
1604  void setDefaultSTPparams(int neurType, float STP_U, float STP_tau_u, float STP_tau_x);
1605 
1606 
1607 private:
1608  // +++++ PRIVATE METHODS ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1609 
1610  void CARLsimInit();
1611 
1612  bool existsGrpId(int grpId);
1613 
1614  void handleUserWarnings();
1615 
1616  void printSimulationSpecs();
1617 
1618  // +++++ PRIVATE STATIC PROPERTIES ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1619  static bool gpuAllocation[MAX_NUM_CUDA_DEVICES];
1620  static std::string gpuOccupiedBy[MAX_NUM_CUDA_DEVICES];
1621 #if defined(WIN32) || defined(WIN64)
1622  static HANDLE gpuAllocationLock;
1623 #else
1624  static pthread_mutex_t gpuAllocationLock;
1625 #endif
1626  // +++++ PRIVATE PROPERTIES +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1627 
1628  CpuSNN* snn_;
1629  std::string netName_;
1630  int randSeed_;
1631  simMode_t simMode_;
1632  loggerMode_t loggerMode_;
1633  int ithGPU_;
1634  bool enablePrint_;
1635  bool copyState_;
1636 
1637  unsigned int numConnections_;
1638  std::vector<std::string> userWarnings_; // !< an accumulated list of user warnings
1639 
1640  std::vector<int> grpIds_;
1641  std::vector<SpikeGeneratorCore*> spkGen_;
1642  std::vector<ConnectionGeneratorCore*> connGen_;
1643 
1644  bool hasSetHomeoALL_;
1645  bool hasSetHomeoBaseFiringALL_;
1646  bool hasSetSTDPALL_;
1647  bool hasSetSTPALL_;
1648  bool hasSetConductances_;
1649  carlsimState_t carlsimState_;
1650 
1651  int def_tdAMPA_;
1652  int def_trNMDA_;
1653  int def_tdNMDA_;
1654  int def_tdGABAa_;
1655  int def_trGABAb_;
1656  int def_tdGABAb_;
1657 
1658  // all default values for STDP
1659  stdpType_t def_STDP_type_;
1660  float def_STDP_alphaLTP_;
1661  float def_STDP_tauLTP_;
1662  float def_STDP_alphaLTD_;
1663  float def_STDP_tauLTD_;
1664  float def_STDP_betaLTP_;
1665  float def_STDP_betaLTD_;
1666  float def_STDP_lambda_;
1667  float def_STDP_delta_;
1668 
1669  // all default values for STP
1670  float def_STP_U_exc_;
1671  float def_STP_tau_u_exc_;
1672  float def_STP_tau_x_exc_;
1673  float def_STP_U_inh_;
1674  float def_STP_tau_u_inh_;
1675  float def_STP_tau_x_inh_;
1676 
1677  // all default values for homeostasis
1678  float def_homeo_scale_;
1679  float def_homeo_avgTimeScale_;
1680 
1681  // all default values for save file
1682  std::string def_save_fileName_;
1683  bool def_save_synapseInfo_;
1684 };
1685 #endif
Class for generating Poisson spike trains.
Definition: poisson_rate.h:84
A struct for retrieving neuromodulator information of a group.
model is run on a single CPU core
int getNumGroups()
returns the number of groups in the network
void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets default values for conductance time constants.
void setSTDP(int grpId, bool isSet)
Sets default STDP mode and params.
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType)
creates a spike generator group
int getGroupNumNeurons(int grpId)
returns the number of neurons of a group specified by grpId
carlsimState_t getCARLsimState()
Returns the current CARLsim state.
Definition: carlsim.h:1114
const FILE * getLogFpDeb()
returns file pointer to debug log
int getNumNeuronsRegInh()
returns the total number of regular (Izhikevich) inhibitory neurons
int getNumNeuronsReg()
returns the total number of regular (Izhikevich) neurons
void setESTDP(int grpId, bool isSet)
Sets default E-STDP mode and parameters.
int createGroup(const std::string &grpName, int nNeur, int neurType)
creates a group of Izhikevich spiking neurons
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
Definition: carlsim.h:142
void setLogFile(const std::string &fileName)
Sets the name of the log file.
void setISTDP(int grpId, bool isSet)
Sets default I-STDP mode and parameters.
A struct to assign a timing-based E-STDP curve.
GroupNeuromodulatorInfo_t getGroupNeuromodulatorInfo(int grpId)
returns the neuromodulator information of a group specified by grpId
const FILE * getLogFpInf()
returns file pointer to info log
void resetSpikeCounter(int grpId)
reset Spike Counter to zero
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), 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 value...
#define MAX_NUM_CUDA_DEVICES
void loadSimulation(FILE *fid)
Loads a simulation (and network state) from file. The file pointer fid must point to a valid CARLsim ...
#define SYN_FIXED
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
Sets default homeostasis params.
a point in 3D space
int getGroupEndNeuronId(int grpId)
returns the last neuron id of a groupd specified by grpId
const FILE * getLogFpErr()
returns file pointer to error log
Class SpikeMonitor.
void setWeightAndWeightChangeUpdate(updateInterval_t wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f)
Sets the weight and weight change update parameters.
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f)
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling) ...
int getNumNeuronsRegExc()
returns the total number of regular (Izhikevich) excitatory neurons
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, stdpType_t stdpType)
sets default STDP params
int getNumPostSynapses()
returns the total number of allocated post-synaptic connections in the network
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, stdpType_t stdpType)
sets default values for I-STDP params
int getNumNeuronsGen()
returns the total number of spike generator neurons
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)...
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.
bool isExcitatoryGroup(int grpId)
returns
void setConductances(bool isSet)
Sets default values for conduction decay and rise times or disables COBA alltogether.
void setupNetwork(bool removeTempMemory=true)
build the network
bool isInhibitoryGroup(int grpId)
returns
struct to assign a pulse I-STDP curve
stdpType_t
STDP flavors.
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true, bool copyState=false)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
Sets a connection monitor for a group, custom ConnectionMonitor class.
uint32_t getSimTimeSec()
returns
std::vector< float > getConductanceGABAa(int grpId)
gets GABAa vector of a group
int getNumNeurons()
returns the total number of allocated neurons in the network
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod=1)
Sets a spike rate.
std::vector< float > getConductanceGABAb(int grpId)
gets GABAb vector of a group
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets custom values for implementation of homeostatic synaptic scaling.
void setSpikeCounter(int grpId, int recordDur=-1)
A SpikeCounter keeps track of the number of spikes per neuron in a group.
Class GroupMonitor.
Definition: group_monitor.h:96
std::string getGroupName(int grpId)
gets group name
std::vector< float > getConductanceAMPA(int grpId)
gets AMPA vector of a group
int getNumNeuronsGenExc()
returns the total number of excitatory spike generator neurons
int getGroupId(std::string grpName)
finds the ID of the group with name grpName
Point3D getNeuronLocation3D(int neurId)
returns the 3D location a neuron codes for
a range struct for synaptic delays
void biasWeights(short int connId, float bias, bool updateWeightRange=false)
Adds a constant bias to the weight of every synapse in the connection.
simMode_t getSimMode()
returns the current simulation mode
int getNumConnections()
Returns the number of connections (pairs of pre-post groups) in the network.
int getGroupStartNeuronId(int grpId)
returns the first neuron id of a groupd specified by grpId
Grid3D getGroupGrid3D(int grpId)
returns the 3D grid struct of a group
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) ...
int getNumSynapticConnections(short int connectionId)
returns the number of connections associated with a connection ID
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
Sets the weight value of a specific synapse.
int getNumPreSynapses()
returns the total number of allocated pre-synaptic connections in the network
uint32_t getSimTimeMsec()
returns
int getNumNeuronsGenInh()
returns the total number of inhibitory spike generator neurons
A struct to assign exponential STDP curves.
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, stdpType_t stdpType)
sets default values for E-STDP params
std::vector< float > getConductanceNMDA(int grpId)
gets NMDA vector of a group
CARLsim(const std::string &netName="SNN", simMode_t simMode=CPU_MODE, loggerMode_t loggerMode=USER, int ithGPU=0, int randSeed=-1)
CARLsim constructor. Creates a new instance of class CARLsim. All input arguments are optional...
Class ConnectionMonitor.
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
Sets a group monitor for a group, custom GroupMonitor class.
void writePopWeights(std::string fname, int gIDpre, int gIDpost)
function writes population weights from gIDpre to gIDpost to file fname in binary.
simMode_t
simulation mode
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)
a range struct for synaptic weight magnitudes
void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo)
Sets default options for save file.
void setSpikeGenerator(int grpId, SpikeGenerator *spikeGen)
Associates a SpikeGenerator object with a group.
const FILE * getLogFpLog()
returns file pointer to log file
updateInterval_t
Update frequency for weights.
A struct for retrieving STDP related information of a group.
GroupSTDPInfo_t getGroupSTDPInfo(int grpId)
returns the stdp information of a group specified by grpId
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct for a specific connection ID
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
Sets a Spike Monitor for a groups, prints spikes to binary file.
int * getSpikeCounter(int grpId)
Returns the number of spikes per neuron for a certain group.
SpikeMonitor * getSpikeMonitor(int grpId)
returns pointer to previously allocated SpikeMonitor object, NULL else
uint64_t getSimTime()
returns
bool isPoissonGroup(int grpId)
returns
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost, uint8_t *delays=NULL)
gets delays
User mode, for experiment-oriented simulations.
carlsimState_t
CARLsim states.
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.
RangeWeight getWeightRange(short int connId)
returns the RangeWeight struct for a specific connection ID
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.
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
Multiplies the weight of every synapse in the connection with a scaling factor.
void saveSimulation(const std::string &fileName, bool saveSynapseInfo=true)
Saves important simulation and network infos to file.
void setExternalCurrent(int grpId, const std::vector< float > &current)
Sets the amount of current (mA) to inject into a group.
loggerMode_t
Logger modes.
A struct to specify the receptive field (RF) radius in 3 dimensions.