CARLsim  4.1.0
CARLsim: a GPU-accelerated SNN simulator
carlsim.h
Go to the documentation of this file.
1 /* * Copyright (c) 2016 Regents of the University of California. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * 3. The names of its contributors may not be used to endorse or promote
15 * products derived from this software without specific prior written
16 * permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * *********************************************************************************************** *
31 * CARLsim
32 * created by: (MDR) Micah Richert, (JN) Jayram M. Nageswaran
33 * maintained by:
34 * (MA) Mike Avery <averym@uci.edu>
35 * (MB) Michael Beyeler <mbeyeler@uci.edu>,
36 * (KDC) Kristofor Carlson <kdcarlso@uci.edu>
37 * (TSC) Ting-Shuo Chou <tingshuc@uci.edu>
38 * (HK) Hirak J Kashyap <kashyaph@uci.edu>
39 *
40 * CARLsim v1.0: JM, MDR
41 * CARLsim v2.0/v2.1/v2.2: JM, MDR, MA, MB, KDC
42 * CARLsim3: MB, KDC, TSC
43 * CARLsim4: TSC, HK
44 *
45 * CARLsim available from http://socsci.uci.edu/~jkrichma/CARLsim/
46 * Ver 12/31/2016
47 */
48 
49 #ifndef _CARLSIM_H_
50 #define _CARLSIM_H_
51 
52 #include <stdint.h> // uint64_t, uint32_t, etc.
53 #include <string> // std::string
54 #include <vector> // std::vector
55 #include <algorithm>
56 
57 #include <carlsim_definitions.h>
58 #include <carlsim_datastructures.h>
59 
60 // include the following core functionalities instead of forward-declaring, so that the user only needs to include
61 // carlsim.h
62 #include <callback.h>
63 #include <poisson_rate.h>
64 #include <spike_monitor.h>
65 #include <neuron_monitor.h>
66 #include <connection_monitor.h>
67 #include <group_monitor.h>
68 #include <linear_algebra.h>
69 
70 class GroupMonitor;
71 class ConnectionMonitor;
72 class SpikeMonitor;
73 class SpikeGenerator;
74 
75 
76 
77 // Cross-platform definition (Linux, Windows)
78 #if defined(WIN32) || defined(WIN64)
79 #include <Windows.h>
80 
81 #include <float.h>
82 #include <time.h>
83 
84 #ifndef isnan
85 #define isnan(x) _isnan(x)
86 #endif
87 
88 #ifndef isinf
89 #define isinf(x) (!_finite(x))
90 #endif
91 
92 #ifndef srand48
93 #define srand48(x) srand(x)
94 #endif
95 
96 #ifndef drand48
97 #define drand48() (double(rand())/RAND_MAX)
98 #endif
99 
100 #else
101 
102 #include <pthread.h> // pthread
103 #include <sys/stat.h> // mkdir
104 #include <unistd.h> //unix thread affinity macros
105 
106 
107 #endif
108 
109 
110 
137 class CARLsim {
138 public:
139  // +++++ PUBLIC METHODS: CONSTRUCTOR / DESTRUCTOR +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
140 
174  CARLsim(const std::string& netName = "SNN", SimMode preferredSimMode = CPU_MODE, LoggerMode loggerMode = USER, int ithGPUs = 0, int randSeed = -1);
175  ~CARLsim();
176 
177 
178 
179  // +++++ PUBLIC METHODS: SETTING UP A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
180 
246  short int connect(int grpId1, int grpId2, const std::string& connType, const RangeWeight& wt, float connProb,
247  const RangeDelay& delay=RangeDelay(1), const RadiusRF& radRF=RadiusRF(-1.0), bool synWtType=SYN_FIXED,
248  float mulSynFast=1.0f, float mulSynSlow=1.0f);
249 
257  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, bool synWtType=SYN_FIXED);
258 
265  short int connect(int grpId1, int grpId2, ConnectionGenerator* conn, float mulSynFast, float mulSynSlow,
266  bool synWtType=SYN_FIXED);
267 
276  short int connectCompartments(int grpIdLower, int grpIdUpper);
277 
278 
284  int createGroup(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
285 
291  int createGroupLIF(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
292 
314  int createGroup(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
315 
326  int createGroupLIF(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
327 
333  int createSpikeGeneratorGroup(const std::string& grpName, int nNeur, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
334 
351  int createSpikeGeneratorGroup(const std::string& grpName, const Grid3D& grid, int neurType, int preferredPartition = ANY, ComputingBackend preferredBackend = CPU_CORES);
352 
353 
367  void setConductances(bool isSet);
368 
385  void setConductances(bool isSet, int tdAMPA, int tdNMDA, int tdGABAa, int tdGABAb);
386 
407  void setConductances(bool isSet, int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
408 
437  void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale);
438 
453  void setHomeostasis(int grpId, bool isSet);
454 
472  void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f);
473 
474  /*
475  * \brief Sets the integration method for the simulation
476  *
477  * This function specifies the integration method for the simulation. Currently, the chosen integration method
478  * will apply to all neurons in the network.
479  *
480  * The basic simulation time step is 1ms, meaning that spike times cannot be retrieved with sub-millisecond
481  * precision. However, the integration time step can be lower than 1ms, which is specified by numStepsPerMs.
482  * A numStepsPerMs set to 10 would take 10 integration steps per 1ms simulation time step.
483  *
484  * By default, the simulation will use Forward-Euler with an integration step of 0.5ms (i.e.,
485  * <tt>numStepsPerMs</tt>=2).
486  *
487  * Currently CARLsim supports the following integration methods:
488  * - FORWARD_EULER: The most basic, forward-Euler method. Suggested value for <tt>numStepsPerMs</tt>: >= 2.
489  * - RUNGE_KUTTA4: Fourth-order Runge-Kutta (aka classical Runge-Kutta, aka RK4).
490  * Suggested value for <tt>numStepsPerMs</tt>: >= 10.
491  *
492  * \STATE ::CONFIG_STATE
493  * \param[in] method the integration method to use
494  * \param[in] numStepsPerMs the number of integration steps per 1ms simulation time step
495  *
496  * \note Note that the higher numStepsPerMs the slower the simulation may be, due to increased computational load.
497  * \since v3.1
498  */
499  void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs);
500 
507  void setNeuronParameters(int grpId, float izh_a, float izh_a_sd, float izh_b, float izh_b_sd,
508  float izh_c, float izh_c_sd, float izh_d, float izh_d_sd);
509 
516  void setNeuronParameters(int grpId, float izh_a, float izh_b, float izh_c, float izh_d);
517 
537  void setNeuronParameters(int grpId, float izh_C, float izh_k, float izh_vr, float izh_vt,
538  float izh_a, float izh_b, float izh_vpeak, float izh_c, float izh_d);
539 
569  void setNeuronParameters(int grpId, float izh_C, float izh_C_sd, float izh_k, float izh_k_sd,
570  float izh_vr, float izh_vr_sd, float izh_vt, float izh_vt_sd,
571  float izh_a, float izh_a_sd, float izh_b, float izh_b_sd,
572  float izh_vpeak, float izh_vpeak_sd, float izh_c, float izh_c_sd,
573  float izh_d, float izh_d_sd);
574 
586  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));
587 
597  void setCompartmentParameters(int grpId, float couplingUp, float couplingDown);
598 
614  void setNeuromodulator(int grpId, float baseDP, float tauDP, float base5HT, float tau5HT,
615  float baseACh, float tauACh, float baseNE, float tauNE);
616 
625  void setNeuromodulator(int grpId, float tauDP = 100.0f, float tau5HT = 100.0f,
626  float tauACh = 100.0f, float tauNE = 100.0f);
627 
637  void setSTDP(int grpId, bool isSet);
638 
648  void setSTDP(int grpId, bool isSet, STDPType type, float alphaPlus, float tauPlus, float alphaMinus, float tauMinus);
649 
659  void setESTDP(int grpId, bool isSet);
660 
674  void setESTDP(int grpId, bool isSet, STDPType type, ExpCurve curve);
675 
689  void setESTDP(int grpId, bool isSet, STDPType type, TimingBasedCurve curve);
690 
700  void setISTDP(int grpId, bool isSet);
701 
715  void setISTDP(int grpId, bool isSet, STDPType type, ExpCurve curve);
716 
730  void setISTDP(int grpId, bool isSet, STDPType type, PulseCurve curve);
731 
761  void setSTP(int grpId, bool isSet, float STP_U, float STP_tau_u, float STP_tau_x);
762 
784  void setSTP(int grpId, bool isSet);
785 
794  void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f);
795 
796 
797  // +++++ PUBLIC METHODS: RUNNING A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
798 
807  int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true);
808 
814  void setupNetwork();
815 
816  // +++++ PUBLIC METHODS: LOGGING / PLOTTING +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
817 
818  const FILE* getLogFpInf();
819  const FILE* getLogFpErr();
820  const FILE* getLogFpDeb();
821  const FILE* getLogFpLog();
822 
840  void saveSimulation(const std::string& fileName, bool saveSynapseInfo=true);
841 
856  void setLogFile(const std::string& fileName);
857 
876  void setLogsFpCustom(FILE* fpInf=NULL, FILE* fpErr=NULL, FILE* fpDeb=NULL, FILE* fpLog=NULL);
877 
878 
879 
880  // +++++ PUBLIC METHODS: INTERACTING WITH A SIMULATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
881 
904  void biasWeights(short int connId, float bias, bool updateWeightRange=false);
905 
925  void loadSimulation(FILE* fid);
926 
944  //void resetSpikeCounter(int grpId);
945 
968  void scaleWeights(short int connId, float scale, bool updateWeightRange=false);
969 
1002  ConnectionMonitor* setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string& fname);
1003 
1041  void setExternalCurrent(int grpId, const std::vector<float>& current);
1042 
1071  void setExternalCurrent(int grpId, float current);
1072 
1079  GroupMonitor* setGroupMonitor(int grpId, const std::string& fname);
1080 
1105  //void setSpikeCounter(int grpId, int recordDur=-1);
1106 
1126  void setSpikeGenerator(int grpId, SpikeGenerator* spikeGenFunc);
1127 
1170  SpikeMonitor* setSpikeMonitor(int grpId, const std::string& fileName);
1171 
1214  NeuronMonitor* setNeuronMonitor(int grpId, const std::string& fileName);
1215 
1233  void setSpikeRate(int grpId, PoissonRate* spikeRate, int refPeriod=1);
1234 
1262  void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false);
1263 
1285  void startTesting(bool updateWeights=true);
1286 
1299  void stopTesting();
1300 
1307  //void writePopWeights(std::string fname, int gIDpre, int gIDpost);
1308 
1309 
1310 
1311  // +++++ PUBLIC METHODS: GETTERS / SETTERS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1312 
1329 
1337  std::vector<float> getConductanceAMPA(int grpId);
1338 
1346  std::vector<float> getConductanceNMDA(int grpId);
1347 
1355  std::vector<float> getConductanceGABAa(int grpId);
1356 
1364  std::vector<float> getConductanceGABAb(int grpId);
1365 
1377  RangeDelay getDelayRange(short int connId);
1378 
1385  uint8_t* getDelays(int gIDpre, int gIDpost, int& Npre, int& Npost);
1386 
1387  // FIXME: This function is called in SNN::connect() at CONFIG_STATE, which violate the restriction
1400  Grid3D getGroupGrid3D(int grpId);
1401 
1408  int getGroupId(std::string grpName);
1409 
1416  std::string getGroupName(int grpId);
1417 
1436  Point3D getNeuronLocation3D(int neurId);
1437 
1445 
1467  Point3D getNeuronLocation3D(int grpId, int relNeurId);
1468 
1478  int getNumConnections();
1479 
1486  int getNumSynapticConnections(short int connectionId);
1487 
1495  int getNumGroups();
1496 
1504  int getNumNeurons();
1505 
1513  int getNumNeuronsReg();
1514 
1522  int getNumNeuronsRegExc();
1523 
1531  int getNumNeuronsRegInh();
1532 
1540  int getNumNeuronsGen();
1541 
1549  int getNumNeuronsGenExc();
1550 
1558  int getNumNeuronsGenInh();
1559 
1566  int getNumSynapses();
1567 
1574  int getGroupStartNeuronId(int grpId);
1575 
1582  int getGroupEndNeuronId(int grpId);
1583 
1590  int getGroupNumNeurons(int grpId);
1591 
1599  GroupSTDPInfo getGroupSTDPInfo(int grpId);
1600 
1610 
1617  int getSimTime();
1618 
1625  int getSimTimeSec();
1626 
1633  int getSimTimeMsec();
1634 
1675  //int* getSpikeCounter(int grpId);
1676 
1688  SpikeMonitor* getSpikeMonitor(int grpId);
1689 
1701  RangeWeight getWeightRange(short int connId);
1702 
1712  bool isConnectionPlastic(short int connId);
1713 
1723  bool isGroupWithHomeostasis(int grpId);
1724 
1731  bool isExcitatoryGroup(int grpId);
1732 
1739  bool isInhibitoryGroup(int grpId);
1740 
1747  bool isPoissonGroup(int grpId);
1748 
1749  // +++++ PUBLIC METHODS: SET DEFAULTS +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
1750 
1762  void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb);
1763 
1770  void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale);
1771 
1778  void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo);
1779 
1788  void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType);
1789 
1798  void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType);
1799 
1808  void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType);
1809 
1831  void setDefaultSTPparams(int neurType, float STP_U, float STP_tau_u, float STP_tau_x);
1832 
1833 
1834 private:
1835  // This class provides a pImpl for the CARLsim User API.
1836  // \see https://marcmutz.wordpress.com/translated-articles/pimp-my-pimpl/
1837  class Impl;
1838  Impl* _impl;
1839 };
1840 #endif
CARLsim::setExternalCurrent
void setExternalCurrent(int grpId, const std::vector< float > &current)
Sets the amount of current (mA) to inject into a group.
Definition: carlsim.cpp:1954
CARLsim::getNumNeuronsRegExc
int getNumNeuronsRegExc()
returns the total number of regular (Izhikevich) excitatory neurons
Definition: carlsim.cpp:2052
CARLsim::createSpikeGeneratorGroup
int createSpikeGeneratorGroup(const std::string &grpName, int nNeur, int neurType, int preferredPartition=ANY, ComputingBackend preferredBackend=CPU_CORES)
creates a spike generator group
Definition: carlsim.cpp:1779
CARLsim::stopTesting
void stopTesting()
Exits a testing phase, making weight changes possible again.
Definition: carlsim.cpp:1995
SimMode
SimMode
simulation mode
Definition: carlsim_datastructures.h:113
integrationMethod_t
integrationMethod_t
Integration methods.
Definition: carlsim_datastructures.h:132
ConnectionGenerator
Definition: callback.h:90
CARLsim::getGroupName
std::string getGroupName(int grpId)
gets group name
Definition: carlsim.cpp:2026
CARLsim::setSTP
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)
Definition: carlsim.cpp:1893
CARLsim::setDefaultSaveOptions
void setDefaultSaveOptions(std::string fileName, bool saveSynapseInfo)
Sets default options for save file.
Definition: carlsim.cpp:2122
CARLsim::getGroupNeuromodulatorInfo
GroupNeuromodulatorInfo getGroupNeuromodulatorInfo(int grpId)
returns the neuromodulator information of a group specified by grpId
Definition: carlsim.cpp:2082
CARLsim::setDefaultConductanceTimeConstants
void setDefaultConductanceTimeConstants(int tdAMPA, int trNMDA, int tdNMDA, int tdGABAa, int trGABAb, int tdGABAb)
Sets default values for conductance time constants.
Definition: carlsim.cpp:2110
RangeWeight
a range struct for synaptic weight magnitudes
Definition: carlsim_datastructures.h:311
CARLsim::getConductanceGABAb
std::vector< float > getConductanceGABAb(int grpId)
gets GABAb vector of a group
Definition: carlsim.cpp:2010
spike_monitor.h
SpikeMonitor
Class SpikeMonitor.
Definition: spike_monitor.h:119
CARLsim::getNeuronLocation3D
Point3D getNeuronLocation3D(int neurId)
returns the 3D location a neuron codes for
Definition: carlsim.cpp:2029
CARLsim::runNetwork
int runNetwork(int nSec, int nMsec=0, bool printRunSummary=true)
run the simulation for time=(nSec*seconds + nMsec*milliseconds)
Definition: carlsim.cpp:1909
CARLsim::biasWeights
void biasWeights(short int connId, float bias, bool updateWeightRange=false)
Adds a constant bias to the weight of every synapse in the connection.
Definition: carlsim.cpp:1936
CARLsim::startTesting
void startTesting(bool updateWeights=true)
Enters a testing phase in which all weight changes are disabled.
Definition: carlsim.cpp:1992
CARLsim::getNumSynapses
int getNumSynapses()
returns the total number of allocated synaptic connections in the network
Definition: carlsim.cpp:2067
CARLsim::setConductances
void setConductances(bool isSet)
Sets default values for conduction decay and rise times or disables COBA alltogether.
Definition: carlsim.cpp:1788
CARLsim::~CARLsim
~CARLsim()
Definition: carlsim.cpp:1736
CARLsim::getNumNeuronsReg
int getNumNeuronsReg()
returns the total number of regular (Izhikevich) neurons
Definition: carlsim.cpp:2049
carlsim_datastructures.h
CARLsim::getSimTimeMsec
int getSimTimeMsec()
returns
Definition: carlsim.cpp:2090
CARLsim::scaleWeights
void scaleWeights(short int connId, float scale, bool updateWeightRange=false)
reset Spike Counter to zero
Definition: carlsim.cpp:1944
CARLsim::connectCompartments
short int connectCompartments(int grpIdLower, int grpIdUpper)
make a compartmental connection between two compartmentally enabled groups Note: all compartmentally ...
Definition: carlsim.cpp:1755
CARLsim::Impl
Definition: carlsim.cpp:79
CARLsim::getNumNeurons
int getNumNeurons()
returns the total number of allocated neurons in the network
Definition: carlsim.cpp:2046
CARLsim::setDefaultESTDPparams
void setDefaultESTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default values for E-STDP params
Definition: carlsim.cpp:2132
CARLsimState
CARLsimState
CARLsim states.
Definition: carlsim_datastructures.h:259
CARLsim::getLogFpDeb
const FILE * getLogFpDeb()
returns file pointer to debug log
Definition: carlsim.cpp:1918
CARLsim::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))
Sets neuron parameters for a group of LIF spiking neurons.
Definition: carlsim.cpp:1840
CARLsim::setCompartmentParameters
void setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Sets coupling constants G_u and G_d for the compartment.
Definition: carlsim.cpp:1783
CARLsim::saveSimulation
void saveSimulation(const std::string &fileName, bool saveSynapseInfo=true)
Saves important simulation and network infos to file.
Definition: carlsim.cpp:1922
CARLsim::getNumGroups
int getNumGroups()
returns the number of groups in the network
Definition: carlsim.cpp:2043
callback.h
GroupSTDPInfo_s
A struct for retrieving STDP related information of a group.
Definition: carlsim_datastructures.h:411
CARLsim::setLogFile
void setLogFile(const std::string &fileName)
Sets the name of the log file.
Definition: carlsim.cpp:1927
CARLsim::setDefaultSTDPparams
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, STDPType stdpType)
sets default STDP params
Definition: carlsim.cpp:2127
CARLsim::setHomeoBaseFiringRate
void setHomeoBaseFiringRate(int grpId, float baseFiring, float baseFiringSD=0.0f)
Sets the homeostatic target firing rate (enforced through homeostatic synaptic scaling)
Definition: carlsim.cpp:1805
PulseCurve
struct to assign a pulse I-STDP curve
Definition: carlsim_datastructures.h:649
CARLsim::setGroupMonitor
GroupMonitor * setGroupMonitor(int grpId, const std::string &fname)
Sets a group monitor for a group, custom GroupMonitor class.
Definition: carlsim.cpp:1962
PoissonRate
Class for generating Poisson spike trains.
Definition: poisson_rate.h:84
CARLsim::setConnectionMonitor
ConnectionMonitor * setConnectionMonitor(int grpIdPre, int grpIdPost, const std::string &fname)
Sets a connection monitor for a group, custom ConnectionMonitor class.
Definition: carlsim.cpp:1949
linear_algebra.h
CARLsim::getNumNeuronsRegInh
int getNumNeuronsRegInh()
returns the total number of regular (Izhikevich) inhibitory neurons
Definition: carlsim.cpp:2055
CARLsim::getGroupStartNeuronId
int getGroupStartNeuronId(int grpId)
returns the first neuron id of a groupd specified by grpId
Definition: carlsim.cpp:2070
USER
@ USER
User mode, for experiment-oriented simulations.
Definition: carlsim_datastructures.h:91
CARLsim::getConductanceGABAa
std::vector< float > getConductanceGABAa(int grpId)
gets GABAa vector of a group
Definition: carlsim.cpp:2007
CARLsim::setSpikeRate
void setSpikeRate(int grpId, PoissonRate *spikeRate, int refPeriod=1)
Sets a spike rate.
Definition: carlsim.cpp:1982
CARLsim::setWeight
void setWeight(short int connId, int neurIdPre, int neurIdPost, float weight, bool updateWeightRange=false)
Sets the weight value of a specific synapse.
Definition: carlsim.cpp:1987
CARLsim::setSpikeGenerator
void setSpikeGenerator(int grpId, SpikeGenerator *spikeGenFunc)
A SpikeCounter keeps track of the number of spikes per neuron in a group.
Definition: carlsim.cpp:1967
CARLsim::setDefaultISTDPparams
void setDefaultISTDPparams(float betaLTP, float betaLTD, float lambda, float delta, STDPType stdpType)
sets default values for I-STDP params
Definition: carlsim.cpp:2137
CARLsim::getConductanceAMPA
std::vector< float > getConductanceAMPA(int grpId)
gets AMPA vector of a group
Definition: carlsim.cpp:2001
CARLsim::isExcitatoryGroup
bool isExcitatoryGroup(int grpId)
returns
Definition: carlsim.cpp:2104
TimingBasedCurve
A struct to assign a timing-based E-STDP curve.
Definition: carlsim_datastructures.h:613
CARLsim::getLogFpErr
const FILE * getLogFpErr()
returns file pointer to error log
Definition: carlsim.cpp:1917
group_monitor.h
CARLsim::setupNetwork
void setupNetwork()
build the network
Definition: carlsim.cpp:1914
CARLsim::getGroupSTDPInfo
GroupSTDPInfo getGroupSTDPInfo(int grpId)
returns the stdp information of a group specified by grpId
Definition: carlsim.cpp:2079
CARLsim::setISTDP
void setISTDP(int grpId, bool isSet)
Sets default I-STDP mode and parameters.
Definition: carlsim.cpp:1880
RangeDelay
a range struct for synaptic delays
Definition: carlsim_datastructures.h:278
CARLsim::setNeuronParameters
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.
Definition: carlsim.cpp:1815
CARLsim::setIntegrationMethod
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
Definition: carlsim.cpp:1809
CARLsim::setHomeostasis
void setHomeostasis(int grpId, bool isSet, float homeoScale, float avgTimeScale)
Sets custom values for implementation of homeostatic synaptic scaling.
Definition: carlsim.cpp:1799
CARLsim::getDelayRange
RangeDelay getDelayRange(short int connId)
returns the RangeDelay struct for a specific connection ID
Definition: carlsim.cpp:2013
GroupMonitor
Class GroupMonitor.
Definition: group_monitor.h:103
CARLsim::getConductanceNMDA
std::vector< float > getConductanceNMDA(int grpId)
gets NMDA vector of a group
Definition: carlsim.cpp:2004
connection_monitor.h
CARLsim::getDelays
uint8_t * getDelays(int gIDpre, int gIDpost, int &Npre, int &Npost)
gets delays
Definition: carlsim.cpp:2016
CARLsim::setSTDP
void setSTDP(int grpId, bool isSet)
Sets default STDP mode and params.
Definition: carlsim.cpp:1857
CARLsim::getNumSynapticConnections
int getNumSynapticConnections(short int connectionId)
returns the number of connections associated with a connection ID
Definition: carlsim.cpp:2040
ComputingBackend
ComputingBackend
computing backend
Definition: carlsim_datastructures.h:147
CARLsim::getLogFpInf
const FILE * getLogFpInf()
returns file pointer to info log
Definition: carlsim.cpp:1916
CARLsim::isInhibitoryGroup
bool isInhibitoryGroup(int grpId)
returns
Definition: carlsim.cpp:2106
CPU_MODE
@ CPU_MODE
model is run on CPU core(s)
Definition: carlsim_datastructures.h:114
CARLsim::getSpikeMonitor
SpikeMonitor * getSpikeMonitor(int grpId)
Returns the number of spikes per neuron for a certain group.
Definition: carlsim.cpp:2093
neuron_monitor.h
CARLsim::getSimTimeSec
int getSimTimeSec()
returns
Definition: carlsim.cpp:2088
CARLsim
CARLsim User Interface This class provides a user interface to the public sections of CARLsimCore sou...
Definition: carlsim.h:137
CARLsim::getWeightRange
RangeWeight getWeightRange(short int connId)
returns the RangeWeight struct for a specific connection ID
Definition: carlsim.cpp:2096
poisson_rate.h
Point3D
a point in 3D space
Definition: linear_algebra.h:57
ExpCurve
A struct to assign exponential STDP curves.
Definition: carlsim_datastructures.h:570
CARLsim::connect
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 value...
Definition: carlsim.cpp:1739
CARLsim::isGroupWithHomeostasis
bool isGroupWithHomeostasis(int grpId)
Returns whether a group has homeostasis enabled.
Definition: carlsim.cpp:2102
Grid3D
A struct to arrange neurons on a 3D grid (a primitive cubic Bravais lattice with cubic side length 1)
Definition: carlsim_datastructures.h:489
CARLsim::setESTDP
void setESTDP(int grpId, bool isSet)
Sets default E-STDP mode and parameters.
Definition: carlsim.cpp:1867
CARLsim::getGroupGrid3D
Grid3D getGroupGrid3D(int grpId)
returns the 3D grid struct of a group
Definition: carlsim.cpp:2021
CARLsim::getCARLsimState
CARLsimState getCARLsimState()
Writes population weights from gIDpre to gIDpost to file fname in binary.
Definition: carlsim.cpp:1998
LoggerMode
LoggerMode
Logger modes.
Definition: carlsim_datastructures.h:90
CARLsim::getNumNeuronsGenExc
int getNumNeuronsGenExc()
returns the total number of excitatory spike generator neurons
Definition: carlsim.cpp:2061
SpikeGenerator
Definition: callback.h:63
RangeRmem
Struct defines the minimum and maximum membrane resisatnces of the LIF neuron group.
Definition: carlsim_datastructures.h:379
CARLsim::getGroupNumNeurons
int getGroupNumNeurons(int grpId)
returns the number of neurons of a group specified by grpId
Definition: carlsim.cpp:2076
NeuronMonitor
Definition: neuron_monitor.h:58
SYN_FIXED
#define SYN_FIXED
Definition: carlsim_definitions.h:59
CARLsim::setNeuronMonitor
NeuronMonitor * setNeuronMonitor(int grpId, const std::string &fileName)
Sets a Neuron Monitor for a groups, print voltage, recovery, and total current values to binary file.
Definition: carlsim.cpp:1977
CARLsim::CARLsim
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,...
Definition: carlsim.cpp:1734
ConnectionMonitor
Class ConnectionMonitor.
Definition: connection_monitor.h:148
CARLsim::isPoissonGroup
bool isPoissonGroup(int grpId)
returns
Definition: carlsim.cpp:2108
CARLsim::loadSimulation
void loadSimulation(FILE *fid)
Loads a simulation (and network state) from file. The file pointer fid must point to a valid CARLsim ...
Definition: carlsim.cpp:1941
CARLsim::setDefaultSTPparams
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)
Definition: carlsim.cpp:2142
CARLsim::getNumConnections
int getNumConnections()
Returns the number of connections (pairs of pre-post groups) in the network.
Definition: carlsim.cpp:2035
CARLsim::setLogsFpCustom
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.
Definition: carlsim.cpp:1930
CARLsim::setDefaultHomeostasisParams
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
Sets default homeostasis params.
Definition: carlsim.cpp:2117
GroupNeuromodulatorInfo_s
A struct for retrieving neuromodulator information of a group.
Definition: carlsim_datastructures.h:443
CARLsim::getNumNeuronsGen
int getNumNeuronsGen()
returns the total number of spike generator neurons
Definition: carlsim.cpp:2058
CARLsim::getGroupEndNeuronId
int getGroupEndNeuronId(int grpId)
returns the last neuron id of a groupd specified by grpId
Definition: carlsim.cpp:2073
UpdateInterval
UpdateInterval
Update frequency for weights.
Definition: carlsim_datastructures.h:237
CARLsim::setSpikeMonitor
SpikeMonitor * setSpikeMonitor(int grpId, const std::string &fileName)
Sets a Spike Monitor for a groups, prints spikes to binary file.
Definition: carlsim.cpp:1972
carlsim_definitions.h
CARLsim::getSimTime
int getSimTime()
returns
Definition: carlsim.cpp:2086
CARLsim::setNeuromodulator
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,...
Definition: carlsim.cpp:1845
CARLsim::setWeightAndWeightChangeUpdate
void setWeightAndWeightChangeUpdate(UpdateInterval wtANDwtChangeUpdateInterval, bool enableWtChangeDecay, float wtChangeDecay=0.9f)
Sets the weight and weight change update parameters.
Definition: carlsim.cpp:1901
CARLsim::createGroupLIF
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
Definition: carlsim.cpp:1771
CARLsim::isConnectionPlastic
bool isConnectionPlastic(short int connId)
Returns whether a connection is fixed or plastic.
Definition: carlsim.cpp:2099
RadiusRF
A struct to specify the receptive field (RF) radius in 3 dimensions.
Definition: carlsim_datastructures.h:363
ANY
#define ANY
used for create* method to specify any GPU or a specific GPU
Definition: carlsim_definitions.h:56
CARLsim::getGroupId
int getGroupId(std::string grpName)
finds the ID of the group with name grpName
Definition: carlsim.cpp:2023
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:1763
CARLsim::getMaxNumCompConnections
int getMaxNumCompConnections()
Returns the maximum number of allowed compartmental connections per group.
Definition: carlsim.cpp:2037
CARLsim::getLogFpLog
const FILE * getLogFpLog()
returns file pointer to log file
Definition: carlsim.cpp:1919
STDPType
STDPType
STDP flavors.
Definition: carlsim_datastructures.h:160
CARLsim::getNumNeuronsGenInh
int getNumNeuronsGenInh()
returns the total number of inhibitory spike generator neurons
Definition: carlsim.cpp:2064
CPU_CORES
@ CPU_CORES
Definition: carlsim_datastructures.h:148