Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Request for help in running REST code #9

Open
piyushswami04 opened this issue May 17, 2021 · 8 comments
Open

Request for help in running REST code #9

piyushswami04 opened this issue May 17, 2021 · 8 comments

Comments

@piyushswami04
Copy link

Dear Authors,

Hope you are doing well.

I am a Postdoc at DTU, Demark. I am trying to use your REST code (https://github.com/goodshawn12/REST) for my work. When I ran the test_script.m it worked fine. But, I wanted to see the REST tool. So I uncommented Quick20 settings and REST(Opts). It gave the error shown in the file attached. I also tried using other settings and emotiv. Also, set opts. playback = 0; but it gave the same error.
Can you please help me in running your code?
<img width="1680" alt="Screen Shot 2021-05-10 at 13 37 54"

@lucapton
Copy link
Collaborator

There seems to be an issue with your attachment.

@piyushswami04
Copy link
Author

There seems to be an issue with your attachment.

Screen Shot 2021-05-10 at 13 37 54

@lucapton
Copy link
Collaborator

I may be misreading what you did, but you want opts. playback = 1;, not 0. The Quick20 demo works just fine for me with that. If that isn't the problem, could you share your test_script2.m so I can see exactly what you're trying?

@piyushswami04
Copy link
Author

piyushswami04 commented May 23, 2021

I may be misreading what you did, but you want opts. playback = 1;, not 0. The Quick20 demo works just fine for me with that. If that isn't the problem, could you share your test_script2.m so I can see exactly what you're trying?

Thanks for your reply Shawn. This is what I did:

  1. Copied REST folder and added it to matlab path.
  2. Copied the path of BCILAB (i.e., /Users/piyushswami/Documents/MATLAB/mywork/Func/REST/dependencies/BCILAB in this case) in the file bacilab_path.txt and saved it.
  3. Ran the following script:

%% Test REST (go to 'REST' folder)
%% set path and initialize bcilab
rest_path = './';
bcilab_path = which('bcilab.m');
if isempty(bcilab_path)
current_path = pwd;
addpath(fullfile(rest_path, 'dependencies', 'BCILAB'));
bcilab
cd(current_path);
addpath(genpath(rest_path));
end

%% refresh workspace
% clear all will break bcilab and require it to restart as it uses global variables
close all hidden
clearvars -except rest_path
timer = timerfindall;
if ~isempty(timer)
stop(timerfindall); delete(timerfindall);
disp('Delete timers...');
end

%% define opts structure
% whether to customize pipeline
opts.customize_pipeline = false;
opts.save_config = false;

% % % Emotiv - setting
% % (optional) define config file name
% opts.config = 'Config_ORICA_EmotivEPOC';
%
% % point to headModel
% opts.headModel = fullfile(rest_path, 'data', 'head_models', 'emotivHeadModel_file');
%
% % (optional) path to calibration data and select time window
% opts.calibration_data = fullfile(rest_path, 'data', 'Demo_EmotivEPOC_EyeOpen.set');
% opts.calibration_window = [0,60]; % sec

% % Quick 20 - setting
% channel locations
load(fullfile(rest_path, 'data', 'chanlocs', 'Quick20.mat'));
opts.chanlocs = chanlocs;

% (optional) define config file name
opts.config = 'Config_ORICA_quick20';

% point to headModel
opts.headModel = fullfile(rest_path, 'data', 'head_models', 'quick20HeadModel');

% (optional) path to calibration data and select time window
opts.calibration_data = fullfile(rest_path, 'data', 'Quick20_Luca_calib_EyeOpen.set');
opts.calibration_window = [0,60]; % sec

% % % Quick 30 - setting
% % channel locations
% load(fullfile(rest_path, 'data/chanlocs/Quick30.mat'));
% opts.chanlocs = chanlocs;
%
% % (optional) define config file name
% opts.config = 'Config_ORICA_quick30';
%
% % (optional) path to calibration data and select time window
% opts.calibration_data = fullfile(rest_path, 'data', 'Quick30_Shawn_EyeOpen.set');
% opts.calibration_window = [0,133]; % sec
%
% % (optional) load eyeCatch library
% opts.libEyeCatch = load(fullfile(rest_path, 'dependencies', 'eyeCatch', 'libEyeCatch.mat'));
%
% % (optional) load IC_MARC model
% opts.modIcMarc = load(fullfile(rest_path, 'dependencies', 'IC_MARC', 'spatial2.mat'));
%
% % use playback data
% opts.playback = 1;

% % Smarting - setting
% channel locations
load(fullfile(rest_path, 'data/chanlocs/Smarting24.mat'));
opts.chanlocs = chanlocs;

% (optional) define config file name
opts.config = 'Config_ORICA_smarting24';

% (optional) path to calibration data and select time window
opts.calibration_data = fullfile(rest_path, 'data', 'Smarting_220219_1311.set');
opts.calibration_window = [0,133]; % sec

% (optional) load eyeCatch library
opts.libEyeCatch = load(fullfile(rest_path, 'dependencies', 'eyeCatch', 'libEyeCatch.mat'));

% (optional) load IC_MARC model
opts.modIcMarc = load(fullfile(rest_path, 'dependencies', 'IC_MARC', 'spatial2.mat'));

% use playback data
opts.playback = 1;

%% start REST
REST(opts)

  1. It gave me this error:
    Error using hgload>localCheckRecursion (line 135)
    File /Users/piyushswami/Documents/MATLAB/mywork/Func/REST/GUI/REST.fig recursively loaded itself.

Error in hgload (line 49)
Guard = localCheckRecursion(fullpath); %#ok

Error in matlab.hg.internal.openfigLegacy (line 57)
[fig, savedvisible] = hgload(filename, struct('Visible','off'));

Error in gui_mainfcn>local_openfig (line 286)
gui_hFigure = matlab.hg.internal.openfigLegacy(name, singleton, visible);

Error in gui_mainfcn (line 158)
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);

Error in REST (line 71)
gui_mainfcn(gui_State, varargin{:});

Error in test_script (line 100)
REST(opts)

@lucapton
Copy link
Collaborator

You have both the Quick20 and Smarting settings active. Try commenting out the Smarting settings if you're trying to run Quick20.

@piyushswami04
Copy link
Author

You have both the Quick20 and Smarting settings active. Try commenting out the Smarting settings if you're trying to run Quick20.

Ok, I tried the following but got the same error message.

%% Test REST (go to 'REST' folder)
%% set path and initialize bcilab
rest_path = './';
bcilab_path = which('bcilab.m');
if isempty(bcilab_path)
current_path = pwd;
addpath(fullfile(rest_path, 'dependencies', 'BCILAB'));
bcilab
cd(current_path);
addpath(genpath(rest_path));
end

%% refresh workspace
% clear all will break bcilab and require it to restart as it uses global variables
close all hidden
clearvars -except rest_path
timer = timerfindall;
if ~isempty(timer)
stop(timerfindall); delete(timerfindall);
disp('Delete timers...');
end

%% define opts structure
% whether to customize pipeline
opts.customize_pipeline = false;
opts.save_config = false;

% % % Emotiv - setting
% % (optional) define config file name
% opts.config = 'Config_ORICA_EmotivEPOC';
%
% % point to headModel
% opts.headModel = fullfile(rest_path, 'data', 'head_models', 'emotivHeadModel_file');
%
% % (optional) path to calibration data and select time window
% opts.calibration_data = fullfile(rest_path, 'data', 'Demo_EmotivEPOC_EyeOpen.set');
% opts.calibration_window = [0,60]; % sec

% % % Quick 20 - setting
% channel locations
load(fullfile(rest_path, 'data', 'chanlocs', 'Quick20.mat'));
opts.chanlocs = chanlocs;

% (optional) define config file name
opts.config = 'Config_ORICA_quick20';

% point to headModel
opts.headModel = fullfile(rest_path, 'data', 'head_models', 'quick20HeadModel');

% (optional) path to calibration data and select time window
opts.calibration_data = fullfile(rest_path, 'data', 'Quick20_Luca_calib_EyeOpen.set');
opts.calibration_window = [0,60]; % sec

% % % Quick 30 - setting
% % channel locations
% load(fullfile(rest_path, 'data/chanlocs/Quick30.mat'));
% opts.chanlocs = chanlocs;
%
% % (optional) define config file name
% opts.config = 'Config_ORICA_quick30';
%
% % (optional) path to calibration data and select time window
% opts.calibration_data = fullfile(rest_path, 'data', 'Quick30_Shawn_EyeOpen.set');
% opts.calibration_window = [0,133]; % sec
%
% % (optional) load eyeCatch library
% opts.libEyeCatch = load(fullfile(rest_path, 'dependencies', 'eyeCatch', 'libEyeCatch.mat'));
%
% % (optional) load IC_MARC model
% opts.modIcMarc = load(fullfile(rest_path, 'dependencies', 'IC_MARC', 'spatial2.mat'));
%
% % use playback data
% opts.playback = 1;

% % Smarting - setting
% % channel locations
% load(fullfile(rest_path, 'data/chanlocs/Smarting24.mat'));
% opts.chanlocs = chanlocs;
%
% % (optional) define config file name
% opts.config = 'Config_ORICA_smarting24';
%
% % (optional) path to calibration data and select time window
% opts.calibration_data = fullfile(rest_path, 'data', 'Smarting_220219_1311.set');
% opts.calibration_window = [0,133]; % sec
%
% % (optional) load eyeCatch library
% opts.libEyeCatch = load(fullfile(rest_path, 'dependencies', 'eyeCatch', 'libEyeCatch.mat'));
%
% % (optional) load IC_MARC model
% opts.modIcMarc = load(fullfile(rest_path, 'dependencies', 'IC_MARC', 'spatial2.mat'));

% use playback data
opts.playback = 1;

%% start REST
REST(opts)

ERROR:
Error using hgload>localCheckRecursion (line 135)
File /Users/piyushswami/Documents/MATLAB/mywork/Func/REST/GUI/REST.fig recursively loaded itself.

Error in hgload (line 49)
Guard = localCheckRecursion(fullpath); %#ok

Error in matlab.hg.internal.openfigLegacy (line 57)
[fig, savedvisible] = hgload(filename, struct('Visible','off'));

Error in gui_mainfcn>local_openfig (line 286)
gui_hFigure = matlab.hg.internal.openfigLegacy(name, singleton, visible);

Error in gui_mainfcn (line 158)
gui_hFigure = local_openfig(gui_State.gui_Name, gui_SingletonOpt, gui_Visible);

Error in REST (line 71)
gui_mainfcn(gui_State, varargin{:});

Error in test_script (line 100)
REST(opts)

Can you please let me know if you could update test_script.m which worked for you or share it with me on [email protected]?

@lucapton
Copy link
Collaborator

lucapton commented Jun 3, 2021

I'm sorry to say that the code you shared works for me. Perhaps it has something to do with the newer versions of matlab. I'm testing on 2019a (the only version I have available) while you're on 2021a. I'm not sure what else to do.

@piyushswami04
Copy link
Author

Hi,
Thanks for checking. I switched to matlab 2019a and ran the above code. It gave this error:
Dot indexing is not supported for variables of this type.

Error in env_translatepath (line 80)
filename = [tracking.paths.dependency_path filename(1+length('dependencies:'):end)];

Error in REST>REST_OpeningFcn (line 115)
handles.lsllib = lsl_loadlib(env_translatepath('dependencies:/liblsl-Matlab/bin'));

Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in REST (line 71)
gui_mainfcn(gui_State, varargin{:});

Error in test_script (line 97)
REST(opts)

When I checked online, I found once this suggested solution. Any suggestions on rectification of this error?
https://se.mathworks.com/matlabcentral/answers/399058-how-to-resolve-the-dot-indexing-not-supported-for-this-type-of-variable-error

Also, can you please let me know if the datasets used in your REST paper are publically available?

Thanks and Regards
Piyush

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants