<commit_before>/*
 * CloneLayer.cpp
 *
 *  Created on: May 11, 2011
 *      Author: garkenyon
 */

#include "HyPerLayer.hpp"
#include "GapLayer.hpp"

// GapLayer can be used to implement gap junctions
namespace PV {
GapLayer::GapLayer(const char * name, HyPerCol * hc, LIFGap * originalLayer) :
   HyPerLayer(name, hc, MAX_CHANNELS)
{
   initialize(originalLayer);
}

GapLayer::~GapLayer()
{
    clayer->V = NULL;
}

int GapLayer::initialize(LIFGap * originalLayer)
{
   int status_init = HyPerLayer::initialize(TypeNonspiking);
   this->spikingFlag = false;
   sourceLayer = originalLayer;
   free(clayer->V);
   clayer->V = sourceLayer->getV();
   return status_init;
}

// use LIFGap as source layer instead (LIFGap updates gap juctions more accurately)
#ifdef OBSOLETE
int GapLayer::updateV() {
   pvdata_t * V = getV();
   pvdata_t * GSynExc = getChannel(CHANNEL_EXC);
   pvdata_t exp_deltaT = 1.0f - exp(-this->getParent()->getDeltaTime() / sourceLayer->getLIFParams()->tau);
   for( int k=0; k<getNumNeurons(); k++ ) {
      V[k] += GSynExc[k] * exp_deltaT;  //!!! uses base tau, not the true time-dep tau
   }
   return PV_SUCCESS;
}
#endif


//!!!TODO: add param in LIFGap for spikelet amplitude
int GapLayer::setActivity() {

   HyPerLayer::setActivity();

   // extended activity may not be current but this is alright since only local activity is used
   // !!! will break (non-deterministic) if layers are updated simultaneously--fix is to use datastore
   if (sourceLayer->getSpikingFlag()) { // probably not needed since numActive will be zero for non-spiking
      pvdata_t * sourceActivity = sourceLayer->getCLayer()->activity->data;
      pvdata_t * localActivity = getCLayer()->activity->data;
      unsigned int * activeNdx = sourceLayer->getCLayer()->activeIndices;
      for (unsigned int kActive = 0; kActive < sourceLayer->getCLayer()->numActive; kActive++) {
         int kex = activeNdx[kActive];
         localActivity[kex] += 50 * sourceActivity[kex]; // add 50 mV spike to local membrane potential
      }
   }
   return PV_SUCCESS;
}


} // end namespace PV
<commit_msg>only 'OBSOLETE' the statements within updateV, not updateV<commit_after>/*
 * CloneLayer.cpp
 *
 *  Created on: May 11, 2011
 *      Author: garkenyon
 */

#include "HyPerLayer.hpp"
#include "GapLayer.hpp"

// CloneLayer can be used to implement gap junctions
namespace PV {
GapLayer::GapLayer(const char * name, HyPerCol * hc, LIFGap * originalLayer) :
   HyPerLayer(name, hc, MAX_CHANNELS)
{
   initialize(originalLayer);
}

GapLayer::~GapLayer()
{
    clayer->V = NULL;
}

int GapLayer::initialize(LIFGap * originalLayer)
{
   int status_init = HyPerLayer::initialize(TypeNonspiking);
   this->spikingFlag = false;
   sourceLayer = originalLayer;
   free(clayer->V);
   clayer->V = sourceLayer->getV();
   return status_init;
}

// use LIFGap as source layer instead (LIFGap updates gap juctions more accurately)
int GapLayer::updateV() {
#ifdef OBSOLETE
   pvdata_t * V = getV();
   pvdata_t * GSynExc = getChannel(CHANNEL_EXC);
   pvdata_t exp_deltaT = 1.0f - exp(-this->getParent()->getDeltaTime() / sourceLayer->getLIFParams()->tau);
   for( int k=0; k<getNumNeurons(); k++ ) {
      V[k] += GSynExc[k] * exp_deltaT;  //!!! uses base tau, not the true time-dep tau
#endif
   return PV_SUCCESS;
}

//!!!TODO: add param in LIFGap for spikelet amplitude
int GapLayer::setActivity() {

   HyPerLayer::setActivity(); // this copies the potential into the activity buffer

   // extended activity may not be current but this is alright since only local activity is used
   // !!! will break (non-deterministic) if layers are updated simultaneously--fix is to use datastore
   if (sourceLayer->getSpikingFlag()) { // probably not needed since numActive will be zero for non-spiking
      pvdata_t * sourceActivity = sourceLayer->getCLayer()->activity->data;
      pvdata_t * localActivity = getCLayer()->activity->data;
      unsigned int * activeNdx = sourceLayer->getCLayer()->activeIndices;
      for (unsigned int kActive = 0; kActive < sourceLayer->getCLayer()->numActive; kActive++) {
         int kex = activeNdx[kActive];
         localActivity[kex] += 50 * sourceActivity[kex]; // add 50 mV spike to local membrane potential
      }
   }
   return PV_SUCCESS;
}


} // end namespace PV

{'fraction_non_alphanumeric': 0.12386495925494762, 'fraction_numerical': 0.006519208381839348, 'mean_word_length': 3.794642857142857, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5595369', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1386, 'n_words': 387}