123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // C++ Implementation: simmod_localinh
- //
- // Description:
- //
- //
- // Author: Frank Michler,,, <frank@pc13365>, (C) 2010
- //
- // Copyright: See COPYING file that comes with this distribution
- //
- //
- #include "sys.hpp" // for libcwd
- #include "debug.hpp" // for libcwd
- #include "objsimexception.hpp"
- #include "objsimlibrary.hpp"
- #include "simmod_localinh.hpp"
- SimMod_LocalInh::SimMod_LocalInh(AnyOptionWrapper* _opt)
- : SimModule(_opt), mInhLayer(0), mConInhEx(0), mConExInh(0), mConnectivity(0.5), mNumberOfChanges(0)
- {
- }
- SimMod_LocalInh::~SimMod_LocalInh()
- {
- }
- void SimMod_LocalInh::SetCmdLineOptions()
- {
- myAnyWrap->setOption( "LocInh_Range", 'a', &mRange, 0.08);
- myAnyWrap->setOption( "LocInh_InhExNeuronRatio", 'a', &mInhExNeuronRatio, 1);
- myAnyWrap->setOption( "LocInh_InhExStrength", 'a', &mInhExStrength, 0.2);
- myAnyWrap->setOption( "LocInh_ExInhStrength", 'a', &mExInhStrength, 2.0);
- myAnyWrap->setOption( "LocInh_GlobalExInhStrength", 'a', &mGlobalExInhStrength, 2.0);
- myAnyWrap->setOption( "LocInh_GlobalInhExStrength", 'a', &mGlobalInhExStrength, 2.0);
- }
- layer* SimMod_LocalInh::Setup (SimLoop* _MainSimLoop,
- layer* _ExLayer,
- bool LoadWeights,
- bool VecCon
- )
- {
- MainSimLoop = _MainSimLoop;
- if (!_ExLayer) throw ObjSimException("_ExLayer is NULL");
- // setup InhLayer
- int NExNeurons = _ExLayer->NNeurons();
- int ExNeuronsNx = _ExLayer->NeuronsNx();
- int ExNeuronsNy = _ExLayer->NeuronsNy();
- int NInhNeurons = static_cast<int>(NExNeurons*mInhExNeuronRatio);
- mInhLayer = new DecoLifLayer(NInhNeurons, DecoParaInhibitory);
- mInhLayer->SetupPositions(static_cast<int>(mInhExNeuronRatio*ExNeuronsNx),
- static_cast<int>(mInhExNeuronRatio*ExNeuronsNy),
- true);
- mInhLayer->SetName("LocInh_InhLayer");
- MainSimLoop->AddSimElement(mInhLayer);
-
- // connecting InhLayer to _ExLayer
- mConInhEx = new VecConnection(mInhLayer, _ExLayer, csimInputChannel_GABAa, false);
- mConInhEx->SetName("LocInh_ConInhEx");
- mConInhEx->ConnectSelf(mInhExStrength, 1, 0);
- // mConInhEx->ConnectGaussian(0.01, mInhExStrength, 1,0, true);
- mConInhEx->Save();
- MainSimLoop->AddSimElement(mConInhEx);
- // connecting _ExLayer to InhLayer
- mConExInh = new VecConnection(_ExLayer, mInhLayer, csimInputChannel_NMDA_AMPA, true);
- mConExInh->SetName("LocInh_ConExInh");
- RangeConnectionParameters ConExInhParameter(mRange, mExInhStrength, 1,0, mConnectivity, true);
- //mConExInh->ConnectGaussian(mRange, mExInhStrength, 1,0, true);
- mConExInh->ConnectCircular(ConExInhParameter);
- mConExInh->Save();
- MainSimLoop->AddSimElement(mConExInh);
- }
- void SimMod_LocalInh::changeParameter(ParameterSet * ParaSet)
- {
- TwoParameters<float,float>* RangeAndSetrngth = dynamic_cast<TwoParameters<float,float>* >(ParaSet);
- if (RangeAndSetrngth) {
- RangeConnectionParameters ConExInhParameter(
- RangeAndSetrngth->first,
- RangeAndSetrngth->second,
- 1,
- 0,
- mConnectivity,
- true);
- mConExInh->DeleteSynapseArrays();
- mConExInh->ConnectCircular(ConExInhParameter);
- //mConExInh->Save(mNumberOfChanges++);
- }
- }
|