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
5dfe4218
Commit
5dfe4218
authored
Nov 21, 2018
by
Jesse Heckman
Browse files
adjusted trialduration in vExp
parent
456aba50
Changes
4
Hide whitespace changes
Inline
Side-by-side
setups/vestibular chair/vPrime/cfg/pb_getblock.m
View file @
5dfe4218
...
...
@@ -20,9 +20,27 @@ function handles = pb_getblock(handles)
%% Correct Block
block
=
pb_vPrimeZ
(
block
,
cfg
);
%% Timing
cfg
.
trialdur
=
getdurations
(
block
);
% sets trialdur
handles
.
block
=
block
;
handles
.
cfg
=
cfg
;
end
function
td
=
getduration
(
block
)
% extracts trial and block dur
stimarr
=
[];
blocksz
=
length
(
block
);
for
bidx
=
1
:
blocksz
trialsz
=
length
(
block
(
bidx
)
.
trial
);
for
tidx
=
1
:
trialsz
stimarr
(
end
+
1
)
=
block
(
bidx
)
.
trial
(
tidx
)
.
stim
(
end
)
.
offdelay
;
end
end
td
=
ceil
(
max
(
stimarr
)/
500
)/
2
;
% rounds up max trial duration with .5 precision
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
...
...
@@ -31,3 +49,4 @@ end
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
setups/vestibular chair/vPrime/core/experiment/trial/pb_vRunTrial.m
View file @
5dfe4218
function
pb_vRunTrial
(
cfg
,
stim
)
function
pb_vRunTrial
(
zbus
,
trialdur
)
% PB_VRUNTRIAL(HANDLES)
%
% PB_VRUNTRIAL(HANDLES) ...
...
...
@@ -8,17 +8,17 @@ function pb_vRunTrial(cfg,stim)
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
%% Run zBus
cfg
.
zB
us
.
zBusTrigA
(
0
,
0
,
2
);
% reset, clock start, (0,0,2): trigger entire rack, with a pulse structure, and 2 ms delay(2 ms = minimum).
zb
us
.
zBusTrigA
(
0
,
0
,
2
);
% reset, clock start, (0,0,2): trigger entire rack, with a pulse structure, and 2 ms delay(2 ms = minimum).
%% Trigger event 1
% cfg.zBus.zBusTrigB(0, 0, 2); % start event 1, trial onset
cfg
.
zB
us
.
zBusTrigB
(
0
,
0
,
2
);
% start event 1/trial onset; trigger zBus 4 = RA16;
zb
us
.
zBusTrigB
(
0
,
0
,
2
);
% start event 1/trial onset; trigger zBus 4 = RA16;
%% Button Press
% disp('Waiting for RZ6 button press/sound/led/acquisition');
t
=
tic
;
while
toc
(
t
)
<
2.5
while
toc
(
t
)
<
trialdur
% disp('waiting')
% do nothing
end
% sound is played after this loop exits.
...
...
setups/vestibular chair/vPrime/core/experiment/trial/pb_vStoreData.m
View file @
5dfe4218
function
handles
=
pb_vStoreData
(
handles
,
data
)
function
handles
=
pb_vStoreData
(
handles
,
data
,
stim
)
% PB_VSTOREDATA(HANDLES, DATA)
%
% PB_VSTOREDATA(HANDLES, DATA) stores all the trial data and configurements
...
...
@@ -15,21 +15,21 @@ function handles = pb_vStoreData(handles, data)
fname
=
[
prefix
'-'
num2str
(
cfg
.
trialnumber
(
2
),
'%04d'
)
'.vc'
];
data
=
data
;
%% TO DO: <-- FIX: SELECT DATA FOR TRIAL ONLY
beta
=
setCFG
(
cfg
);
%% TO DO: <-- FIX: SELECT CFGs FOR TRIAL ONLY
beta
=
setCFG
(
cfg
,
stim
);
%% TO DO: <-- FIX: SELECT CFGs FOR TRIAL ONLY
save
(
fname
,
'data'
,
'beta'
,
'-mat'
);
handles
.
cfg
=
cfg
;
end
function
beta
=
setCFG
(
cfg
)
function
beta
=
setCFG
(
cfg
,
stim
)
% stores relevant handles into a new trial cfg
beta
=
struct
(
'blocknumber'
,[],
...
'trialnumber'
,[],
...
'vestibularsignal'
,[],
...
'nstim'
,[],
...
'stim'
,
[]
);
'stim'
,
stim
);
beta
.
blocknumber
=
cfg
.
blocknumber
;
beta
.
trialnumber
=
cfg
.
trialnumber
;
...
...
setups/vestibular chair/vPrime/core/pb_vRunExp.m
View file @
5dfe4218
...
...
@@ -65,14 +65,14 @@ function pb_vRunExp(handles)
% setup trial
updateTrial
(
handles
);
stim
=
handles
.
block
(
iBlck
)
.
trial
(
iTrl
)
.
stim
;
handles
.
cfg
=
pb_vClearTrial
(
stim
,
handles
.
cfg
);
handles
.
cfg
=
pb_vClearTrial
(
stim
,
handles
.
cfg
);
[
stim
,
handles
.
cfg
]
=
pb_vSetupTrial
(
stim
,
handles
.
cfg
);
trialTime
=
tic
;
pb_vRunTrial
(
handles
.
cfg
,
stim
);
pb_vRunTrial
(
handles
.
cfg
.
zBus
,
handles
.
cfg
.
trialdur
);
pb_vTraces
(
handles
);
handles
=
pb_vStoreData
(
handles
,
sig
);
handles
=
pb_vStoreData
(
handles
,
sig
,
stim
);
handles
.
cfg
=
updateCount
(
handles
.
cfg
,
'trial'
,
'count'
);
toc
(
trialTime
)
end
...
...
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