Skip to content
GitLab
Menu
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
7c9c5323
Commit
7c9c5323
authored
Sep 28, 2018
by
Jesse Heckman
Browse files
update vPrime trial
parent
0b5a231b
Changes
5
Hide whitespace changes
Inline
Side-by-side
setups/vestibular chair/vPrime/core/experiment/trial/pb_vRunTrial.m
0 → 100644
View file @
7c9c5323
function
pb_vRunTrial
(
handles
)
% PB_VRUNTRIAL(HANDLES)
%
% PB_VRUNTRIAL(HANDLES) ...
%
% See also ...
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
setups/vestibular chair/vPrime/core/experiment/trial/pb_vSetupTrial.m
View file @
7c9c5323
...
...
@@ -23,33 +23,33 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
s
=
ledpattern
(
n
);
%%
cnt
=
0
;
for
ledIdx
=
1
:
nled
for
iLED
=
1
:
nled
% TDT RZ6
% Set timing information on LEDs
% Note that in RZ6 circuit, event 1 = start of experiment
str1
=
[
'eventLED'
num2str
(
2
*
ledIdx
-
1
)];
str2
=
[
'eventLED'
num2str
(
2
*
ledIdx
)];
cfg
.
RZ6_1
circuit
.
SetTagVal
(
str1
,
led
(
ledIdx
)
.
onevent
+
1
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
str2
,
led
(
ledIdx
)
.
offevent
+
1
);
str1
=
[
'delayLED'
num2str
(
2
*
ledIdx
-
1
)];
str2
=
[
'delayLED'
num2str
(
2
*
ledIdx
)];
cfg
.
RZ6_1
circuit
.
SetTagVal
(
str1
,
led
(
ledIdx
)
.
ondelay
+
1
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
str2
,
led
(
ledIdx
)
.
offdelay
+
1
);
str1
=
[
'eventLED'
num2str
(
2
*
iLED
-
1
)];
str2
=
[
'eventLED'
num2str
(
2
*
iLED
)];
cfg
.
RZ6_1
.
SetTagVal
(
str1
,
led
(
iLED
)
.
onevent
+
1
);
cfg
.
RZ6_1
.
SetTagVal
(
str2
,
led
(
iLED
)
.
offevent
+
1
);
str1
=
[
'delayLED'
num2str
(
2
*
iLED
-
1
)];
str2
=
[
'delayLED'
num2str
(
2
*
iLED
)];
cfg
.
RZ6_1
.
SetTagVal
(
str1
,
led
(
iLED
)
.
ondelay
+
1
);
cfg
.
RZ6_1
.
SetTagVal
(
str2
,
led
(
iLED
)
.
offdelay
+
1
);
% PLC
if
isfield
(
led
,
'colour'
)
col
=
led
(
ledIdx
)
.
colour
;
col
=
led
(
iLED
)
.
colour
;
else
col
=
1
;
end
cnt
=
0
;
for
ii
=
1
:
2
cnt
=
cnt
+
1
;
if
ii
==
1
s
(
cnt
)
.
set
(
led
(
ledIdx
)
.
Z
,
cfg
.
ledcolours
{
col
},
1
);
s
(
cnt
)
.
intensity
(
cfg
.
ledcolours
{
col
},
led
(
ledIdx
)
.
intensity
);
% hoop: range 0-255, sphere range 1-50
s
(
cnt
)
.
set
(
led
(
iLED
)
.
Z
,
cfg
.
ledcolours
{
col
},
1
);
s
(
cnt
)
.
intensity
(
cfg
.
ledcolours
{
col
},
led
(
iLED
)
.
intensity
);
% hoop: range 0-255, sphere range 1-50
else
s
(
cnt
)
.
set
(
led
(
ledIdx
)
.
Z
,
cfg
.
ledcolours
{
col
},
0
);
s
(
cnt
)
.
set
(
led
(
iLED
)
.
Z
,
cfg
.
ledcolours
{
col
},
0
);
end
end
end
...
...
@@ -61,9 +61,9 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
%% Acquisition
if
any
(
selacq
)
acq
=
stim
(
selacq
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
'eventAcq'
,
acq
.
onevent
+
1
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
'delayAcq'
,
acq
.
ondelay
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
'acqSamples'
,
cfg
.
nsamples
);
% amount of DA samples
cfg
.
RZ6_1
.
SetTagVal
(
'eventAcq'
,
acq
.
onevent
+
1
);
cfg
.
RZ6_1
.
SetTagVal
(
'delayAcq'
,
acq
.
ondelay
);
cfg
.
RZ6_1
.
SetTagVal
(
'acqSamples'
,
cfg
.
nsamples
);
% amount of DA samples
end
...
...
@@ -73,13 +73,13 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
if
any
(
selsnd
)
snd
=
stim
(
selsnd
);
nsnd
=
numel
(
snd
);
for
sndIdx
=
1
:
nsnd
sndsetup
=
cfg
.
lookup
(
snd
(
sndIdx
)
.
Z
+
1
,
2
:
4
);
for
iSND
=
1
:
nsnd
sndsetup
=
cfg
.
lookup
(
snd
(
iSND
)
.
Z
+
1
,
2
:
4
);
switch
sndsetup
(
1
)
case
1
maxSamples
=
setSound
(
snd
(
sndIdx
),
cfg
,
'RP2_1'
);
maxSamples
=
setSound
(
snd
(
iSND
),
cfg
,
'RP2_1'
);
case
2
maxSamples
=
setSound
(
snd
(
sndIdx
),
cfg
,
'RP2_2'
);
maxSamples
=
setSound
(
snd
(
iSND
),
cfg
,
'RP2_2'
);
end
end
end
...
...
@@ -101,8 +101,8 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
mxdelay
=
max
([
d
(
sel
)
ceil
(
1000
*
cfg
.
nsamples
.
/
cfg
.
medusaFs
)
ceil
(
1000
*
maxSamples
/
48828.125
)]);
%%
cfg
.
RZ6_1
circuit
.
SetTagVal
(
'eventWait'
,
mxevent
+
1
);
cfg
.
RZ6_1
circuit
.
SetTagVal
(
'delayWait'
,
mxdelay
);
cfg
.
RZ6_1
.
SetTagVal
(
'eventWait'
,
mxevent
+
1
);
cfg
.
RZ6_1
.
SetTagVal
(
'delayWait'
,
mxdelay
);
end
...
...
setups/vestibular chair/vPrime/core/experiment/trial/pb_vStoreData.m
View file @
7c9c5323
...
...
@@ -4,26 +4,37 @@ function handles = pb_vStoreData(handles, data)
% PB_VSTOREDATA(HANDLES, DATA) stores all the trial data and configurements
% on a trial basis in organized vc-files.
%
% See also PB_VPRIME, PB_VPRIMEGUI, PB_VRUNEXP
% See also PB_VPRIME, PB_VPRIMEGUI, PB_VRUNEXP
, PB_TDTINIT
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
cfg
=
handles
.
cfg
;
cd
([
cfg
.
dname
filesep
'trial'
])
[
~
,
prefix
]
=
pb_fext
(
cfg
.
fname
);
fname
=
[
prefix
'-'
num2str
(
cfg
.
trialnumber
(
2
),
'%04d'
)
'.vc'
];
data
=
data
;
%% TO DO: <-- FIX: SELECT DATA FOR TRIAL ONLY
cfg
=
cfg
;
%% TO DO: <-- FIX: SELECT CFGs FOR TRIAL ONLY
data
=
data
;
%% TO DO: <-- FIX: SELECT DATA FOR TRIAL ONLY
beta
=
setCFG
(
cfg
)
;
%% TO DO: <-- FIX: SELECT CFGs FOR TRIAL ONLY
save
(
fname
,
'data'
,
'
cfg
'
,
'-mat'
);
save
(
fname
,
'data'
,
'
beta
'
,
'-mat'
);
handles
.
cfg
=
cfg
;
end
function
beta
=
setCFG
(
cfg
)
% stores relevant handles into a new trial cfg
beta
=
struct
(
'blocknumber'
,[],
...
'trialnumber'
,[],
...
'vestibularsignal'
,[],
...
'nstim'
,[],
...
'stim'
,[]);
beta
.
blocknumber
=
cfg
.
blocknumber
;
beta
.
trialnumber
=
cfg
.
trialnumber
;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
...
...
setups/vestibular chair/vPrime/core/pb_vRunExp.m
View file @
7c9c5323
...
...
@@ -11,6 +11,8 @@ function pb_vRunExp(handles)
%% INITIALIZE
% load & read experiment
debug
=
true
;
pb_setupShow
(
handles
);
handles
=
pb_gethandles
(
handles
);
handles
=
pb_getblock
(
handles
);
...
...
@@ -32,7 +34,7 @@ function pb_vRunExp(handles)
[
bDat
(
iBlck
),
profile
,
dur
]
=
pb_vSignalVC
(
handles
);
% reads, checks, creates & plots vestibular signals
% START CHAIR
if
~
ismac
if
~
ismac
&&
~
debug
send_profile
(
profile
);
vs
=
vs_servo
;
...
...
@@ -48,7 +50,7 @@ function pb_vRunExp(handles)
stim
=
handles
.
block
(
iBlck
)
.
trial
(
iTrl
)
.
stim
;
handles
.
cfg
=
pb_vClearTrial
(
stim
,
handles
.
cfg
);
[
stim
,
cfg
]
=
pb_vSetupTrial
(
stim
,
handles
.
cfg
);
%
[stim, cfg] = pb_vSetupTrial(stim,handles.cfg);
% pb_vRunTrial(experiment(iTrial));
% pb_vFeedbackGUI(); %% <-- MAYBE NOT NECESSAIRY?
...
...
@@ -58,7 +60,7 @@ function pb_vRunExp(handles)
end
% STOP CHAIR
if
~
ismac
if
~
ismac
&&
~
debug
elapsedTime
=
toc
;
if
elapsedTime
<
dur
;
pause
(
dur
-
floor
(
elapsedTime
));
end
% wait untill chair is finished running before disabling.
...
...
setups/vestibular chair/vPrime/tdt/pb_tdtinit.m
View file @
7c9c5323
...
...
@@ -3,17 +3,15 @@ function handles = pb_tdtinit(handles)
%
% PB_TDTINIT(HANDLES) sets tdt initials prior to experimentation.
%
% See also PB_VPRIME, PB_VPRIMEGUI
% See also PB_VPRIME, PB_VPRIMEGUI
, PB_VSETUPTRIAL
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
if
~
ispc
;
return
;
end
%% Active X Control/Objects
% cfg.HF = figure('Tag','ActXWin','name','ActiveX Window for TDT','numbertitle','off','menubar','none'); % Figure for ActiveX components
zBus
=
ZBUS
(
1
);
% zBus, number of racks
RZ6_1
=
RZ6
(
1
,
handles
.
cfg
.
RZ6_1circuit
);
% Real-time acquisition
zBus
=
ZBUS
(
1
);
% zBus, number of racks
RZ6_1
=
RZ6
(
1
,
handles
.
cfg
.
RZ6_1circuit
);
% Real-time acquisition
Fs
=
RZ6_1
.
GetSFreq
;
handles
.
cfg
.
RZ6Fs
=
Fs
;
...
...
@@ -24,7 +22,6 @@ function handles = pb_tdtinit(handles)
%% TDT status
handles
.
cfg
.
RZ6_1Status
=
RZ6_1
.
GetStatus
;
%handles = tdt_monitorMinor(handles);
%% Configuration
handles
.
cfg
.
RZ6_1
=
RZ6_1
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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