10 #include "CsNeuralModule.h"
11 #include "CsSpikeGeneratorGroup.h"
26 m_bStimWholePopulation =
true;
44 {
Std_TraceMsg(0,
"Caught Error in desctructor of CsAdapter\r\n",
"", -1,
false,
true);}
47 void CsAdapter::Coverage(std::string strType)
50 if(strVal ==
"INDIVIDUALS")
51 m_bStimWholePopulation =
false;
52 else if(strVal ==
"WHOLEPOPULATION")
53 m_bStimWholePopulation =
true;
55 THROW_PARAM_ERROR(Cs_Err_lInvalidFiringRateCoverage, Cs_Err_strInvalidFiringRateCoverage,
"Coverage", strType);
58 bool CsAdapter::StimWholePopulation() {
return m_bStimWholePopulation;}
60 void CsAdapter::StimWholePopulation(
bool bVal) {m_bStimWholePopulation = bVal;}
62 void CsAdapter::CellsToStim(std::string strXml)
65 oXml.Deserialize(strXml);
66 oXml.FindElement(
"Root");
67 oXml.FindChildElement(
"Cells");
69 LoadCellsToStim(oXml);
74 Adapter::Initialize();
78 THROW_PARAM_ERROR(Cs_Err_lNotSpikeGeneratorType, Cs_Err_strNotSpikeGeneratorType,
"ID: ",
m_strTargetID);
84 bool CsAdapter::RateChanged(
float fltRate)
92 void CsAdapter::ApplyExternalNodeInput(
int iTargetDataType,
float fltRate)
96 if(m_bStimWholePopulation)
98 for(
int iIdx=0; iIdx<
m_lpSpikeGen->NeuronCount(); iIdx++)
110 int iIdx = (*ii).first;
111 if(iIdx >= 0 && iIdx < m_lpSpikeGen->NeuronCount())
129 Adapter::ResetSimulation();
133 bool CsAdapter::SetData(
const std::string &strDataType,
const std::string &strValue,
bool bThrowError)
137 if(Adapter::SetData(strDataType, strValue,
false))
140 if(strType ==
"COVERAGE")
146 if(strType ==
"CELLSTOSTIM")
148 CellsToStim(strValue);
154 THROW_PARAM_ERROR(Al_Err_lInvalidDataType, Al_Err_strInvalidDataType,
"Data Type", strDataType);
159 void CsAdapter::QueryProperties(CStdPtrArray<TypeProperty> &aryProperties)
161 Adapter::QueryProperties(aryProperties);
163 aryProperties.Add(
new TypeProperty(
"Coverage", AnimatPropertyType::String, AnimatPropertyDirection::Set));
164 aryProperties.Add(
new TypeProperty(
"CellsToStim", AnimatPropertyType::Xml, AnimatPropertyDirection::Set));
167 void CsAdapter::LoadCellsToStim(CStdXml &oXml)
171 int iCount = oXml.NumberOfChildren();
172 for(
int iIdx=0; iIdx<iCount; iIdx++)
174 oXml.FindChildByIndex(iIdx);
175 int iNeuronIdx = oXml.GetChildInt();
178 THROW_PARAM_ERROR(Cs_Err_lInvalidNeuralIndex, Cs_Err_strInvalidNeuralIndex,
"Neuron Index", iNeuronIdx);
186 void CsAdapter::Load(CStdXml &oXml)
192 Coverage(oXml.GetChildString(
"Coverage",
"WholePopulation"));
194 if(oXml.FindChildElement(
"Cells",
false))
195 LoadCellsToStim(oXml);
Contains the classes for a firing rate neural model.
CsSpikeGeneratorGroup * m_lpSpikeGen
The spike generator this adapter is stimulating.
Declares the CsNeuronGroup class.
virtual void Initialize()
Initializes this object.
std::string m_strTargetID
GUID ID of the target node.
Node * m_lpTargetNode
Pointer to the target node.
virtual void ResetSimulation()
Resets the simulation back to time 0.
CStdMap< int, int > m_aryCellsToStim
An array of neuron indices for individual neurons we want to stimulate.
virtual ~CsAdapter()
Destructor.
Declares the current stimulus class.
Declares the synapse class.
void Std_TraceMsg(const int iLevel, std::string strMessage, std::string strSourceFile, int iSourceLine, bool bLogToFile, bool bPrintHeader)
Traces a message to the debugger window.
float m_fltPrevAppliedRate
Last applied rate.
virtual bool SetData(const std::string &strDataType, const std::string &strValue, bool bThrowError=true)
Set a variable based on a string data type name.
std::string Std_CheckString(std::string strVal)
Converts a string to upper case and trims it.
CsAdapter()
Default constructor.
Firing Rate Neuron model.