63 #if defined(WIN32) || defined(WIN64) 67 #define fmin (std::min) 68 #define fmax (std::max) 74 #define isnan(x) _isnan(x) 78 #define isinf(x) (!_finite(x)) 82 #define srand48(x) srand(x) 86 #define drand48() (double(rand())/RAND_MAX) 90 #define INFINITY (DBL_MAX+DBL_MAX) 91 #define NAN (INFINITY-INFINITY) 110 class GroupMonitorCore;
111 class ConnectionMonitorCore;
112 class ConnectionGeneratorCore;
113 class SpikeGeneratorCore;
251 short int connect(
int grpId1,
int grpId2,
const std::string& connType,
const RangeWeight& wt,
float connProb,
253 float mulSynFast=1.0f,
float mulSynSlow=1.0f);
272 bool synWtType=
SYN_FIXED,
int maxM=0,
int maxPreM=0);
289 int createGroup(
const std::string& grpName,
int nNeur,
int neurType);
371 void setConductances(
bool isSet,
int tdAMPA,
int tdNMDA,
int tdGABAa,
int tdGABAb);
393 void setConductances(
bool isSet,
int tdAMPA,
int trNMDA,
int tdNMDA,
int tdGABAa,
int trGABAb,
int tdGABAb);
423 void setHomeostasis(
int grpId,
bool isSet,
float homeoScale,
float avgTimeScale);
493 void setNeuronParameters(
int grpId,
float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
494 float izh_c,
float izh_c_sd,
float izh_d,
float izh_d_sd);
524 float izh_a,
float izh_b,
float izh_vpeak,
float izh_c,
float izh_d);
555 void setNeuronParameters(
int grpId,
float izh_C,
float izh_C_sd,
float izh_k,
float izh_k_sd,
556 float izh_vr,
float izh_vr_sd,
float izh_vt,
float izh_vt_sd,
557 float izh_a,
float izh_a_sd,
float izh_b,
float izh_b_sd,
558 float izh_vpeak,
float izh_vpeak_sd,
float izh_c,
float izh_c_sd,
559 float izh_d,
float izh_d_sd);
587 void setNeuromodulator(
int grpId,
float baseDP,
float tauDP,
float base5HT,
float tau5HT,
588 float baseACh,
float tauACh,
float baseNE,
float tauNE);
599 float tauACh = 100.0f,
float tauNE = 100.0f);
610 void setSTDP(
int grpId,
bool isSet);
621 void setSTDP(
int grpId,
bool isSet,
stdpType_t type,
float alphaPlus,
float tauPlus,
float alphaMinus,
float tauMinus);
632 void setESTDP(
int grpId,
bool isSet);
673 void setISTDP(
int grpId,
bool isSet);
734 void setSTP(
int grpId,
bool isSet,
float STP_U,
float STP_tau_u,
float STP_tau_x);
757 void setSTP(
int grpId,
bool isSet);
781 int runNetwork(
int nSec,
int nMsec=0,
bool printRunSummary=
true,
bool copyState=
false);
815 void saveSimulation(
const std::string& fileName,
bool saveSynapseInfo=
true);
851 void setLogsFpCustom(FILE* fpInf=NULL, FILE* fpErr=NULL, FILE* fpDeb=NULL, FILE* fpLog=NULL);
879 void biasWeights(
short int connId,
float bias,
bool updateWeightRange=
false);
943 void scaleWeights(
short int connId,
float scale,
bool updateWeightRange=
false);
1193 void setWeight(
short int connId,
int neurIdPre,
int neurIdPost,
float weight,
bool updateWeightRange=
false);
1316 uint8_t*
getDelays(
int gIDpre,
int gIDpost,
int& Npre,
int& Npost, uint8_t* delays=NULL);
1787 bool existsGrpId(
int grpId);
1789 void handleUserWarnings();
1791 void printSimulationSpecs();
1796 #if defined(WIN32) || defined(WIN64) 1797 static HANDLE gpuAllocationLock;
1799 static pthread_mutex_t gpuAllocationLock;
1804 std::string netName_;
1813 std::vector<std::vector<int> > connSyn_;
1817 std::vector<std::vector<int> > connComp_;
1819 unsigned int numConnections_;
1820 std::vector<std::string> userWarnings_;
1822 std::vector<int> grpIds_;
1823 std::vector<bool> grpNeurParams_;
1824 std::vector<SpikeGeneratorCore*> spkGen_;
1825 std::vector<ConnectionGeneratorCore*> connGen_;
1827 bool hasSetHomeoALL_;
1828 bool hasSetHomeoBaseFiringALL_;
1829 bool hasSetSTDPALL_;
1831 bool hasSetConductances_;
1843 float def_STDP_alphaLTP_;
1844 float def_STDP_tauLTP_;
1845 float def_STDP_alphaLTD_;
1846 float def_STDP_tauLTD_;
1847 float def_STDP_betaLTP_;
1848 float def_STDP_betaLTD_;
1849 float def_STDP_lambda_;
1850 float def_STDP_delta_;
1853 float def_STP_U_exc_;
1854 float def_STP_tau_u_exc_;
1855 float def_STP_tau_x_exc_;
1856 float def_STP_U_inh_;
1857 float def_STP_tau_u_inh_;
1858 float def_STP_tau_x_inh_;
1861 float def_homeo_scale_;
1862 float def_homeo_avgTimeScale_;
1865 std::string def_save_fileName_;
1866 bool def_save_synapseInfo_;
Class for generating Poisson spike trains.
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.
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...
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 ...
void setDefaultHomeostasisParams(float homeoScale, float avgTimeScale)
Sets default homeostasis params.
void startTesting(bool updateWeights=true)
Enters a testing phase in which all weight changes are disabled.
int getGroupEndNeuronId(int grpId)
returns the last neuron id of a groupd specified by grpId
const FILE * getLogFpErr()
returns file pointer to error log
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 setCompartmentParameters(int grpId, float couplingUp, float couplingDown)
Sets coupling constants G_u and G_d for hte compartment.
void setDefaultSTDPparams(float alphaPlus, float tauPlus, float alphaMinus, float tauMinus, stdpType_t stdpType)
sets default STDP params
void stopTesting()
Exits a testing phase, making weight changes possible again.
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.
void setIntegrationMethod(integrationMethod_t method, int numStepsPerMs)
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
int getMaxNumCompConnections()
Returns the maximum number of allowed compartmental connections per group.
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.
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
integrationMethod_t
Integration methods.
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...
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)
Writes population weights from gIDpre to gIDpost to file fname in binary.
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
bool isConnectionPlastic(short int connId)
Returns whether a connection is fixed or plastic.
short int connectCompartments(int grpIdLower, int grpIdUpper)
make a compartmental connection between two compartmentally enabled groups
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 > ¤t)
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.
bool isGroupWithHomeostasis(int grpId)
Returns whether a group has homeostasis enabled.