Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring #388

Merged
merged 7 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
634 changes: 269 additions & 365 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.

77 changes: 77 additions & 0 deletions efel/cppcore/BasicFeatures.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* 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 "BasicFeatures.h"


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();
}
29 changes: 17 additions & 12 deletions efel/cppcore/LibV3.h → efel/cppcore/BasicFeatures.h
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 @@ -14,22 +14,27 @@
* 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.
*/
*/

#ifndef __LIBV3
#define __LIBV3
#include "mapoperations.h"
#include "Utils.h"

#include <vector>
#include <stdexcept>

using std::vector;

namespace LibV3 {


int depolarized_base(mapStr2intVec& IntFeatureData,
mapStr2doubleVec& DoubleFeatureData,
mapStr2Str& StringData);
}
#endif
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