Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122145361
neurone.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 16, 03:26
Size
1 KB
Mime Type
text/x-c
Expires
Fri, Jul 18, 03:26 (2 d)
Engine
blob
Format
Raw Data
Handle
27440565
Attached To
R5159 CS116-2017-Romain-GROS
neurone.cpp
View Options
#include "neurone.hpp"
#include "constant.h"
#include <math.h>
#include <vector>
#include <cmath>
Neurone::Neurone() :
membrane_potential_(Standard_potential),clock_rest_time_(0.0), I_ext_(0.0) {}
Neurone::~Neurone()
{}
bool Neurone::update(unsigned int t) {
bool spike(false);
spike=Spike(t);
/// 1) make the neurone spike and set it refractory (if necessary)
double new_potential(0.0);
if(not isInRest()) {
new_potential = exp(-DeltaTime/Tau)*(membrane_potential_);
new_potential += I_ext_*(Resistance)*(1-exp(-DeltaTime/Tau));
/// 2) calculate the new potential
new_potential += outsideInput();
/// 3) add the potential created by other neurones
membrane_potential_=new_potential;
/// 4) update the membrane potential
} else {
membrane_potential_=0.0;
}
buffer_.update();
return spike;
}
double Neurone::getMembranePotential () const {
return membrane_potential_-0.070;
/// -0.070 because we use a 0 origin for the membrane potential
}
bool Neurone::isInRest() {
if (not (clock_rest_time_ <= 0.0)) {
clock_rest_time_-=DeltaTime;
/// retires an unit of time
return true;
}
return false;
}
bool Neurone::Spike(unsigned int t) {
bool spike(false);
if(membrane_potential_ >= Spike_Treshold) {
spikes_times_.push_back(t);
/// stores the spike time
membrane_potential_=Standard_potential;
/// reinitialize the membrane potential
clock_rest_time_=TauR;
/// set the rest time
spike=true;
};
return spike;
}
std::vector<double> Neurone::getSpikeTimes() const {
return spikes_times_;
}
void Neurone::receive(int D) {
buffer_.addValue(D);
}
double Neurone::outsideInput() const {
double input(buffer_.valueFor());
return input;
}
void Neurone::setIext(double I) {
I_ext_=I;
}
Event Timeline
Log In to Comment