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
50abb875
Commit
50abb875
authored
Sep 27, 2018
by
Jesse Heckman
Browse files
updated vPrime with inital LSC TDT interaction code
parent
308691fd
Changes
8
Hide whitespace changes
Inline
Side-by-side
setups/vestibular chair/vPrime/cfg/pb_createdir.m
View file @
50abb875
...
...
@@ -18,23 +18,22 @@ function handles = pb_createdir(handles)
fname
=
[
cfg
.
expInitials
'-'
cfg
.
subjectid
'-'
cfg
.
datestring
'-'
cfg
.
recording
'-0001.vc'
];
while
exist
(
fname
,
'file'
)
if
exist
(
fname
,
'file'
)
% Check for existing recordings
quest
=
'Recording already exists. Indicate how to proceed?'
;
answer
=
questdlg
(
quest
,
'Choices'
,
'Overwrite'
,
'
Increm
en
t
'
,
'Stop'
,
'Stop'
);
answer
=
questdlg
(
quest
,
'Choices'
,
'Overwrite'
,
'
App
en
d
'
,
'Stop'
,
'Stop'
);
switch
answer
case
'Overwrite'
break
;
case
'Increment'
cfg
.
recording
=
num2str
(
str2double
(
cfg
.
recording
)
+
1
,
'%04d'
);
case
'Append'
while
exist
(
fname
,
'file'
)
cfg
.
recording
=
num2str
(
str2double
(
cfg
.
recording
)
+
1
,
'%04d'
);
fname
=
[
cfg
.
expInitials
'-'
cfg
.
subjectid
'-'
cfg
.
datestring
'-'
cfg
.
recording
'-0001.vc'
];
end
set
(
handles
.
editRec
,
'string'
,
cfg
.
recording
);
case
'Stop'
error
(
'Run stopped.'
);
end
fname
=
[
cfg
.
expInitials
'-'
cfg
.
subjectid
'-'
cfg
.
datestring
'-'
cfg
.
recording
'-0001.vc'
];
end
handles
.
cfg
=
cfg
;
handles
=
pb_gethandles
(
handles
);
...
...
setups/vestibular chair/vPrime/core/experiment/block/pb_vSignalVC.m
View file @
50abb875
...
...
@@ -12,7 +12,6 @@ function [Dat,profile,dur] = pb_vSignalVC(handles)
bnumber
=
handles
.
cfg
.
blocknumber
;
%% READ SIGNAL PARAMETERS
signal
(
1
)
=
block
(
bnumber
)
.
signal
.
ver
;
signal
(
2
)
=
block
(
bnumber
)
.
signal
.
hor
;
signal
=
pb_vSafety
(
signal
);
...
...
@@ -22,41 +21,43 @@ function [Dat,profile,dur] = pb_vSignalVC(handles)
hSignal
=
pb_vCreateSignal
(
1
,
signal
(
2
)
.
duration
,
10
,
signal
(
2
)
.
frequency
,
signal
(
2
)
.
type
);
%% FINALIZE SIGNAL
Dat
.
v
.
x
=
vSignal
.
x
.*
signal
(
1
)
.
amplitude
;
profile
.
v
=
Dat
.
v
.
x
;
Dat
.
v
.
x
=
vSignal
.
x
.*
signal
(
1
)
.
amplitude
;
Dat
.
v
.
t
=
(
0
:
1
:
length
(
Dat
.
v
.
x
)
-
1
)/
10
;
Dat
.
h
.
x
=
hSignal
.
x
.*
signal
(
2
)
.
amplitude
;
profile
.
h
=
Dat
.
h
.
x
;
profile
.
v
=
Dat
.
v
.
x
;
Dat
.
h
.
x
=
hSignal
.
x
.*
signal
(
2
)
.
amplitude
;
Dat
.
h
.
t
=
(
0
:
1
:
length
(
Dat
.
h
.
x
)
-
1
)/
10
;
profile
.
h
=
Dat
.
h
.
x
;
Dat
.
v
.
amplitude
=
signal
(
1
)
.
amplitude
;
Dat
.
h
.
amplitude
=
signal
(
2
)
.
amplitude
;
Dat
.
v
.
amplitude
=
signal
(
1
)
.
amplitude
;
Dat
.
h
.
amplitude
=
signal
(
2
)
.
amplitude
;
dur
=
max
([
signal
(
1
)
.
duration
signal
(
2
)
.
duration
])
+
5
;
% add
5
extra seconds for delay of the system
dur
=
max
([
signal
(
1
)
.
duration
signal
(
2
)
.
duration
])
+
10
;
% add
10
extra seconds for delay of the system
%% FEEDBACK GUI
updateBlock
(
handles
,
bnumber
,
signal
);
handles
=
pb_gethandles
(
handles
);
updateBlock
(
handles
,
signal
);
cb
=
handles
.
cfg
.
blocknumber
;
dur
=
max
([
handles
.
block
(
c
b
)
.
signal
.
ver
.
duration
handles
.
block
(
c
b
)
.
signal
.
hor
.
duration
]);
handles
=
pb_gethandles
(
handles
)
;
dur
=
max
([
handles
.
block
(
b
number
)
.
signal
.
ver
.
duration
handles
.
block
(
b
number
)
.
signal
.
hor
.
duration
]);
axes
(
handles
.
signals
);
cla
;
hold
on
;
handles
.
signals
.
YLim
=
[
-
50
50
];
handles
.
signals
.
XLim
=
[
0
dur
];
axes
(
handles
.
signals
);
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'
);
end
function
updateBlock
(
handles
,
bnumber
,
signal
)
function
updateBlock
(
handles
,
signal
)
% Updates the block information to the GUI
bn
=
pb_sentenceCase
(
num2str
(
b
number
,
'%03d'
)
)
;
% count block
bn
=
num2str
(
handles
.
cfg
.
block
number
,
'%03d'
);
% count block
set
(
handles
.
Bn
,
'string'
,
bn
);
vs
=
[
'V = '
pb_sentenceCase
(
signal
(
1
)
.
type
)
...
% VC stim
', H = '
pb_sentenceCase
(
signal
(
2
)
.
type
)];
set
(
handles
.
Vs
,
'string'
,
vs
);
end
...
...
setups/vestibular chair/vPrime/core/experiment/trial/pb_vClearTrial.m
View file @
50abb875
function
pb_vClearTrial
(
handles
)
function
cfg
=
pb_vClearTrial
(
stim
,
cfg
)
% PB_VCLEARTRIAL(HANDLES)
%
% PB_VCLEARTRIAL(HANDLES) empties previous trial: data, stimuli, GUI, and
...
...
@@ -8,12 +8,35 @@ function pb_vClearTrial(handles)
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
tn
=
handles
.
cfg
.
trialnumber
;
bn
=
handles
.
cfg
.
blocknumber
;
%% Remove ledhandle if it exists
nstim
=
numel
(
stim
);
for
iStm
=
1
:
nstim
if
isfield
(
stim
(
iStm
),
'ledhandle'
)
if
~
isempty
(
stim
(
iStm
)
.
ledhandle
)
stim
(
iStm
)
.
ledhandle
.
delete
;
% delete(leds)/switch off light;
end
end
end
%% Turn off sounds
for
muxIdx
=
1
:
2
% MUX(cfg.RZ6_1,muxIdx,0)
end
%% Initiate trial
tn
=
cfg
.
trialnumber
;
bn
=
cfg
.
blocknumber
;
disp
([
newline
'<strong>New Trial started...</strong> '
...
newline
' Trial: '
num2str
(
tn
(
2
))
' (B'
num2str
(
bn
)
'T'
num2str
(
tn
(
1
))
')'
]);
if
ispc
cfg
.
zBus
.
zBusTrigA
(
0
,
0
,
2
);
% reset, clock start, (0,0,2): trigger entire rack, with a pulse structure, and 2 ms delay(2 ms = minimum).
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
...
...
setups/vestibular chair/vPrime/core/experiment/trial/pb_vSetupTrial.m
View file @
50abb875
function
pb_vSetupTrial
(
stim
,
cfg
)
% PB_VSETUPTRIAL()
function
[
stim
,
cfg
]
=
pb_vSetupTrial
(
stim
,
cfg
)
% PB_VSETUPTRIAL(
STIM, CFG
)
%
% PB_VSETUPTRIAL(
) ..
.
% PB_VSETUPTRIAL(
STIM, CFG) sets up experimental parameters for Trial
.
%
% See also
..
.
% See also
PB_VPRIME, PB_VPRIMEGUI, PB_VRUNEXP
.
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
...
...
@@ -89,14 +89,6 @@ function pb_vSetupTrial(stim,cfg)
end
cfg
.
maxSamples
=
maxSamples
;
%% Sound Acquisition
% if any(selsndacq)
% sndacq = stim(selsndacq);
% cfg.RP2_1.SetTagVal('eventAcq',sndacq.onevent+1);
% cfg.RP2_1.SetTagVal('delayAcq',sndacq.ondelay);
% cfg.RP2_1.SetTagVal('acqSamples',cfg.nsamples); % amount of DA samples
% end
%% Wait for?
% This needs some tweaking
% search for latest event with longest offset
...
...
setups/vestibular chair/vPrime/core/experiment/trial/pb_vTraces.m
View file @
50abb875
function
pb_vTraces
(
h
)
% PB_VTRACES()
function
pb_vTraces
(
h
andles
)
% PB_VTRACES(
HANDLES
)
%
% PB_VTRACES() ...
% PB_VTRACES(HANDLES) updates the trace velocity plots of eye and head in
% GUI.
%
% See also ...
...
...
@@ -9,7 +10,7 @@ function pb_vTraces(h)
%% PLOT TRACES
% head trace
axes
(
h
.
hTrace
);
hold
on
;
axes
(
h
andles
.
hTrace
);
hold
on
;
ws
=
20
;
b
=
(
1
/
ws
)
*
ones
(
1
,
ws
);
a
=
1
;
x
=
0
:
.
05
:
2.5
;
...
...
@@ -18,7 +19,7 @@ function pb_vTraces(h)
plot
(
x
,
y
);
% eye trace
axes
(
h
.
eTrace
);
hold
on
;
axes
(
h
andles
.
eTrace
);
hold
on
;
ws
=
20
;
b
=
(
1
/
ws
)
*
ones
(
1
,
ws
);
a
=
1
;
x
=
0
:
.
05
:
2.5
;
...
...
@@ -27,8 +28,8 @@ function pb_vTraces(h)
plot
(
x
,
y
);
%% HIGHLIGHT CURRENT
te
=
pb_fobj
(
h
.
eTrace
,
'Type'
,
'Line'
);
th
=
pb_fobj
(
h
.
hTrace
,
'Type'
,
'Line'
);
te
=
pb_fobj
(
h
andles
.
eTrace
,
'Type'
,
'Line'
);
th
=
pb_fobj
(
h
andles
.
hTrace
,
'Type'
,
'Line'
);
col
=
pb_selectcolor
(
10
,
5
);
for
iT
=
1
:
length
(
th
)
...
...
@@ -41,6 +42,7 @@ function pb_vTraces(h)
te
(
iT
)
.
Color
=
col
(
1
,:);
end
end
pause
(
1
);
% Hold for a sec!
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
...
...
setups/vestibular chair/vPrime/core/pb_vRunExp.m
View file @
50abb875
...
...
@@ -40,20 +40,21 @@ function pb_vRunExp(handles)
vs
.
start
;
tic
;
end
% RUN TRIALS
for
iTr
ia
l
=
1
:
nTrials
%
%
RUN TRIALS
for
iTrl
=
1
:
nTrials
% Runs all trials within one block
updateTrial
(
handles
);
pb_vClearTrial
(
handles
);
stim
=
handles
.
block
(
iBlck
)
.
trial
(
iTrl
)
.
stim
;
handles
.
cfg
=
pb_vClearTrial
(
stim
,
handles
.
cfg
);
handles
=
pb_vStoreData
(
handles
,
bDat
);
handles
=
updateCount
(
handles
,
'trial'
,
'count'
);
pb_vTraces
(
handles
);
pause
(
1
);
%
pb_v
SetupTrial(block(iBlock).trial(iTrial).stim,cfg);
%pb_vRunTrial(experiment(iTrial)
);
%pb_vFeedbackGUI();
pb_vSetupTrial
(
stim
,
cfg
);
% pb_vRunTrial(experiment(iTrial)
);
% pb_vFeedbackGUI(); %% <-- MAYBE NOT NECESSAIRY?
pb_v
Traces
(
handles
);
handles
=
pb_vStoreData
(
handles
,
bDat
);
handles
=
updateCount
(
handles
,
'trial'
,
'count'
);
% update trial
end
% STOP CHAIR
...
...
setups/vestibular chair/vPrime/tdt/pb_tdtinit.m
View file @
50abb875
function
handles
=
pb_tdtinit
(
handles
)
% PB_TDTINIT()
% PB_TDTINIT(
HANDLES
)
%
% PB_TDTINIT(
) ..
.
% PB_TDTINIT(
HANDLES) sets tdt initials prior to experimentation
.
%
% See also
...
% See also
PB_VPRIME, PB_VPRIMEGUI
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
...
...
utilities/strfun/pb_sentenceCase.m
View file @
50abb875
function
str
=
pb_sentenceCase
(
str
)
% PB_SENTENCECASE()
% PB_SENTENCECASE(
STR
)
%
% PB_SENTENCECASE() ...
% PB_SENTENCECASE(STR) returns any input string in sentence case
% capitalization.
%
% See also ...
...
...
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