Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jesse Heckman
pbtoolbox
Commits
464e3707
Commit
464e3707
authored
Dec 07, 2018
by
Jesse Heckman
Browse files
update vPrime: clean up, improvement of vestibular checks
parent
6f3316b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
setups/vestibular chair/vPrime/core/experiment/block/pb_vCheckVelSignal.m
0 → 100644
View file @
464e3707
function
[
safe
,
threshold
]
=
pb_vCheckVelSignal
(
signal
)
% PB_VCHECKVELSIGNAL
%
% PB_VCHECKVELSIGNAL(signal) checks if the velocity profile of the signal
% exceeds a certain threshold.
%
% See also PB_VCREATESIGNAL, PB_VSAFETY
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
safe
=
true
;
threshold
=
50
;
% Should be 50 d/s: DO NOT CHANGE!!
SR
=
10
;
mvel
=
SR
*
max
(
abs
(
diff
(
signal
)));
if
mvel
>
threshold
;
safe
=
false
;
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
setups/vestibular chair/vPrime/core/experiment/block/pb_vSignalVC.m
View file @
464e3707
...
...
@@ -36,8 +36,16 @@ function [Dat,profile,dur] = pb_vSignalVC(handles)
Dat
.
v
.
amplitude
=
signal
(
1
)
.
amplitude
;
Dat
.
h
.
amplitude
=
signal
(
2
)
.
amplitude
;
% dur = max([signal(1).duration signal(2).duration])+10; % add 10 extra seconds for delay of the system
%% CHECK SAFETY FINAL SIGNAL
[
hSafe
,
~
]
=
pb_vCheckVelSignal
(
Dat
.
h
.
x
);
[
vSafe
,
mvel
]
=
pb_vCheckVelSignal
(
Dat
.
v
.
x
);
if
~
hSafe
||
~
vSafe
error
([
'Vestibular signals were not safe! (velocity exceeds '
num2str
(
mvel
)
')'
]);
end
%% FEEDBACK GUI
updateBlock
(
handles
,
signal
);
...
...
@@ -48,18 +56,21 @@ function [Dat,profile,dur] = pb_vSignalVC(handles)
cla
;
hold
on
;
handles
.
signals
.
YLim
=
[
-
50
50
];
handles
.
signals
.
XLim
=
[
0
dur
];
plot
(
Dat
.
v
.
t
,
Dat
.
v
.
x
,
'k'
);
plot
(
Dat
.
h
.
t
,
Dat
.
h
.
x
,
'b'
);
dv
=
10
*
[
0
diff
(
Dat
.
v
.
x
)];
dh
=
10
*
[
0
diff
(
Dat
.
h
.
x
)];
plot
(
Dat
.
v
.
t
,
dv
,
'k'
);
plot
(
Dat
.
h
.
t
,
dh
,
'b'
);
end
function
updateBlock
(
handles
,
signal
)
% Updates the block information to the GUI
bn
=
num2str
(
handles
.
cfg
.
blocknumber
,
'%03d'
);
% count block
bn
=
num2str
(
handles
.
cfg
.
blocknumber
,
'%03d'
);
set
(
handles
.
Bn
,
'string'
,
bn
);
vs
=
[
'V = '
pb_sentenceCase
(
signal
(
1
)
.
type
)
...
% VC stim
vs
=
[
'V = '
pb_sentenceCase
(
signal
(
1
)
.
type
)
...
', H = '
pb_sentenceCase
(
signal
(
2
)
.
type
)];
set
(
handles
.
Vs
,
'string'
,
vs
);
...
...
setups/vestibular chair/vPrime/core/pb_vRunExp.m
View file @
464e3707
...
...
@@ -24,9 +24,9 @@ function pb_vRunExp(handles)
handles
=
pb_vInitialize
(
handles
,
true
);
% set block information
block
=
handles
.
block
;
nblocks
=
handles
.
cfg
.
Blocks
;
Dat
=
pb_dataobj
(
nblocks
);
block
=
handles
.
block
;
nblocks
=
handles
.
cfg
.
Blocks
;
Dat
=
pb_dataobj
(
nblocks
);
% initialize recordings
rc
=
pb_runPupil
;
...
...
@@ -40,12 +40,9 @@ function pb_vRunExp(handles)
% Runs blocks of trials with a vestibular condition
% set block information
nTrials
=
length
(
block
(
iBlck
)
.
trial
);
handles
=
updateCount
(
handles
,
'trial'
,
'reset'
);
% store signal data
[
sig
,
profile
,
dur
]
=
pb_vSignalVC
(
handles
);
% reads, checks, creates & plots vestibular signals
%Dat(iBlck).vestibular_signal = sig;
nTrials
=
length
(
block
(
iBlck
)
.
trial
);
handles
=
updateCount
(
handles
,
'trial'
,
'reset'
);
[
sig
,
profile
,
dur
]
=
pb_vSignalVC
(
handles
);
% start recording
pb_startLSL
(
ses
);
...
...
@@ -117,7 +114,7 @@ function pb_vRunExp(handles)
toc
(
experimentTime
)
end
%--
F
eedback functions --%
%--
GUI f
eedback functions --%
function
updateTrial
(
handles
)
% Updates the trial information to the GUI
...
...
setups/vestibular chair/vPrime/gui/pb_vPrimeGUI.fig
View file @
464e3707
No preview for this file type
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment