Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120472207
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
Fri, Jul 4, 15:25
Size
1 KB
Mime Type
text/x-c
Expires
Sun, Jul 6, 15:25 (2 d)
Engine
blob
Format
Raw Data
Handle
27193765
Attached To
R5159 CS116-2017-Romain-GROS
neurone.cpp
View Options
#include "neurone.hpp"
#include "constant.h"
#include <iomanip>
#include <vector>
#include <cmath>
Neurone::Neurone() :
membrane_potential_(Standard_potential),rest_time_(0.0), J_(Standard_potential) {}
void Neurone::update(double const Input_current, double time_i) {
double new_potential(0.0);
if(not isInRest()) {
new_potential = exp(-DeltaTime/Tau)*(membrane_potential_);
new_potential += Input_current*(Resistance)*(1-exp(-DeltaTime/Tau));
/// 1) calculate the new potential
if(time_i > J_time_) {
new_potential += J_;
J_=0.0;
}
membrane_potential_=new_potential;
/// 2) update the membrane potential
}
}
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 (rest_time_ <= 0.0)) {
rest_time_-=DeltaTime;
/// retires an unit of time
return true;
}
return false;
}
bool Neurone::Spike(double time_i) {
if(membrane_potential_ >= Spike_Treshold) {
spikes_times_.push_back(time_i);
/// stores the spike time
membrane_potential_=Standard_potential;
/// reinitialize the membrane potential
rest_time_=TauR;
/// set the rest time
return true;
};
return false;
}
std::vector<double> Neurone::getSpikeTimes() const {
return spikes_times_;
}
void Neurone::Receive(double time_eff, double J) {
J_=J;
J_time_=time_eff;
}
/*void Neurone::print(std::ofstream& donnees, int time) {
donnees << std::setw(20) << membrane_potential_*mV;
donnees << std::setw(20) << (time+1)*DeltaTime*ms << std::endl;
}*/
Event Timeline
Log In to Comment