From 72922b2b22a0b0c5f17cf833cede690353b7e865 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 10:53:33 -0500 Subject: [PATCH 01/76] testing branch --- test.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.md diff --git a/test.md b/test.md new file mode 100644 index 0000000..f58162e --- /dev/null +++ b/test.md @@ -0,0 +1 @@ +this should be in rtxi-plugin branch. From 5d2a612d2098318ff04f12299dce5dccedf92f74 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 11:21:54 -0500 Subject: [PATCH 02/76] RTXI user manual code added --- include/lfpRatiometer.h | 19 +++++++- src/lfpRatiometer.cpp | 100 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 116 insertions(+), 3 deletions(-) diff --git a/include/lfpRatiometer.h b/include/lfpRatiometer.h index 414029f..4de2247 100644 --- a/include/lfpRatiometer.h +++ b/include/lfpRatiometer.h @@ -1,6 +1,8 @@ #ifndef LFPRATIOMETER_H #define LFPRATIOMETER_H +#include + #include #include #include @@ -11,7 +13,10 @@ #include -class lfpRatiometer { +class lfpRatiometer : public DefaultGUIModel { + + Q_OBJECT + public: // constructor lfpRatiometer(int N_input, double sampling_input); @@ -21,9 +26,16 @@ class lfpRatiometer { // execute void execute(); + + // functions to make GUI + void createGUI(DefaultGUIModel::variable_t*, int); + void customizeGUI(void); protected: + // update function + virtual void update(DefaultGUIModel::update_flags_t) + private: int N; // time window in samples @@ -69,8 +81,13 @@ class lfpRatiometer { } } + void initParameters(); void makePSD(); void getRatio(); + + private slots: + void aBttn_event(void); + void bBttn_event(void); }; diff --git a/src/lfpRatiometer.cpp b/src/lfpRatiometer.cpp index 627b070..0b91839 100644 --- a/src/lfpRatiometer.cpp +++ b/src/lfpRatiometer.cpp @@ -1,11 +1,47 @@ #include +#include using namespace std; +extern "C" Plugin::Object *createRTXIPlugin(void){ + int N = 10; + double sampling = 200; + return new lfpRatiometer(N, sampling); +} + +static DefaultGUIModel::variable_t vars[] = { + { + "GUI label", "Tooltip description", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, +{ + "input_LFP", "Input LFP", + DefaultGUIModel::INPUT | DefaultGUIModel::DOUBLE, + }, +{ + "ratio", "Output LFP Power Ratio", + DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, + }, +{ + "A State", "Tooltip description", DefaultGUIModel::STATE, + }, +}; + +static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor // user defines time window length (in samples) and sampling rate -lfpRatiometer::lfpRatiometer(int N_input, double sampling_input) { +lfpRatiometer::lfpRatiometer(int N_input, double sampling_input) + : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) +{ + setWhatsThis("

lfpRatiometer:
QWhatsThis description.

"); + DefaultGUIModel::createGUI(vars, num_vars); + customizeGUI(); + initParameters(); + update(INIT); + refresh(); + QTimer::singleShot(0, this, SLOT(resizeMe())); + // setting user defined variables N=N_input; f_size=N/2 + 1; @@ -127,4 +163,64 @@ void lfpRatiometer::getRatio() { // take ratio lf_hf_ratio = lf_total/hf_total; -} \ No newline at end of file +} + +// RTXI function for initializing parameters +void lfpRatiometer::initParameters(void) +{ + some_parameter = 0; + some_state = 0; +} + +// update function (not running in real time) +void lfpRatiometer::update(DefaultGUIModel::update_flags_t flag) +{ + switch (flag) { + case INIT: + period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + setParameter("GUI label", some_parameter); + setState("A State", some_state); + break; + + case MODIFY: + some_parameter = getParameter("GUI label").toDouble(); + break; + + case UNPAUSE: + break; + + case PAUSE: + break; + + case PERIOD: + period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + break; + + default: + break; + } +} + +// RTXI's customizeGUI function +void lfpRatiometer::customizeGUI(void) +{ + QGridLayout* customlayout = DefaultGUIModel::getLayout(); + + QGroupBox* button_group = new QGroupBox; + + QPushButton* abutton = new QPushButton("Button A"); + QPushButton* bbutton = new QPushButton("Button B"); + QHBoxLayout* button_layout = new QHBoxLayout; + button_group->setLayout(button_layout); + button_layout->addWidget(abutton); + button_layout->addWidget(bbutton); + QObject::connect(abutton, SIGNAL(clicked()), this, SLOT(aBttn_event())); + QObject::connect(bbutton, SIGNAL(clicked()), this, SLOT(bBttn_event())); + + customlayout->addWidget(button_group, 0, 0); + setLayout(customlayout); +} + +void lfpRatiometer::aBttn_event(void) { } + +void lfpRatiometer::bBttn_event(void) { } \ No newline at end of file From e0474c657b0b361783676d403828d80dca1b5d4e Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 12:42:11 -0500 Subject: [PATCH 03/76] RTXI-specific makefile added --- Makefile | 16 +++++++++------- src/lfpRatiometer.cpp | 42 ++++++++++++++++-------------------------- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/Makefile b/Makefile index 7a8b267..0b7ca96 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ -CXX=g++ -CXX_FLAGS=-std=c++11 -Iinclude +PLUGIN_NAME = lfpRatiometer -LD_FLAGS=-lfftw3 -lm +HEADERS = lfpRatiometer.h -all: build/lfpRatiometer.o - $(CXX) $(CXX_FLAGS) -o build/test src/main.cpp build/lfpRatiometer.o $(LD_FLAGS) +SOURCES = lfpRatiometer.cpp \ + moc_lfpRatiometer.cpp -build/lfpRatiometer.o: - $(CXX) $(CXX_FLAGS) -o build/lfpRatiometer.o -c src/lfpRatiometer.cpp +LIBS = -lfftw3 -lm + +### Do note edit below this line ### + +include $(shell rtxi_plugin_config --pkgdata-dir)/Makefile.plugin_compile \ No newline at end of file diff --git a/src/lfpRatiometer.cpp b/src/lfpRatiometer.cpp index 0b91839..184131e 100644 --- a/src/lfpRatiometer.cpp +++ b/src/lfpRatiometer.cpp @@ -70,18 +70,6 @@ lfpRatiometer::lfpRatiometer(int N_input, double sampling_input) // FFTW_MEASURE makes initialization long for faster... // calculations p = fftw_plan_dft_r2c_1d(N,in,out,FFTW_MEASURE); - - // tmp - for (int j=0; j N) { + // cut it to size + in_raw.erase(in_raw.begin()); + + // run our LF/HF analysis + makePSD(); + getRatio(); - cout << "LF/HF Ratio: " << lf_hf_ratio << "\n"; + // output the calculated lf_hf_ratio + output(0) = lf_hf_ratio; + + } + } // function that calculates the power spectral density From 37a3a0bc74b1421e28415ed02950f2ac0d4b6e72 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 12:52:11 -0500 Subject: [PATCH 04/76] consolidate directories --- src/lfpRatiometer.cpp => lfpRatiometer.cpp | 0 include/lfpRatiometer.h => lfpRatiometer.h | 0 src/main.cpp | 11 ----------- 3 files changed, 11 deletions(-) rename src/lfpRatiometer.cpp => lfpRatiometer.cpp (100%) rename include/lfpRatiometer.h => lfpRatiometer.h (100%) delete mode 100644 src/main.cpp diff --git a/src/lfpRatiometer.cpp b/lfpRatiometer.cpp similarity index 100% rename from src/lfpRatiometer.cpp rename to lfpRatiometer.cpp diff --git a/include/lfpRatiometer.h b/lfpRatiometer.h similarity index 100% rename from include/lfpRatiometer.h rename to lfpRatiometer.h diff --git a/src/main.cpp b/src/main.cpp deleted file mode 100644 index 1f0a4f1..0000000 --- a/src/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include - -int main () { - int N = 10; - double sampling = 200; - lfpRatiometer lfpratiometer(N, sampling); - lfpratiometer.execute(); - - return 0; - -} \ No newline at end of file From d2ee23ad0636956961785532c7eb3385a6e2845b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 13:07:04 -0500 Subject: [PATCH 05/76] edited makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0b7ca96..f00385a 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ HEADERS = lfpRatiometer.h SOURCES = lfpRatiometer.cpp \ moc_lfpRatiometer.cpp -LIBS = -lfftw3 -lm +LIBS = -L/usr/lib/x86_64-linux-gnu -lfftw3 -lm ### Do note edit below this line ### From ad7bce97abf25a363a93d70e155e3fd6e3d046e7 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 13:47:32 -0500 Subject: [PATCH 06/76] edited makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f00385a..0b7ca96 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ HEADERS = lfpRatiometer.h SOURCES = lfpRatiometer.cpp \ moc_lfpRatiometer.cpp -LIBS = -L/usr/lib/x86_64-linux-gnu -lfftw3 -lm +LIBS = -lfftw3 -lm ### Do note edit below this line ### From afc09ad0b5a813acd465698b2dbcf2367041733b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 13:56:23 -0500 Subject: [PATCH 07/76] fixed missing declarations --- lfpRatiometer.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lfpRatiometer.h b/lfpRatiometer.h index 4de2247..fd7f44c 100644 --- a/lfpRatiometer.h +++ b/lfpRatiometer.h @@ -34,9 +34,14 @@ class lfpRatiometer : public DefaultGUIModel { protected: // update function - virtual void update(DefaultGUIModel::update_flags_t) + virtual void update(DefaultGUIModel::update_flags_t); private: + // RTXI complains without these + double some_parameter; + double some_state; + double period; + void initParameters(); int N; // time window in samples int f_size; // nonredundant size of DFT @@ -81,7 +86,6 @@ class lfpRatiometer : public DefaultGUIModel { } } - void initParameters(); void makePSD(); void getRatio(); From ffbdf275507e48755fc86e2d0ef7adc596b2ba2f Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 3 Mar 2021 14:35:19 -0500 Subject: [PATCH 08/76] changing parameters --- lfpRatiometer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lfpRatiometer.cpp b/lfpRatiometer.cpp index 184131e..8cd1c8c 100644 --- a/lfpRatiometer.cpp +++ b/lfpRatiometer.cpp @@ -4,8 +4,8 @@ using namespace std; extern "C" Plugin::Object *createRTXIPlugin(void){ - int N = 10; - double sampling = 200; + int N = 2000; + double sampling = 2000; return new lfpRatiometer(N, sampling); } From 674c97169bd146054254e8972f1c279bc2924631 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Thu, 18 Mar 2021 19:34:44 -0400 Subject: [PATCH 09/76] updated to work with updated lfp-cpp-library --- Makefile | 8 +- lfpRatiometer.cpp | 216 ----------------------------------------- lfpRatiometer.h | 100 ------------------- rtxi-lfpRatiometer.cpp | 119 +++++++++++++++++++++++ rtxi-lfpRatiometer.h | 51 ++++++++++ 5 files changed, 174 insertions(+), 320 deletions(-) delete mode 100644 lfpRatiometer.cpp delete mode 100644 lfpRatiometer.h create mode 100644 rtxi-lfpRatiometer.cpp create mode 100644 rtxi-lfpRatiometer.h diff --git a/Makefile b/Makefile index 0b7ca96..ec0b873 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ -PLUGIN_NAME = lfpRatiometer +PLUGIN_NAME = rtxilfpRatiometer -HEADERS = lfpRatiometer.h +HEADERS = rtxilfpRatiometer.h -SOURCES = lfpRatiometer.cpp \ - moc_lfpRatiometer.cpp +SOURCES = rtxolfpRatiometer.cpp \ + moc_rtxilfpRatiometer.cpp LIBS = -lfftw3 -lm diff --git a/lfpRatiometer.cpp b/lfpRatiometer.cpp deleted file mode 100644 index 8cd1c8c..0000000 --- a/lfpRatiometer.cpp +++ /dev/null @@ -1,216 +0,0 @@ -#include -#include - -using namespace std; - -extern "C" Plugin::Object *createRTXIPlugin(void){ - int N = 2000; - double sampling = 2000; - return new lfpRatiometer(N, sampling); -} - -static DefaultGUIModel::variable_t vars[] = { - { - "GUI label", "Tooltip description", - DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, - }, -{ - "input_LFP", "Input LFP", - DefaultGUIModel::INPUT | DefaultGUIModel::DOUBLE, - }, -{ - "ratio", "Output LFP Power Ratio", - DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, - }, -{ - "A State", "Tooltip description", DefaultGUIModel::STATE, - }, -}; - -static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); - -// defining what's in the object's constructor -// user defines time window length (in samples) and sampling rate -lfpRatiometer::lfpRatiometer(int N_input, double sampling_input) - : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) -{ - setWhatsThis("

lfpRatiometer:
QWhatsThis description.

"); - DefaultGUIModel::createGUI(vars, num_vars); - customizeGUI(); - initParameters(); - update(INIT); - refresh(); - QTimer::singleShot(0, this, SLOT(resizeMe())); - - // setting user defined variables - N=N_input; - f_size=N/2 + 1; - sampling=sampling_input; - - // setting default variables - lf_low = 1; - lf_high = 25; - hf_low = 30; - hf_high = 90; - - // setting default window - window_hamming(); - - // establishing frequencies that will be associated with DFT output - for (int n=0; n N) { - // cut it to size - in_raw.erase(in_raw.begin()); - - // run our LF/HF analysis - makePSD(); - getRatio(); - - // output the calculated lf_hf_ratio - output(0) = lf_hf_ratio; - - } - -} - -// function that calculates the power spectral density -void lfpRatiometer::makePSD() { - psd.clear(); // clear vector which stores PSD - - // applying window - for (int n=0; n= lf_low && allfreqs.at(n) <= lf_high) { - lf_total = lf_total + psd.at(n); - } - if (allfreqs.at(n) >= hf_low && allfreqs.at(n) <= hf_high){ - hf_total = hf_total + psd.at(n); - } - } - - // take ratio - lf_hf_ratio = lf_total/hf_total; -} - -// RTXI function for initializing parameters -void lfpRatiometer::initParameters(void) -{ - some_parameter = 0; - some_state = 0; -} - -// update function (not running in real time) -void lfpRatiometer::update(DefaultGUIModel::update_flags_t flag) -{ - switch (flag) { - case INIT: - period = RT::System::getInstance()->getPeriod() * 1e-6; // ms - setParameter("GUI label", some_parameter); - setState("A State", some_state); - break; - - case MODIFY: - some_parameter = getParameter("GUI label").toDouble(); - break; - - case UNPAUSE: - break; - - case PAUSE: - break; - - case PERIOD: - period = RT::System::getInstance()->getPeriod() * 1e-6; // ms - break; - - default: - break; - } -} - -// RTXI's customizeGUI function -void lfpRatiometer::customizeGUI(void) -{ - QGridLayout* customlayout = DefaultGUIModel::getLayout(); - - QGroupBox* button_group = new QGroupBox; - - QPushButton* abutton = new QPushButton("Button A"); - QPushButton* bbutton = new QPushButton("Button B"); - QHBoxLayout* button_layout = new QHBoxLayout; - button_group->setLayout(button_layout); - button_layout->addWidget(abutton); - button_layout->addWidget(bbutton); - QObject::connect(abutton, SIGNAL(clicked()), this, SLOT(aBttn_event())); - QObject::connect(bbutton, SIGNAL(clicked()), this, SLOT(bBttn_event())); - - customlayout->addWidget(button_group, 0, 0); - setLayout(customlayout); -} - -void lfpRatiometer::aBttn_event(void) { } - -void lfpRatiometer::bBttn_event(void) { } \ No newline at end of file diff --git a/lfpRatiometer.h b/lfpRatiometer.h deleted file mode 100644 index fd7f44c..0000000 --- a/lfpRatiometer.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef LFPRATIOMETER_H -#define LFPRATIOMETER_H - -#include - -#include -#include -#include -#include - -#include -#include - -#include - -class lfpRatiometer : public DefaultGUIModel { - - Q_OBJECT - - public: - // constructor - lfpRatiometer(int N_input, double sampling_input); - - // destructor - ~lfpRatiometer(void); - - // execute - void execute(); - - // functions to make GUI - void createGUI(DefaultGUIModel::variable_t*, int); - void customizeGUI(void); - - protected: - - // update function - virtual void update(DefaultGUIModel::update_flags_t); - - private: - // RTXI complains without these - double some_parameter; - double some_state; - double period; - void initParameters(); - - int N; // time window in samples - int f_size; // nonredundant size of DFT - double sampling; // sampling rate (Hz) - double *in; // pointer to (windowed) time series - std::vector in_raw; // vector to hold raw time series - fftw_complex *out; // pointer to DFT - fftw_plan p; // stores FFTW3 plan - - std::vector allfreqs; - std::vector psd; - double lf_hf_ratio; - double lf_low; - double lf_high; - double hf_low; - double hf_high; - - std::vector window; // time domain of window - double s2; // window scaling factor - - // method sets window as rectangle - void window_rect(){ - window.clear(); - s2 = 0; - for (int j=0; j + +using namespace std; + +extern "C" Plugin::Object *createRTXIPlugin(void){ + return new rtxilfpRatiometer(); +} + +static DefaultGUIModel::variable_t vars[] = { + { + "GUI label", "Tooltip description", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, +{ + "input_LFP", "Input LFP", + DefaultGUIModel::INPUT | DefaultGUIModel::DOUBLE, + }, +{ + "ratio", "Output LFP Power Ratio", + DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, + }, +{ + "A State", "Tooltip description", DefaultGUIModel::STATE, + }, +}; + +static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); + +// defining what's in the object's constructor +// user defines time window length (in samples) and sampling rate +rtxilfpRatiometer::rtxilfpRatiometer() : +DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) +lfpratiometer(N, sampling) // constructing lfpRatiometer object +{ + setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); + DefaultGUIModel::createGUI(vars, num_vars); + customizeGUI(); + initParameters(); + update(INIT); + refresh(); + QTimer::singleShot(0, this, SLOT(resizeMe())); +} + +// defining what's in the object's destructor +rtxilfpRatiometer::~rtxilfpRatiometer(void) {} + +// real-time RTXI function +void rtxilfpRatiometer::execute() { + + // push new time series reading to lfpRatiometer + lfpratiometer.pushTimeSample(input(0)) + + // calculate LF/HF ratio + lfpratiometer.calcRatio(); + + // put the LF/HF ratio into the output + output(0) = lfpratiometer.getRatio(); + +} + +// RTXI function for initializing parameters +void lfpRatiometer::initParameters(void) +{ + some_parameter = 0; + some_state = 0; +} + +// update function (not running in real time) +void lfpRatiometer::update(DefaultGUIModel::update_flags_t flag) +{ + switch (flag) { + case INIT: + period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + setParameter("GUI label", some_parameter); + setState("A State", some_state); + break; + + case MODIFY: + some_parameter = getParameter("GUI label").toDouble(); + break; + + case UNPAUSE: + break; + + case PAUSE: + break; + + case PERIOD: + period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + break; + + default: + break; + } +} + +// RTXI's customizeGUI function +void lfpRatiometer::customizeGUI(void) +{ + QGridLayout* customlayout = DefaultGUIModel::getLayout(); + + QGroupBox* button_group = new QGroupBox; + + QPushButton* abutton = new QPushButton("Button A"); + QPushButton* bbutton = new QPushButton("Button B"); + QHBoxLayout* button_layout = new QHBoxLayout; + button_group->setLayout(button_layout); + button_layout->addWidget(abutton); + button_layout->addWidget(bbutton); + QObject::connect(abutton, SIGNAL(clicked()), this, SLOT(aBttn_event())); + QObject::connect(bbutton, SIGNAL(clicked()), this, SLOT(bBttn_event())); + + customlayout->addWidget(button_group, 0, 0); + setLayout(customlayout); +} + +void lfpRatiometer::aBttn_event(void) { } + +void lfpRatiometer::bBttn_event(void) { } \ No newline at end of file diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h new file mode 100644 index 0000000..e50f358 --- /dev/null +++ b/rtxi-lfpRatiometer.h @@ -0,0 +1,51 @@ +#ifndef RTXILFPRATIOMETER_H +#define RTXILFPRATIOMETER_H + +#include +#include + +class rtxilfpRatiometer : public DefaultGUIModel { + + Q_OBJECT + + public: + // constructor + rtxilfpRatiometer(); + + // destructor + ~rtxilfpRatiometer(void); + + // execute + void execute(); + + // functions to make GUI + void createGUI(DefaultGUIModel::variable_t*, int); + void customizeGUI(void); + + protected: + + // update function + virtual void update(DefaultGUIModel::update_flags_t); + + private: + // I want to get rid of these + double some_parameter; + double some_state; + double period; + void initParameters(); + + // default parameters for lfpRatiometer object + int N = 2000; + int sampling = 2000; + + // lfpRatiometer object + lfpRatiometer lfpratiometer; + + private slots: + void aBttn_event(void); + void bBttn_event(void); + +}; + + +#endif \ No newline at end of file From 1b5b8d59ac670235ed3983e8e0d6a513b6895390 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Thu, 18 Mar 2021 19:39:23 -0400 Subject: [PATCH 10/76] fixed typo in MakeFile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec0b873..9db68d7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ PLUGIN_NAME = rtxilfpRatiometer HEADERS = rtxilfpRatiometer.h -SOURCES = rtxolfpRatiometer.cpp \ +SOURCES = rtxilfpRatiometer.cpp \ moc_rtxilfpRatiometer.cpp LIBS = -lfftw3 -lm From 60e7d8c9ebdf51da0433d2870ccb5dbeef1ed993 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Thu, 18 Mar 2021 19:41:21 -0400 Subject: [PATCH 11/76] fixed typo in Makefile --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9db68d7..54ba5e1 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ PLUGIN_NAME = rtxilfpRatiometer -HEADERS = rtxilfpRatiometer.h +HEADERS = rtxi-lfpRatiometer.h -SOURCES = rtxilfpRatiometer.cpp \ - moc_rtxilfpRatiometer.cpp +SOURCES = rtxi-lfpRatiometer.cpp \ + moc_rtxi-lfpRatiometer.cpp LIBS = -lfftw3 -lm From b2e16fd5683b4e3a738bb516d8ecbc3ef74783ca Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Thu, 18 Mar 2021 19:46:56 -0400 Subject: [PATCH 12/76] debugging --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index e50f358..c3a0802 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -39,7 +39,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { int sampling = 2000; // lfpRatiometer object - lfpRatiometer lfpratiometer; + lfpRatiometer::lfpRatiometer lfpratiometer; private slots: void aBttn_event(void); From 213a5229d2d3876f7cd13161afcee22f76b9cb09 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Thu, 18 Mar 2021 20:09:08 -0400 Subject: [PATCH 13/76] renaming to rtxi-lfpRatiometer object --- rtxi-lfpRatiometer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 8a3bc25..97ca8ca 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -59,14 +59,14 @@ void rtxilfpRatiometer::execute() { } // RTXI function for initializing parameters -void lfpRatiometer::initParameters(void) +void rtxilfpRatiometer::initParameters(void) { some_parameter = 0; some_state = 0; } // update function (not running in real time) -void lfpRatiometer::update(DefaultGUIModel::update_flags_t flag) +void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: @@ -95,7 +95,7 @@ void lfpRatiometer::update(DefaultGUIModel::update_flags_t flag) } // RTXI's customizeGUI function -void lfpRatiometer::customizeGUI(void) +void rtxilfpRatiometer::customizeGUI(void) { QGridLayout* customlayout = DefaultGUIModel::getLayout(); @@ -114,6 +114,6 @@ void lfpRatiometer::customizeGUI(void) setLayout(customlayout); } -void lfpRatiometer::aBttn_event(void) { } +void rtxilfpRatiometer::aBttn_event(void) { } -void lfpRatiometer::bBttn_event(void) { } \ No newline at end of file +void rtxilfpRatiometer::bBttn_event(void) { } \ No newline at end of file From 50692c9e589029e9649643348c3c99b2a56f6544 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 14:22:30 -0400 Subject: [PATCH 14/76] small bug fixes --- rtxi-lfpRatiometer.cpp | 2 +- rtxi-lfpRatiometer.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 97ca8ca..b96e0ae 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -29,7 +29,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer() : -DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) +DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index c3a0802..e50f358 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -39,7 +39,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { int sampling = 2000; // lfpRatiometer object - lfpRatiometer::lfpRatiometer lfpratiometer; + lfpRatiometer lfpratiometer; private slots: void aBttn_event(void); From d6ec49c73f595539bfa83836066bf20eff8cac89 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 14:44:06 -0400 Subject: [PATCH 15/76] added lfpRatiometer to LIBS Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 54ba5e1..e2b3840 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = -lfftw3 -lm +LIBS = -lfftw3 -lm -llfpRatiometer ### Do note edit below this line ### From 3587d93845932df4b436f5ac2409c8b99434be7d Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:04:28 -0400 Subject: [PATCH 16/76] modified Makefile to be aligned with rtxi-gldsController Makefile --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e2b3840..2763846 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,16 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = -lfftw3 -lm -llfpRatiometer +LIBS = -### Do note edit below this line ### +OS := $(shell uname) +CXX = g++ -include $(shell rtxi_plugin_config --pkgdata-dir)/Makefile.plugin_compile \ No newline at end of file +# lfpRatiometer +CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) +LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) + +# RTXI plug-in stuff +include Makefile.plugin_compile + +print-% : ; @echo $* = $($*) \ No newline at end of file From ce021dd33a46e185d5eaf9061ebdedcb029ce75b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:07:22 -0400 Subject: [PATCH 17/76] added Makefile.plugin_compile --- Makefile.plugin_compile | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Makefile.plugin_compile diff --git a/Makefile.plugin_compile b/Makefile.plugin_compile new file mode 100644 index 0000000..9519d2a --- /dev/null +++ b/Makefile.plugin_compile @@ -0,0 +1,43 @@ +exec_modeldir = /usr/local/lib/rtxi + +LIBTOOL = /usr/local/share/rtxi/libtool +CXX = g++ +CXXLD = g++ +CXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) +MOC = /usr/bin/moc + +CXXFLAGS := $(CXXFLAGS) -I. -I/usr/local/include/rtxi -I/usr/local/include/rtxi/plugins -I/usr/local/include/rtxi/libs -pipe -I/usr/local/include -I/usr/include/x86_64-linux-gnu/qt5/QtOpenGL -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtXml -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtSvg -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtNetwork -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/X11R6/include -I/usr/include/hdf5/serial -I/usr/include/qwt -I/usr/local/include/qwt -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_WIDGETS_LIB -DQT_SVG_LIB -DQT_SHARED -w -O3 -std=c++11 -fPIC + +LDFLAGS := $(LDFLAGS) -L/usr/local/lib/rtxi/libs -L/usr/local/lib -lQt5OpenGL -lQt5PrintSupport -lQt5Xml -lQt5Svg -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lgit2 -lqwt-qt5 -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 -lhdf5_hl -lGL -lpthread -lgsl -lgslcblas -lm -ldl -Wl,--no-as-needed -Wl,@/usr/xenomai/lib/modechk.wrappers -lalchemy -lcopperplate /usr/xenomai/lib/xenomai/bootstrap-pic.o -L/usr/xenomai/lib -lcobalt -lmodechk -lpthread -lrt -module -avoid-version + +ifdef DEBUG +CXXFLAGS += -DDEBUG +endif + +# 2018-01-17 : MFB edited to prepend julia stuff to existing OBJECTS variable. +OBJECTS += $(shell echo $(SOURCES) | sed "s/\.cpp[ \t\n]*/\.lo /g") +MOOBJECTS = $(shell echo $(HEADERS) | sed "s/\.h[ \t\n]*/\.lo /g") + +all: $(PLUGIN_NAME).la + +%.lo: %.cpp + $(CXXCOMPILE) $(CXXFLAGS) -c $< -o $@ + +$(PLUGIN_NAME).la: $(OBJECTS) $(SOURCES) $(HEADERS) + $(CXXLINK) $(CXXFLAGS) $(LIBS) $(LDFLAGS) -rpath `readlink -f $(exec_modeldir)` -o $(PLUGIN_NAME).la $(OBJECTS) + +install: $(PLUGIN_NAME).la + $(LIBTOOL) --mode=install cp $(PLUGIN_NAME).la `readlink -f $(exec_modeldir)` + +clean: + rm -f $(OBJECTS) + rm -f $(MOOBJECTS) + rm -f moc_* + rm -f *.o + rm -f $(PLUGIN_NAME).la + rm -f $(PLUGIN_NAME).o + rm -rf .libs + +moc_%.cpp: %.h + $(MOC) -o $@ $< \ No newline at end of file From 00463a6b7c106a046133bb856732438cb15c5939 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:17:10 -0400 Subject: [PATCH 18/76] including lfpRatiometer library now --- rtxi-lfpRatiometer.h | 1 + 1 file changed, 1 insertion(+) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index e50f358..7d09f52 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -3,6 +3,7 @@ #include #include +#include class rtxilfpRatiometer : public DefaultGUIModel { From a567f76857c7223f51d6b6e69edd1e0929ef3299 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:18:01 -0400 Subject: [PATCH 19/76] missing semicolon --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index b96e0ae..f1c0d65 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -48,7 +48,7 @@ rtxilfpRatiometer::~rtxilfpRatiometer(void) {} void rtxilfpRatiometer::execute() { // push new time series reading to lfpRatiometer - lfpratiometer.pushTimeSample(input(0)) + lfpratiometer.pushTimeSample(input(0)); // calculate LF/HF ratio lfpratiometer.calcRatio(); From 15682e263fd63b03801f05419e44e1012dc6c554 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:19:32 -0400 Subject: [PATCH 20/76] changed name of RTXI plugin --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2763846..b653eb6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PLUGIN_NAME = rtxilfpRatiometer +PLUGIN_NAME = lfpRatiometer HEADERS = rtxi-lfpRatiometer.h From f7bc4972c16f85545cd98a77cbc1e7c74de54916 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 15:36:00 -0400 Subject: [PATCH 21/76] added cleanrtxi feature to Makefile --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b653eb6..6e5e03b 100644 --- a/Makefile +++ b/Makefile @@ -17,4 +17,7 @@ LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) # RTXI plug-in stuff include Makefile.plugin_compile -print-% : ; @echo $* = $($*) \ No newline at end of file +print-% : ; @echo $* = $($*) + +cleanrtxi : + sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* \ No newline at end of file From 90dd7a3060afb6dda8bc893e447d4069152b044f Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 19 Mar 2021 20:06:57 -0400 Subject: [PATCH 22/76] debugging --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 7d09f52..d3be53b 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -14,7 +14,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { rtxilfpRatiometer(); // destructor - ~rtxilfpRatiometer(void); + virtual ~rtxilfpRatiometer(void); // execute void execute(); From ac1bb35b197ef3fb254a6a5007609666d5aa88da Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Mon, 22 Mar 2021 13:56:41 -0400 Subject: [PATCH 23/76] added FFTW3 pkg-config to Makefile --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 6e5e03b..97f54d4 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,10 @@ LIBS = OS := $(shell uname) CXX = g++ +# FFTW3 +CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) + # lfpRatiometer CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) From 7da115dbc2e556981677e93715a0346af76b76ca Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Mon, 22 Mar 2021 15:07:26 -0400 Subject: [PATCH 24/76] Makefile changes --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 97f54d4..a035d81 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,14 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = +LIBS = -lfftw3 -lm OS := $(shell uname) CXX = g++ # FFTW3 -CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) -LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) +# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) # lfpRatiometer CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) From 11217d61baf296c532eb85047ba510794d41af0a Mon Sep 17 00:00:00 2001 From: Adriano Date: Mon, 22 Mar 2021 23:04:54 -0400 Subject: [PATCH 25/76] Makefile miscellaneous changes --- Makefile | 10 ++++++---- test.md | 1 - 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 test.md diff --git a/Makefile b/Makefile index a035d81..c9c3f93 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,16 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = -lfftw3 -lm +LIBS = OS := $(shell uname) CXX = g++ +# + # FFTW3 -# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) -# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) +CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) # lfpRatiometer CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) @@ -24,4 +26,4 @@ include Makefile.plugin_compile print-% : ; @echo $* = $($*) cleanrtxi : - sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* \ No newline at end of file + sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* diff --git a/test.md b/test.md deleted file mode 100644 index f58162e..0000000 --- a/test.md +++ /dev/null @@ -1 +0,0 @@ -this should be in rtxi-plugin branch. From dd76f2e270297b5f99a59e8eb50349c72fb34952 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Mon, 22 Mar 2021 23:18:53 -0400 Subject: [PATCH 26/76] minor changes to .cpp file --- rtxi-lfpRatiometer.cpp | 6 +++--- rtxi-lfpRatiometer.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index f1c0d65..958a317 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -28,7 +28,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor // user defines time window length (in samples) and sampling rate -rtxilfpRatiometer::rtxilfpRatiometer() : +rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), lfpratiometer(N, sampling) // constructing lfpRatiometer object { @@ -42,10 +42,10 @@ lfpratiometer(N, sampling) // constructing lfpRatiometer object } // defining what's in the object's destructor -rtxilfpRatiometer::~rtxilfpRatiometer(void) {} +rtxilfpRatiometer::~rtxilfpRatiometer(void) { } // real-time RTXI function -void rtxilfpRatiometer::execute() { +void rtxilfpRatiometer::execute(void) { // push new time series reading to lfpRatiometer lfpratiometer.pushTimeSample(input(0)); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index d3be53b..7d1773a 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -11,13 +11,13 @@ class rtxilfpRatiometer : public DefaultGUIModel { public: // constructor - rtxilfpRatiometer(); + rtxilfpRatiometer(void); // destructor virtual ~rtxilfpRatiometer(void); // execute - void execute(); + void execute(void); // functions to make GUI void createGUI(DefaultGUIModel::variable_t*, int); From af58da82eae56b49b160347906b0a59ac437a731 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 23 Mar 2021 19:01:35 -0400 Subject: [PATCH 27/76] commenting out lfpRatiometer --- rtxi-lfpRatiometer.cpp | 14 +++++++------- rtxi-lfpRatiometer.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 958a317..e1f165f 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -30,7 +30,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), -lfpratiometer(N, sampling) // constructing lfpRatiometer object +// lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); DefaultGUIModel::createGUI(vars, num_vars); @@ -47,14 +47,14 @@ rtxilfpRatiometer::~rtxilfpRatiometer(void) { } // real-time RTXI function void rtxilfpRatiometer::execute(void) { - // push new time series reading to lfpRatiometer - lfpratiometer.pushTimeSample(input(0)); + // // push new time series reading to lfpRatiometer + // lfpratiometer.pushTimeSample(input(0)); - // calculate LF/HF ratio - lfpratiometer.calcRatio(); + // // calculate LF/HF ratio + // lfpratiometer.calcRatio(); - // put the LF/HF ratio into the output - output(0) = lfpratiometer.getRatio(); + // // put the LF/HF ratio into the output + // output(0) = lfpratiometer.getRatio(); } diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 7d1773a..11de508 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -39,8 +39,8 @@ class rtxilfpRatiometer : public DefaultGUIModel { int N = 2000; int sampling = 2000; - // lfpRatiometer object - lfpRatiometer lfpratiometer; + // // lfpRatiometer object + // lfpRatiometer lfpratiometer; private slots: void aBttn_event(void); From f8b50e32d7551d5d1493172611b3444f3b5d909b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 23 Mar 2021 19:03:15 -0400 Subject: [PATCH 28/76] misc --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index e1f165f..c1d6a48 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -29,7 +29,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : -DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), +DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) // lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); From 4e61e0bc8e25070d457998eeb3b64bee9c551287 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 23 Mar 2021 19:13:15 -0400 Subject: [PATCH 29/76] misc --- rtxi-lfpRatiometer.cpp | 16 ++++++++-------- rtxi-lfpRatiometer.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index c1d6a48..958a317 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -29,8 +29,8 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : -DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars) -// lfpratiometer(N, sampling) // constructing lfpRatiometer object +DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), +lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); DefaultGUIModel::createGUI(vars, num_vars); @@ -47,14 +47,14 @@ rtxilfpRatiometer::~rtxilfpRatiometer(void) { } // real-time RTXI function void rtxilfpRatiometer::execute(void) { - // // push new time series reading to lfpRatiometer - // lfpratiometer.pushTimeSample(input(0)); + // push new time series reading to lfpRatiometer + lfpratiometer.pushTimeSample(input(0)); - // // calculate LF/HF ratio - // lfpratiometer.calcRatio(); + // calculate LF/HF ratio + lfpratiometer.calcRatio(); - // // put the LF/HF ratio into the output - // output(0) = lfpratiometer.getRatio(); + // put the LF/HF ratio into the output + output(0) = lfpratiometer.getRatio(); } diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 11de508..51527b9 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -40,7 +40,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { int sampling = 2000; // // lfpRatiometer object - // lfpRatiometer lfpratiometer; + lfpRatiometer lfpratiometer; private slots: void aBttn_event(void); From 69876366f86fa996fc14fd80f55f433ac2813bc6 Mon Sep 17 00:00:00 2001 From: Adriano Date: Tue, 23 Mar 2021 19:20:57 -0400 Subject: [PATCH 30/76] Makefile edits --- Makefile | 4 +++- lfpRatiometer.la | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 lfpRatiometer.la diff --git a/Makefile b/Makefile index c9c3f93..4ef1167 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -PLUGIN_NAME = lfpRatiometer +PLUGIN_NAME = rtxilfpRatiometer HEADERS = rtxi-lfpRatiometer.h @@ -20,6 +20,8 @@ LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) +# CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib + # RTXI plug-in stuff include Makefile.plugin_compile diff --git a/lfpRatiometer.la b/lfpRatiometer.la new file mode 100644 index 0000000..a8d7df1 --- /dev/null +++ b/lfpRatiometer.la @@ -0,0 +1,41 @@ +# lfpRatiometer.la - a libtool library file +# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='lfpRatiometer.so' + +# Names of this library. +library_names='lfpRatiometer.so lfpRatiometer.so lfpRatiometer.so' + +# The name of the static archive. +old_library='lfpRatiometer.a' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='' + +# Libraries that this one depends upon. +dependency_libs=' -lfftw3 -L/usr/local/lib/rtxi/libs -L/usr/local/lib -lQt5OpenGL -lQt5PrintSupport -lQt5Xml -lQt5Svg -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lgit2 -lqwt-qt5 -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 -lhdf5_hl -lGL -lgsl -lgslcblas -ldl /usr/xenomai/lib/libalchemy.la /usr/xenomai/lib/libcopperplate.la -L/usr/xenomai/lib /usr/xenomai/lib/libcobalt.la /usr/xenomai/lib/libmodechk.la -lpthread -lrt' + +# Names of additional weak libraries provided by this library +weak_library_names='' + +# Version information for lfpRatiometer. +current=0 +age=0 +revision=0 + +# Is this an already installed library? +installed=no + +# Should we warn about portability when linking against -modules? +shouldnotlink=yes + +# Files to dlopen/dlpreopen +dlopen='' +dlpreopen='' + +# Directory that this library needs to be installed in: +libdir='/usr/local/lib/rtxi' From 8ad5445623247d2f0ee82c36bff65c13cd19e24f Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 23 Mar 2021 19:23:00 -0400 Subject: [PATCH 31/76] cleaning --- lfpRatiometer.la | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 lfpRatiometer.la diff --git a/lfpRatiometer.la b/lfpRatiometer.la deleted file mode 100644 index a8d7df1..0000000 --- a/lfpRatiometer.la +++ /dev/null @@ -1,41 +0,0 @@ -# lfpRatiometer.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.6 Debian-2.4.6-0.1 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='lfpRatiometer.so' - -# Names of this library. -library_names='lfpRatiometer.so lfpRatiometer.so lfpRatiometer.so' - -# The name of the static archive. -old_library='lfpRatiometer.a' - -# Linker flags that cannot go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -lfftw3 -L/usr/local/lib/rtxi/libs -L/usr/local/lib -lQt5OpenGL -lQt5PrintSupport -lQt5Xml -lQt5Svg -lQt5Widgets -lQt5Gui -lQt5Network -lQt5Core -lgit2 -lqwt-qt5 -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 -lhdf5_hl -lGL -lgsl -lgslcblas -ldl /usr/xenomai/lib/libalchemy.la /usr/xenomai/lib/libcopperplate.la -L/usr/xenomai/lib /usr/xenomai/lib/libcobalt.la /usr/xenomai/lib/libmodechk.la -lpthread -lrt' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for lfpRatiometer. -current=0 -age=0 -revision=0 - -# Is this an already installed library? -installed=no - -# Should we warn about portability when linking against -modules? -shouldnotlink=yes - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/usr/local/lib/rtxi' From cfee09b479dcb8aae8103bfadf381b699b1da3cf Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 23 Mar 2021 19:25:38 -0400 Subject: [PATCH 32/76] added comments --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4ef1167..8a70e6e 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ CXX = g++ # -# FFTW3 +# FFTW3 (not sure if necessary) CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) From 027c3e0f76212654cd38f2a4632f4cecc8531e11 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 14:41:40 -0400 Subject: [PATCH 33/76] changed variable type --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 51527b9..b16e80e 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -37,7 +37,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { // default parameters for lfpRatiometer object int N = 2000; - int sampling = 2000; + double sampling = 2000; // // lfpRatiometer object lfpRatiometer lfpratiometer; From acf67f73374dd391db379462ab6207931fbb060d Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:06:38 -0400 Subject: [PATCH 34/76] trying something --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 958a317..172cc17 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -30,7 +30,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), -lfpratiometer(N, sampling) // constructing lfpRatiometer object +lfpratiometer((int)2000, (double)2000) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); DefaultGUIModel::createGUI(vars, num_vars); From b352e3115944e232e1c23dcdcd97aa2421f2d897 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:22:33 -0400 Subject: [PATCH 35/76] changed output of destructor --- Makefile | 2 -- rtxi-lfpRatiometer.h | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8a70e6e..65e76ed 100644 --- a/Makefile +++ b/Makefile @@ -10,8 +10,6 @@ LIBS = OS := $(shell uname) CXX = g++ -# - # FFTW3 (not sure if necessary) CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index b16e80e..7e577d0 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -14,7 +14,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { rtxilfpRatiometer(void); // destructor - virtual ~rtxilfpRatiometer(void); + virtual void ~rtxilfpRatiometer(void); // execute void execute(void); From 9bb1aadd7bee655b813de4d92e3260eccea5779e Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:25:12 -0400 Subject: [PATCH 36/76] changed output of destructor --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 7e577d0..38d421b 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -14,7 +14,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { rtxilfpRatiometer(void); // destructor - virtual void ~rtxilfpRatiometer(void); + ~rtxilfpRatiometer(void); // execute void execute(void); From ae23f5cb5ab788c5036ee4a307d22e8dd0c8b948 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:26:38 -0400 Subject: [PATCH 37/76] changed output of destructor --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 38d421b..b16e80e 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -14,7 +14,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { rtxilfpRatiometer(void); // destructor - ~rtxilfpRatiometer(void); + virtual ~rtxilfpRatiometer(void); // execute void execute(void); From 59a624c3d26a0d36def3883ed184c61516d27acb Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:29:42 -0400 Subject: [PATCH 38/76] reverted Makefile to plugin-template --- Makefile | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 65e76ed..2fdedec 100644 --- a/Makefile +++ b/Makefile @@ -5,25 +5,32 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = +LIBS = -llfpRatiometer -OS := $(shell uname) -CXX = g++ +include Makefile.plugin_compile -# FFTW3 (not sure if necessary) -CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) -LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) +cleanrtxi : + sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* -# lfpRatiometer -CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) -LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) +# LIBS = -# CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib +# OS := $(shell uname) +# CXX = g++ -# RTXI plug-in stuff -include Makefile.plugin_compile +# # FFTW3 (not sure if necessary) +# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) -print-% : ; @echo $* = $($*) +# # lfpRatiometer +# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) +# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) -cleanrtxi : - sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* +# # CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib + +# # RTXI plug-in stuff +# include Makefile.plugin_compile + +# print-% : ; @echo $* = $($*) + +# cleanrtxi : +# sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* From 5dcec5ddbcfbdcb213e188e51b620a0976342289 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:30:39 -0400 Subject: [PATCH 39/76] reverted Makefile to plugin-template --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2fdedec..ec62d4f 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = -llfpRatiometer +LIBS = -L /home/amborsa10/.local -llfpRatiometer include Makefile.plugin_compile From 96649f8e3c3e1ed530fa6a97f4d1c91eeadec473 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Fri, 26 Mar 2021 15:45:36 -0400 Subject: [PATCH 40/76] reverting Makefile to Michael's version with pkgconfig --- Makefile | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index ec62d4f..65e76ed 100644 --- a/Makefile +++ b/Makefile @@ -5,32 +5,25 @@ HEADERS = rtxi-lfpRatiometer.h SOURCES = rtxi-lfpRatiometer.cpp \ moc_rtxi-lfpRatiometer.cpp -LIBS = -L /home/amborsa10/.local -llfpRatiometer +LIBS = -include Makefile.plugin_compile - -cleanrtxi : - sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* - -# LIBS = +OS := $(shell uname) +CXX = g++ -# OS := $(shell uname) -# CXX = g++ +# FFTW3 (not sure if necessary) +CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) -# # FFTW3 (not sure if necessary) -# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) -# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) +# lfpRatiometer +CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) +LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) -# # lfpRatiometer -# CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) -# LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) +# CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib -# # CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib - -# # RTXI plug-in stuff -# include Makefile.plugin_compile +# RTXI plug-in stuff +include Makefile.plugin_compile -# print-% : ; @echo $* = $($*) +print-% : ; @echo $* = $($*) -# cleanrtxi : -# sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* +cleanrtxi : + sudo rm -rf /usr/local/lib/rtxi/$(PLUGIN_NAME).* From ca835bc1210645b3ace0569db3ce551e925ac6d1 Mon Sep 17 00:00:00 2001 From: Adriano Date: Fri, 26 Mar 2021 17:06:18 -0400 Subject: [PATCH 41/76] alternatives commented in Makefile --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 65e76ed..6934a69 100644 --- a/Makefile +++ b/Makefile @@ -11,12 +11,14 @@ OS := $(shell uname) CXX = g++ # FFTW3 (not sure if necessary) -CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) -LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) +#CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags fftw3) +#LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) # lfpRatiometer CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) +#CXXFLAGS := $(CXXFLAGS) -I/home/amborsa10/.local/include +#LDFLAGS := $(LDFLAGS) -L/usr/lib/x86_64-linux-gnu -lfftw3 -L/home/amborsa10/.local/lib -llfpRatiometer # CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib From db4086fc13415b1a56c5078ccee594a75d2fea85 Mon Sep 17 00:00:00 2001 From: Adriano Date: Sun, 28 Mar 2021 22:22:47 -0400 Subject: [PATCH 42/76] changes to Makefile that allow RTXI plugin to finally work --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6934a69..b4c3757 100644 --- a/Makefile +++ b/Makefile @@ -15,11 +15,13 @@ CXX = g++ #LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs fftw3) # lfpRatiometer -CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) -LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) -#CXXFLAGS := $(CXXFLAGS) -I/home/amborsa10/.local/include +#CXXFLAGS := $(CXXFLAGS) $(shell pkg-config --cflags lfpRatiometer) +#LDFLAGS := $(LDFLAGS) $(shell pkg-config --libs lfpRatiometer) +CXXFLAGS := $(CXXFLAGS) -I/home/amborsa10/.local/include #LDFLAGS := $(LDFLAGS) -L/usr/lib/x86_64-linux-gnu -lfftw3 -L/home/amborsa10/.local/lib -llfpRatiometer +LDFLAGS := $(LDFLAGS) -Wl,-rpath -Wl,/home/amborsa10/.local/lib -L/home/amborsa10/.local/lib -llfpRatiometer + # CXXFLAGS := $(CXXFLAGS) -rpath /home/amborsa10/.local/lib # RTXI plug-in stuff From 6cc175ea69b6c0d41441919c7cf0a07d479b8bbb Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 16:37:11 -0400 Subject: [PATCH 43/76] changing constructor initialization --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 172cc17..958a317 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -30,7 +30,7 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), -lfpratiometer((int)2000, (double)2000) // constructing lfpRatiometer object +lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); DefaultGUIModel::createGUI(vars, num_vars); From c8028d3ea09ef1b1f89cce31a90e09f74b19f28b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 19:50:00 -0400 Subject: [PATCH 44/76] changing GUI to have all relevant parameters --- rtxi-lfpRatiometer.cpp | 63 +++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 958a317..2d38c81 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -7,10 +7,30 @@ extern "C" Plugin::Object *createRTXIPlugin(void){ } static DefaultGUIModel::variable_t vars[] = { - { - "GUI label", "Tooltip description", - DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, +{ + "Time Window", "Time Window (s)", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE }, +{ + "Sampling Rate", "Sampling Rate (Hz)", + DefaultGUIModel::STATE | DefaultGUIModel::DOUBLE, + }, +{ + "LF Lower Bound", "LF Lower Bound", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, +{ + "LF Upper Bound", "LF Upper Bound", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, +{ + "HF Lower Bound", "HF Lower Bound", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, +{ + "HF Upper Bound", "HF Upper Bound", + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, + }, { "input_LFP", "Input LFP", DefaultGUIModel::INPUT | DefaultGUIModel::DOUBLE, @@ -19,9 +39,6 @@ static DefaultGUIModel::variable_t vars[] = { "ratio", "Output LFP Power Ratio", DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, }, -{ - "A State", "Tooltip description", DefaultGUIModel::STATE, - }, }; static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); @@ -71,12 +88,15 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) switch (flag) { case INIT: period = RT::System::getInstance()->getPeriod() * 1e-6; // ms - setParameter("GUI label", some_parameter); - setState("A State", some_state); + setParameter("Time Window", sampling/N); + setParameter("Sampling Rate", RT::System::getInstance()->getFrequency()); + setParameter("LF Lower Bound", (double)1); // need to amend where these come from + setParameter("LF Upper Bound", (double)10); + setParameter("HF Lower Bound", (double)30); + setParameter("HF Upper Bound", (double)90); break; case MODIFY: - some_parameter = getParameter("GUI label").toDouble(); break; case UNPAUSE: @@ -99,21 +119,14 @@ void rtxilfpRatiometer::customizeGUI(void) { QGridLayout* customlayout = DefaultGUIModel::getLayout(); - QGroupBox* button_group = new QGroupBox; - - QPushButton* abutton = new QPushButton("Button A"); - QPushButton* bbutton = new QPushButton("Button B"); - QHBoxLayout* button_layout = new QHBoxLayout; - button_group->setLayout(button_layout); - button_layout->addWidget(abutton); - button_layout->addWidget(bbutton); - QObject::connect(abutton, SIGNAL(clicked()), this, SLOT(aBttn_event())); - QObject::connect(bbutton, SIGNAL(clicked()), this, SLOT(bBttn_event())); + // adding dropdown menu for choosing FFT window shape + QLabel* windowLabel = new QLabel("Window:"); + windowShape = new QComboBox; + windowShape->insertItem(1, "Rectangular") + windowShape->insertItem(2, "Hamming") + QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); - customlayout->addWidget(button_group, 0, 0); + customlayout->addWidget(windowLabel, 0, 0); + customlayout->addWidget(windowShape, 0, 1); setLayout(customlayout); -} - -void rtxilfpRatiometer::aBttn_event(void) { } - -void rtxilfpRatiometer::bBttn_event(void) { } \ No newline at end of file +} \ No newline at end of file From 780b4eeff709586b1ad843a32a98c16e59848520 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 19:57:09 -0400 Subject: [PATCH 45/76] addressing two errors for GUI modification --- rtxi-lfpRatiometer.cpp | 6 +++--- rtxi-lfpRatiometer.h | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 2d38c81..faa8a29 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -87,9 +87,9 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: - period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + period = RT::System::getInstance()->getPeriod() * 1e-9; // s setParameter("Time Window", sampling/N); - setParameter("Sampling Rate", RT::System::getInstance()->getFrequency()); + setParameter("Sampling Rate", 1.0/period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); @@ -121,7 +121,7 @@ void rtxilfpRatiometer::customizeGUI(void) // adding dropdown menu for choosing FFT window shape QLabel* windowLabel = new QLabel("Window:"); - windowShape = new QComboBox; + QComboBox* windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular") windowShape->insertItem(2, "Hamming") QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index b16e80e..5f794af 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -39,12 +39,8 @@ class rtxilfpRatiometer : public DefaultGUIModel { int N = 2000; double sampling = 2000; - // // lfpRatiometer object + // lfpRatiometer object lfpRatiometer lfpratiometer; - - private slots: - void aBttn_event(void); - void bBttn_event(void); }; From c8f04343572734a0f752cf9343c714dbb8bbed8b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 19:57:52 -0400 Subject: [PATCH 46/76] fixing typo bugs --- rtxi-lfpRatiometer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index faa8a29..e31076e 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -122,8 +122,8 @@ void rtxilfpRatiometer::customizeGUI(void) // adding dropdown menu for choosing FFT window shape QLabel* windowLabel = new QLabel("Window:"); QComboBox* windowShape = new QComboBox; - windowShape->insertItem(1, "Rectangular") - windowShape->insertItem(2, "Hamming") + windowShape->insertItem(1, "Rectangular"); + windowShape->insertItem(2, "Hamming"); QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); customlayout->addWidget(windowLabel, 0, 0); From 5d5a4aa0b77701cbc729225367ae8cabaf750a9b Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:01:43 -0400 Subject: [PATCH 47/76] minor tinkering --- rtxi-lfpRatiometer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index e31076e..d68f6d5 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -8,11 +8,11 @@ extern "C" Plugin::Object *createRTXIPlugin(void){ static DefaultGUIModel::variable_t vars[] = { { - "Time Window", "Time Window (s)", + "Time Window (s)", "Time Window (s)", DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE }, { - "Sampling Rate", "Sampling Rate (Hz)", + "Sampling Rate (Hz)", "Sampling Rate (Hz)", DefaultGUIModel::STATE | DefaultGUIModel::DOUBLE, }, { @@ -88,8 +88,8 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) switch (flag) { case INIT: period = RT::System::getInstance()->getPeriod() * 1e-9; // s - setParameter("Time Window", sampling/N); - setParameter("Sampling Rate", 1.0/period); + setParameter("Time Window (s)", sampling/N); + setParameter("Sampling Rate (Hz)", period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); @@ -106,7 +106,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) break; case PERIOD: - period = RT::System::getInstance()->getPeriod() * 1e-6; // ms + period = RT::System::getInstance()->getPeriod() * 1e-9; // s break; default: @@ -120,13 +120,13 @@ void rtxilfpRatiometer::customizeGUI(void) QGridLayout* customlayout = DefaultGUIModel::getLayout(); // adding dropdown menu for choosing FFT window shape - QLabel* windowLabel = new QLabel("Window:"); + QLabel* windowLabel = new QLabel("FFT Window:"); QComboBox* windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular"); windowShape->insertItem(2, "Hamming"); QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); - customlayout->addWidget(windowLabel, 0, 0); - customlayout->addWidget(windowShape, 0, 1); + customlayout->addWidget(windowLabel); + customlayout->addWidget(windowShape); setLayout(customlayout); } \ No newline at end of file From 206d899a5c94ce92f622134317a80573e5640ba1 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:06:33 -0400 Subject: [PATCH 48/76] minor tinkering --- rtxi-lfpRatiometer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index d68f6d5..aeab38e 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -87,7 +87,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: - period = RT::System::getInstance()->getPeriod() * 1e-9; // s + period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s setParameter("Time Window (s)", sampling/N); setParameter("Sampling Rate (Hz)", period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from @@ -126,7 +126,7 @@ void rtxilfpRatiometer::customizeGUI(void) windowShape->insertItem(2, "Hamming"); QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); - customlayout->addWidget(windowLabel); - customlayout->addWidget(windowShape); + customlayout->addWidget(windowLabel, 1, 0); + customlayout->addWidget(windowShape, 1, 1); setLayout(customlayout); } \ No newline at end of file From c044b67d7ef3cd10ec2862fc82611d835544b640 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:10:45 -0400 Subject: [PATCH 49/76] more minor tinkering --- rtxi-lfpRatiometer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index aeab38e..64011bb 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -89,7 +89,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case INIT: period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s setParameter("Time Window (s)", sampling/N); - setParameter("Sampling Rate (Hz)", period); + setParameter("Sampling Rate (Hz)", 1.0/period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); @@ -120,13 +120,11 @@ void rtxilfpRatiometer::customizeGUI(void) QGridLayout* customlayout = DefaultGUIModel::getLayout(); // adding dropdown menu for choosing FFT window shape - QLabel* windowLabel = new QLabel("FFT Window:"); QComboBox* windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular"); windowShape->insertItem(2, "Hamming"); QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); - customlayout->addWidget(windowLabel, 1, 0); - customlayout->addWidget(windowShape, 1, 1); + customlayout->addWidget(windowShape, 2, 0); setLayout(customlayout); } \ No newline at end of file From 27cf77ed0261d141c8acccf877bdd8fa111d4470 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:16:01 -0400 Subject: [PATCH 50/76] setState used for sampling rate --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 64011bb..d4b3365 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -89,7 +89,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case INIT: period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s setParameter("Time Window (s)", sampling/N); - setParameter("Sampling Rate (Hz)", 1.0/period); + setState("Sampling Rate (Hz)", 1.0/period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); From 092616d55c664e326f924f532476b372ddf5dd0a Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:17:31 -0400 Subject: [PATCH 51/76] minor change --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index d4b3365..8af3e81 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -89,7 +89,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case INIT: period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s setParameter("Time Window (s)", sampling/N); - setState("Sampling Rate (Hz)", 1.0/period); + setState("Sampling Rate (Hz)", ((double)1.0)/period); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); From cd26eef67d240a1c017e864324eaad1c8d8a85d6 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:21:16 -0400 Subject: [PATCH 52/76] minor changes --- rtxi-lfpRatiometer.cpp | 5 +++-- rtxi-lfpRatiometer.h | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 8af3e81..9f592f7 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -88,8 +88,9 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) switch (flag) { case INIT: period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s + sampling_freq = 1.0/period; setParameter("Time Window (s)", sampling/N); - setState("Sampling Rate (Hz)", ((double)1.0)/period); + setState("Sampling Rate (Hz)", sampling_freq); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); @@ -106,7 +107,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) break; case PERIOD: - period = RT::System::getInstance()->getPeriod() * 1e-9; // s + period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s break; default: diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 5f794af..7e4990e 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -29,10 +29,8 @@ class rtxilfpRatiometer : public DefaultGUIModel { virtual void update(DefaultGUIModel::update_flags_t); private: - // I want to get rid of these - double some_parameter; - double some_state; double period; + double sampling_freq; void initParameters(); // default parameters for lfpRatiometer object From 5b26ca5a574753db7ea585d40b5de30529ddf321 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:22:25 -0400 Subject: [PATCH 53/76] more minor changes --- rtxi-lfpRatiometer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 9f592f7..39b97eb 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -78,8 +78,7 @@ void rtxilfpRatiometer::execute(void) { // RTXI function for initializing parameters void rtxilfpRatiometer::initParameters(void) { - some_parameter = 0; - some_state = 0; + } // update function (not running in real time) From 9022ce0828e53da285e8ff6c8b993601b41108c9 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:32:47 -0400 Subject: [PATCH 54/76] minor changes --- rtxi-lfpRatiometer.cpp | 10 ++++++---- rtxi-lfpRatiometer.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 39b97eb..5302a88 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -47,6 +47,8 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // user defines time window length (in samples) and sampling rate rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), +period(((double)RT::System::getInstance()->getPeriod())), +sampling(1.0/period), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); @@ -78,7 +80,7 @@ void rtxilfpRatiometer::execute(void) { // RTXI function for initializing parameters void rtxilfpRatiometer::initParameters(void) { - + } // update function (not running in real time) @@ -86,10 +88,10 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: - period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s - sampling_freq = 1.0/period; + //period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s + //sampling_freq = 1.0/period; setParameter("Time Window (s)", sampling/N); - setState("Sampling Rate (Hz)", sampling_freq); + setState("Sampling Rate (Hz)", sampling); setParameter("LF Lower Bound", (double)1); // need to amend where these come from setParameter("LF Upper Bound", (double)10); setParameter("HF Lower Bound", (double)30); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 7e4990e..f5be6e7 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -35,7 +35,7 @@ class rtxilfpRatiometer : public DefaultGUIModel { // default parameters for lfpRatiometer object int N = 2000; - double sampling = 2000; + double sampling; // lfpRatiometer object lfpRatiometer lfpratiometer; From 63a9fc7ad2f515cb0d1ef7d4ec329af380566569 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:41:22 -0400 Subject: [PATCH 55/76] more tweaking --- rtxi-lfpRatiometer.cpp | 7 +++---- rtxi-lfpRatiometer.h | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 5302a88..8745bc6 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -44,11 +44,12 @@ static DefaultGUIModel::variable_t vars[] = { static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor -// user defines time window length (in samples) and sampling rate +// sampling set by RT period, N set so that window is ~1 second rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), -period(((double)RT::System::getInstance()->getPeriod())), +period(((double)RT::System::getInstance()->getPeriod())*1e-9), sampling(1.0/period), +N(int(sampling)), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); @@ -88,8 +89,6 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { switch (flag) { case INIT: - //period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s - //sampling_freq = 1.0/period; setParameter("Time Window (s)", sampling/N); setState("Sampling Rate (Hz)", sampling); setParameter("LF Lower Bound", (double)1); // need to amend where these come from diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index f5be6e7..1bba0f1 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -30,11 +30,11 @@ class rtxilfpRatiometer : public DefaultGUIModel { private: double period; - double sampling_freq; void initParameters(); - // default parameters for lfpRatiometer object - int N = 2000; + // needed to initialize lfpratiometer object + // set based on RT period + int N; double sampling; // lfpRatiometer object From e9e537580d1eefd153ba13c2e392873e9d470b62 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 20:48:02 -0400 Subject: [PATCH 56/76] small change --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 8745bc6..733e5e0 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -49,7 +49,7 @@ rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), period(((double)RT::System::getInstance()->getPeriod())*1e-9), sampling(1.0/period), -N(int(sampling)), +N((int) (sampling)), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); From bf1119450e112f4f267118056a8e0407e9affc92 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 21:00:50 -0400 Subject: [PATCH 57/76] minor --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 733e5e0..a3f1512 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -49,7 +49,7 @@ rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), period(((double)RT::System::getInstance()->getPeriod())*1e-9), sampling(1.0/period), -N((int) (sampling)), +N((int) floor(sampling)), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); From 7aedf9ef4cc0dbd6a553337c716977afb4dbb16d Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 21:04:48 -0400 Subject: [PATCH 58/76] minor ptII --- rtxi-lfpRatiometer.cpp | 1 - rtxi-lfpRatiometer.h | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index a3f1512..cbe6e98 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -49,7 +49,6 @@ rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), period(((double)RT::System::getInstance()->getPeriod())*1e-9), sampling(1.0/period), -N((int) floor(sampling)), lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 1bba0f1..e4757d8 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -33,9 +33,8 @@ class rtxilfpRatiometer : public DefaultGUIModel { void initParameters(); // needed to initialize lfpratiometer object - // set based on RT period - int N; - double sampling; + int N = 1000; // initialized to 1000 samples + double sampling; // set based on RT period // lfpRatiometer object lfpRatiometer lfpratiometer; From 7803d947b41c01785355172acb28d43951483c43 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 21:18:24 -0400 Subject: [PATCH 59/76] frequency bounds now taken from lfpratiometer object --- rtxi-lfpRatiometer.cpp | 21 ++++++++------------- rtxi-lfpRatiometer.h | 3 +-- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index cbe6e98..04ace40 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -47,14 +47,13 @@ static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // sampling set by RT period, N set so that window is ~1 second rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), -period(((double)RT::System::getInstance()->getPeriod())*1e-9), -sampling(1.0/period), +period(((double)RT::System::getInstance()->getPeriod())*1e-9), // grabbing RT period +sampling(1.0/period), // calculating RT sampling rate lfpratiometer(N, sampling) // constructing lfpRatiometer object { setWhatsThis("

lfpRatiometer:
Given an input, this module calculates the LF/HF ratio over a specified causal time window.

"); DefaultGUIModel::createGUI(vars, num_vars); customizeGUI(); - initParameters(); update(INIT); refresh(); QTimer::singleShot(0, this, SLOT(resizeMe())); @@ -77,12 +76,6 @@ void rtxilfpRatiometer::execute(void) { } -// RTXI function for initializing parameters -void rtxilfpRatiometer::initParameters(void) -{ - -} - // update function (not running in real time) void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) { @@ -90,10 +83,12 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case INIT: setParameter("Time Window (s)", sampling/N); setState("Sampling Rate (Hz)", sampling); - setParameter("LF Lower Bound", (double)1); // need to amend where these come from - setParameter("LF Upper Bound", (double)10); - setParameter("HF Lower Bound", (double)30); - setParameter("HF Upper Bound", (double)90); + // get bounds from lfpratiometer object + std::vector freqbounds = lfpratiometer.getFreqBounds(); + setParameter("LF Lower Bound", freqbounds[0]); // need to amend where these come from + setParameter("LF Upper Bound", freqbounds[1]); + setParameter("HF Lower Bound", freqbounds[2]); + setParameter("HF Upper Bound", freqbounds[3]); break; case MODIFY: diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index e4757d8..9ff8051 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -30,10 +30,9 @@ class rtxilfpRatiometer : public DefaultGUIModel { private: double period; - void initParameters(); // needed to initialize lfpratiometer object - int N = 1000; // initialized to 1000 samples + int N = 1000; // initialized to 1000 samples (1s for 1kHz sampling) double sampling; // set based on RT period // lfpRatiometer object From 10eda76d712f29f0cd8b16d0fbc7e45dec419a17 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 22:09:28 -0400 Subject: [PATCH 60/76] stuff --- rtxi-lfpRatiometer.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 04ace40..e75ba2e 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -84,11 +84,11 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) setParameter("Time Window (s)", sampling/N); setState("Sampling Rate (Hz)", sampling); // get bounds from lfpratiometer object - std::vector freqbounds = lfpratiometer.getFreqBounds(); - setParameter("LF Lower Bound", freqbounds[0]); // need to amend where these come from - setParameter("LF Upper Bound", freqbounds[1]); - setParameter("HF Lower Bound", freqbounds[2]); - setParameter("HF Upper Bound", freqbounds[3]); + //std::vector freqbounds = lfpratiometer.getFreqBounds(); + setParameter("LF Lower Bound", lfpratiometer.getFreqBounds()[0]); // need to amend where these come from + setParameter("LF Upper Bound", lfpratiometer.getFreqBounds()[1]); + setParameter("HF Lower Bound", lfpratiometer.getFreqBounds()[2]); + setParameter("HF Upper Bound", lfpratiometer.getFreqBounds()[3]); break; case MODIFY: From 9987b3ffafe7b862eaac65dfff8f458bb02caa29 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 22:26:48 -0400 Subject: [PATCH 61/76] minor change --- rtxi-lfpRatiometer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index e75ba2e..d81512d 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -39,12 +39,16 @@ static DefaultGUIModel::variable_t vars[] = { "ratio", "Output LFP Power Ratio", DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, }, +{ + "debug var", "debug var", + DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, +} }; static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); // defining what's in the object's constructor -// sampling set by RT period, N set so that window is ~1 second +// sampling set by RT period rtxilfpRatiometer::rtxilfpRatiometer(void) : DefaultGUIModel("lfpRatiometer with Custom GUI", ::vars, ::num_vars), period(((double)RT::System::getInstance()->getPeriod())*1e-9), // grabbing RT period @@ -84,8 +88,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) setParameter("Time Window (s)", sampling/N); setState("Sampling Rate (Hz)", sampling); // get bounds from lfpratiometer object - //std::vector freqbounds = lfpratiometer.getFreqBounds(); - setParameter("LF Lower Bound", lfpratiometer.getFreqBounds()[0]); // need to amend where these come from + setParameter("LF Lower Bound", lfpratiometer.getFreqBounds()[0]); setParameter("LF Upper Bound", lfpratiometer.getFreqBounds()[1]); setParameter("HF Lower Bound", lfpratiometer.getFreqBounds()[2]); setParameter("HF Upper Bound", lfpratiometer.getFreqBounds()[3]); @@ -118,7 +121,7 @@ void rtxilfpRatiometer::customizeGUI(void) QComboBox* windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular"); windowShape->insertItem(2, "Hamming"); - QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); + //QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); customlayout->addWidget(windowShape, 2, 0); setLayout(customlayout); From cd8211475f2b1088c5f006a2b9adb625ba15a01a Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 22:48:06 -0400 Subject: [PATCH 62/76] adding MODIFY instructions --- rtxi-lfpRatiometer.cpp | 27 ++++++++++++++++++++++++++- rtxi-lfpRatiometer.h | 3 +++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index d81512d..999b421 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -92,9 +92,35 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) setParameter("LF Upper Bound", lfpratiometer.getFreqBounds()[1]); setParameter("HF Lower Bound", lfpratiometer.getFreqBounds()[2]); setParameter("HF Upper Bound", lfpratiometer.getFreqBounds()[3]); + + setParameter("debug var", window_tracker_dummy) break; case MODIFY: + // defining parameters needed for constructor + sampling = getParameter("Sampling Rate (Hz)").toDouble(); + N = (int) (getParameter("Time Window (s)").toDouble() * sampling); + + // reconstructing lfpratiometer object...LEGAL?? + lfpratiometer(N, sampling); + + // setting frequency bounds based on user input + lfpratiometer.setRatioParams(getParameter("LF Lower Bound").toDouble(), + getParameter("LF Upper Bound").toDouble(), + getParameter("HF Lower Bound").toDouble(), + getParameter("HF Upper Bound").toDouble()); + + // setting DFT windowing function choice + if (windowShape->currentIndex() == 1) { + lfpratiometer.window_rect(); + } + else if (windowShape->currentIndex() == 2) { + lfpratiometer.window_hamming(); + } + + // clearing time series + lfpratiometer.clrTimeSeries(); + break; case UNPAUSE: @@ -121,7 +147,6 @@ void rtxilfpRatiometer::customizeGUI(void) QComboBox* windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular"); windowShape->insertItem(2, "Hamming"); - //QObject::connect(windowShape, SIGNAL(activated(int)), this, SLOT(updateWindow(int))); customlayout->addWidget(windowShape, 2, 0); setLayout(customlayout); diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 9ff8051..06e1ce8 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -38,6 +38,9 @@ class rtxilfpRatiometer : public DefaultGUIModel { // lfpRatiometer object lfpRatiometer lfpratiometer; + // window tracking var + int window_tracker_dummy = 0; + }; From 9c30c340097ab9659276a2375e6978caba50cf39 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 22:49:48 -0400 Subject: [PATCH 63/76] minor changes --- rtxi-lfpRatiometer.cpp | 2 +- rtxi-lfpRatiometer.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 999b421..677d602 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -93,7 +93,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) setParameter("HF Lower Bound", lfpratiometer.getFreqBounds()[2]); setParameter("HF Upper Bound", lfpratiometer.getFreqBounds()[3]); - setParameter("debug var", window_tracker_dummy) + setParameter("debug var", window_tracker_dummy); break; case MODIFY: diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 06e1ce8..d5b2d0f 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -38,6 +38,9 @@ class rtxilfpRatiometer : public DefaultGUIModel { // lfpRatiometer object lfpRatiometer lfpratiometer; + // variables for GUI + QComboBox* windowShape; + // window tracking var int window_tracker_dummy = 0; From 891e6183e9e55e8866c1587d9090d3504c356d09 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:12:48 -0400 Subject: [PATCH 64/76] using lfpRatiometer's new changeFFTPlan method --- rtxi-lfpRatiometer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 677d602..5a9a015 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -101,8 +101,8 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) sampling = getParameter("Sampling Rate (Hz)").toDouble(); N = (int) (getParameter("Time Window (s)").toDouble() * sampling); - // reconstructing lfpratiometer object...LEGAL?? - lfpratiometer(N, sampling); + // making new FFT plan + lfpratiometer.changeFFTPlan(N, sampling); // setting frequency bounds based on user input lfpratiometer.setRatioParams(getParameter("LF Lower Bound").toDouble(), @@ -144,7 +144,7 @@ void rtxilfpRatiometer::customizeGUI(void) QGridLayout* customlayout = DefaultGUIModel::getLayout(); // adding dropdown menu for choosing FFT window shape - QComboBox* windowShape = new QComboBox; + windowShape = new QComboBox; windowShape->insertItem(1, "Rectangular"); windowShape->insertItem(2, "Hamming"); From dc4daede9cc2f4e41c221dc7c15158b0f209853c Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:14:18 -0400 Subject: [PATCH 65/76] debugging tracker --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 5a9a015..d04c8bb 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -41,7 +41,7 @@ static DefaultGUIModel::variable_t vars[] = { }, { "debug var", "debug var", - DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, + DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, } }; From 41cad51a142082e39b044421c9862b5bc209f472 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:17:39 -0400 Subject: [PATCH 66/76] some debugging trackers --- rtxi-lfpRatiometer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index d04c8bb..698d825 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -113,14 +113,19 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) // setting DFT windowing function choice if (windowShape->currentIndex() == 1) { lfpratiometer.window_rect(); + window_tracker_dummy = 1; } else if (windowShape->currentIndex() == 2) { lfpratiometer.window_hamming(); + window_tracker_dummy = 2; } // clearing time series lfpratiometer.clrTimeSeries(); + // modifying states on GUI + setState("Sampling Rate (Hz)", sampling); + break; case UNPAUSE: From d98e8d39c480abe7aea89ba186dbcc489670ca16 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:20:41 -0400 Subject: [PATCH 67/76] debuggin --- rtxi-lfpRatiometer.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 698d825..c991128 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -98,7 +98,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case MODIFY: // defining parameters needed for constructor - sampling = getParameter("Sampling Rate (Hz)").toDouble(); + sampling = getState("Sampling Rate (Hz)").toDouble(); N = (int) (getParameter("Time Window (s)").toDouble() * sampling); // making new FFT plan @@ -123,9 +123,6 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) // clearing time series lfpratiometer.clrTimeSeries(); - // modifying states on GUI - setState("Sampling Rate (Hz)", sampling); - break; case UNPAUSE: From 985cccb0b26b52ced534836249cbf977608434e3 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:23:13 -0400 Subject: [PATCH 68/76] more debuggin --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index c991128..6168454 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -98,7 +98,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case MODIFY: // defining parameters needed for constructor - sampling = getState("Sampling Rate (Hz)").toDouble(); + sampling = ((double)RT::System::getInstance()->getPeriod())*1e-9; N = (int) (getParameter("Time Window (s)").toDouble() * sampling); // making new FFT plan From 2071bc79af76c06ea6abb5eeb606a94485837f72 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:28:12 -0400 Subject: [PATCH 69/76] more debugging --- rtxi-lfpRatiometer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 6168454..180eac3 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -98,7 +98,9 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) case MODIFY: // defining parameters needed for constructor - sampling = ((double)RT::System::getInstance()->getPeriod())*1e-9; + period = ((double)RT::System::getInstance()->getPeriod())*1e-9; + sampling = 1.0/period; + setState("Sampling Rate (Hz)", sampling); // updating GUI N = (int) (getParameter("Time Window (s)").toDouble() * sampling); // making new FFT plan @@ -123,6 +125,9 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) // clearing time series lfpratiometer.clrTimeSeries(); + // tracking dummy variable + setParameter("debug var", window_tracker_dummy); + break; case UNPAUSE: From aa7672da1439a6a08e5f2253cb658eafa8b190d6 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:33:21 -0400 Subject: [PATCH 70/76] debugging --- rtxi-lfpRatiometer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 180eac3..123f203 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -113,11 +113,12 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) getParameter("HF Upper Bound").toDouble()); // setting DFT windowing function choice - if (windowShape->currentIndex() == 1) { + const int dropindex = windowShape->currentIndex(); + if (dropindex == 1) { lfpratiometer.window_rect(); window_tracker_dummy = 1; } - else if (windowShape->currentIndex() == 2) { + else if (dropindex == 2) { lfpratiometer.window_hamming(); window_tracker_dummy = 2; } @@ -126,7 +127,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) lfpratiometer.clrTimeSeries(); // tracking dummy variable - setParameter("debug var", window_tracker_dummy); + setParameter("debug var", dropindex); break; From efcc8c6a55cbaab1d282c1e5a8f11e82e0f010bc Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:34:43 -0400 Subject: [PATCH 71/76] debugging --- rtxi-lfpRatiometer.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 123f203..0306e04 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -113,12 +113,11 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) getParameter("HF Upper Bound").toDouble()); // setting DFT windowing function choice - const int dropindex = windowShape->currentIndex(); - if (dropindex == 1) { + if (windowShape->currentIndex() == 1) { lfpratiometer.window_rect(); window_tracker_dummy = 1; } - else if (dropindex == 2) { + else if (windowShape->currentIndex() == 2) { lfpratiometer.window_hamming(); window_tracker_dummy = 2; } @@ -127,7 +126,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) lfpratiometer.clrTimeSeries(); // tracking dummy variable - setParameter("debug var", dropindex); + setParameter("debug var", windowShape->currentIndex()); break; From f6f6aeb78ac65287d2a34bd9e5a12305576f0acf Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:36:37 -0400 Subject: [PATCH 72/76] debugging --- rtxi-lfpRatiometer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 0306e04..73006ec 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -113,11 +113,11 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) getParameter("HF Upper Bound").toDouble()); // setting DFT windowing function choice - if (windowShape->currentIndex() == 1) { + if (windowShape->currentIndex() == 0) { lfpratiometer.window_rect(); window_tracker_dummy = 1; } - else if (windowShape->currentIndex() == 2) { + else if (windowShape->currentIndex() == 1) { lfpratiometer.window_hamming(); window_tracker_dummy = 2; } @@ -126,7 +126,7 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) lfpratiometer.clrTimeSeries(); // tracking dummy variable - setParameter("debug var", windowShape->currentIndex()); + setParameter("debug var", window_tracker_dummy); break; From d420303a90cb825943a832ce68232e119d9e27d4 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:44:56 -0400 Subject: [PATCH 73/76] final changes 3.30.2021 --- rtxi-lfpRatiometer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 73006ec..9b48831 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -134,10 +134,10 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) break; case PAUSE: + lfpratiometer.clrTimeSeries(); break; case PERIOD: - period = ((double)RT::System::getInstance()->getPeriod()) * 1e-9; // s break; default: From 0c66572b337f31745a380fbf0d56b9c60038278d Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Tue, 30 Mar 2021 23:46:16 -0400 Subject: [PATCH 74/76] final changes 3.30.2021 --- rtxi-lfpRatiometer.cpp | 15 ++++----------- rtxi-lfpRatiometer.h | 3 --- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 9b48831..6737314 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -39,10 +39,10 @@ static DefaultGUIModel::variable_t vars[] = { "ratio", "Output LFP Power Ratio", DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, }, -{ - "debug var", "debug var", - DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, -} +// { +// "debug var", "debug var", +// DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, +// } }; static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); @@ -92,8 +92,6 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) setParameter("LF Upper Bound", lfpratiometer.getFreqBounds()[1]); setParameter("HF Lower Bound", lfpratiometer.getFreqBounds()[2]); setParameter("HF Upper Bound", lfpratiometer.getFreqBounds()[3]); - - setParameter("debug var", window_tracker_dummy); break; case MODIFY: @@ -115,19 +113,14 @@ void rtxilfpRatiometer::update(DefaultGUIModel::update_flags_t flag) // setting DFT windowing function choice if (windowShape->currentIndex() == 0) { lfpratiometer.window_rect(); - window_tracker_dummy = 1; } else if (windowShape->currentIndex() == 1) { lfpratiometer.window_hamming(); - window_tracker_dummy = 2; } // clearing time series lfpratiometer.clrTimeSeries(); - // tracking dummy variable - setParameter("debug var", window_tracker_dummy); - break; case UNPAUSE: diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index d5b2d0f..8d3c5bc 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -41,9 +41,6 @@ class rtxilfpRatiometer : public DefaultGUIModel { // variables for GUI QComboBox* windowShape; - // window tracking var - int window_tracker_dummy = 0; - }; From 6402b541224375eda2eb90c0db18b25fc38c9dd3 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Wed, 31 Mar 2021 00:02:46 -0400 Subject: [PATCH 75/76] final changes 3.30.2021 --- rtxi-lfpRatiometer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtxi-lfpRatiometer.h b/rtxi-lfpRatiometer.h index 8d3c5bc..e0f684b 100644 --- a/rtxi-lfpRatiometer.h +++ b/rtxi-lfpRatiometer.h @@ -29,10 +29,10 @@ class rtxilfpRatiometer : public DefaultGUIModel { virtual void update(DefaultGUIModel::update_flags_t); private: - double period; // needed to initialize lfpratiometer object int N = 1000; // initialized to 1000 samples (1s for 1kHz sampling) + double period; // set from RT period double sampling; // set based on RT period // lfpRatiometer object From 10a3c6adc7b654252a0c85a4254045c58bd3e987 Mon Sep 17 00:00:00 2001 From: Adriano Borsa Date: Mon, 3 May 2021 20:30:22 -0400 Subject: [PATCH 76/76] added outputs to track LF & HF power, separately --- rtxi-lfpRatiometer.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/rtxi-lfpRatiometer.cpp b/rtxi-lfpRatiometer.cpp index 6737314..8e0c68d 100644 --- a/rtxi-lfpRatiometer.cpp +++ b/rtxi-lfpRatiometer.cpp @@ -39,10 +39,14 @@ static DefaultGUIModel::variable_t vars[] = { "ratio", "Output LFP Power Ratio", DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, }, -// { -// "debug var", "debug var", -// DefaultGUIModel::PARAMETER | DefaultGUIModel::DOUBLE, -// } +{ + "LF Power", "Power in LF Band", + DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, + }, +{ + "HF Power", "Power in HF Band", + DefaultGUIModel::OUTPUT | DefaultGUIModel::DOUBLE, + } }; static size_t num_vars = sizeof(vars) / sizeof(DefaultGUIModel::variable_t); @@ -77,6 +81,8 @@ void rtxilfpRatiometer::execute(void) { // put the LF/HF ratio into the output output(0) = lfpratiometer.getRatio(); + output(1) = lfpratiometer.getLFpower(); + output(2) = lfpratiometer.getHFpower(); }