Skip to content

Commit

Permalink
refactoring into SpikeEvent, SpikeShape, Subthreshold
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed May 1, 2024
1 parent 5f807f7 commit 6b3458b
Show file tree
Hide file tree
Showing 19 changed files with 5,733 additions and 5,137 deletions.
581 changes: 290 additions & 291 deletions docs/source/eFeatures.rst

Large diffs are not rendered by default.

280 changes: 140 additions & 140 deletions efel/DependencyV5.txt

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions efel/cppcore/BasicFeatures.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* Copyright (c) 2015-2024, EPFL/Blue Brain Project
*
* This file is part of eFEL <https://github.com/BlueBrain/eFEL>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3.0 as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


int BasicFeatures::interpolate(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData) {
vector<double> V, T, VIntrpol, TIntrpol, InterpStepVec;
T = getFeature(DoubleFeatureData, "T");
// interp_step is a stimulus independent parameter
int retVal = getParam(DoubleFeatureData, "interp_step", InterpStepVec);
double InterpStep = (retVal <= 0) ? 0.1 : InterpStepVec[0];

try // interpolate V if it's available
{
V = getFeature(DoubleFeatureData, "V");
LinearInterpolation(InterpStep, T, V, TIntrpol, VIntrpol);
setVec(DoubleFeatureData, StringData, "V", VIntrpol);
setVec(DoubleFeatureData, StringData, "T", TIntrpol);
} catch (...) {
return -1; // interpolation failed
}

// also interpolate current if present
vector<double> I, IIntrpol, TIntrpolI;
try {
I = getFeature(DoubleFeatureData, "I");
LinearInterpolation(InterpStep, T, I, TIntrpolI, IIntrpol);
setVec(DoubleFeatureData, StringData, "I", IIntrpol);
setVec(DoubleFeatureData, StringData, "T", TIntrpol);
} catch (...) {
} // pass, it is optional
return 1;
}

// return (possibly interpolate) voltage trace
int BasicFeatures::voltage(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData) {
const vector<double>& v = getFeature(DoubleFeatureData, "V");
setVec(DoubleFeatureData, StringData, "voltage", v);
return v.size();
}

// return (possibly interpolate) current trace
int BasicFeatures::current(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData) {
const vector<double>& i = getFeature(DoubleFeatureData, "I");
setVec(DoubleFeatureData, StringData, "current", i);
return i.size();
}

// return (possibly interpolate) time trace
int BasicFeatures::time(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData, mapStr2Str& StringData) {
const vector<double>& t = getFeature(DoubleFeatureData, "T");
setVec(DoubleFeatureData, StringData, "time", t);
return t.size();
}
40 changes: 40 additions & 0 deletions efel/cppcore/BasicFeatures.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* Copyright (c) 2015-2024, EPFL/Blue Brain Project
*
* This file is part of eFEL <https://github.com/BlueBrain/eFEL>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License version 3.0 as published
* by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "mapoperations.h"
#include "Utils.h"

#include <vector>
#include <stdexcept>

using std::vector;

namespace BasicFeatures {
int interpolate(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData);
int voltage(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData);
int current(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData);
int time(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData);
}
8 changes: 4 additions & 4 deletions efel/cppcore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2015, EPFL/Blue Brain Project
# Copyright (c) 2015-2024, EPFL/Blue Brain Project
#
# This file is part of eFEL <https://github.com/BlueBrain/eFEL>
#
Expand All @@ -24,7 +24,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_BUILD_TYPE Debug)

set(FEATURESRCS Utils.cpp LibV1.cpp LibV2.cpp LibV3.cpp LibV5.cpp
set(FEATURESRCS Utils.cpp BasicFeatures.cpp SpikeEvent.cpp SpikeShape.cpp Subthreshold.cpp
FillFptrTable.cpp DependencyTree.cpp cfeature.cpp
mapoperations.cpp)

Expand All @@ -39,7 +39,7 @@ install(TARGETS efelStatic ARCHIVE DESTINATION lib)
add_library(efel SHARED ${FEATURESRCS})
install(TARGETS efel LIBRARY DESTINATION lib)

install(FILES cfeature.h FillFptrTable.h LibV1.h LibV2.h LibV3.h
LibV5.h mapoperations.h Utils.h DependencyTree.h eFELLogger.h EfelExceptions.h
install(FILES cfeature.h FillFptrTable.h BasicFeatures.h SpikeEvent.h SpikeShape.h
Subthreshold.h mapoperations.h Utils.h DependencyTree.h eFELLogger.h EfelExceptions.h
types.h
DESTINATION include)
Loading

0 comments on commit 6b3458b

Please sign in to comment.