Commit a10ae900 authored by Jesse Heckman's avatar Jesse Heckman
Browse files

cleared up runExp

parent dab5e229
function pb_vStoreBlockDat(cfg, Dat)
% PB_VSTOREBLOCKDAT()
%
% PB_VSTOREBLOCKDAT() ...
%
% See also ...
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
file = [cfg.dname '/block_info.m'];
save(file, 'Dat');
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
...@@ -19,12 +19,12 @@ function pb_vRunExp(handles) ...@@ -19,12 +19,12 @@ function pb_vRunExp(handles)
handles = pb_gethandles(handles); handles = pb_gethandles(handles);
handles = pb_getblock(handles); handles = pb_getblock(handles);
handles = pb_createdir(handles); handles = pb_createdir(handles);
handles = pb_vInitialize(handles,true); handles = pb_vInitialize(handles, true);
% set block information % set block information
block = handles.block; block = handles.block;
nblocks = handles.cfg.Blocks; nblocks = handles.cfg.Blocks;
Dat(nblocks) = struct('vestibular_signal',[],'PL',[],'OT',[],'LSL',[]); Dat(nblocks) = struct('vestibular_signal',[],'EV',[],'PL',[],'OT',[],'LSL',[]);
% initialize recordings % initialize recordings
rc = pb_runPupil; rc = pb_runPupil;
...@@ -72,8 +72,8 @@ function pb_vRunExp(handles) ...@@ -72,8 +72,8 @@ function pb_vRunExp(handles)
pb_vRunTrial(handles.cfg, stim); pb_vRunTrial(handles.cfg, stim);
pb_vTraces(handles); pb_vTraces(handles);
%handles = pb_vStoreData(handles, bDat); handles = pb_vStoreData(handles, sig);
handles = updateCount(handles,'trial','count'); handles = updateCount(handles,'trial','count');
toc(trialTime) toc(trialTime)
end end
...@@ -86,7 +86,7 @@ function pb_vRunExp(handles) ...@@ -86,7 +86,7 @@ function pb_vRunExp(handles)
if elapsedTime < dur; pause(dur-floor(elapsedTime)); end % wait untill chair is finished running before disabling. if elapsedTime < dur; pause(dur-floor(elapsedTime)); end % wait untill chair is finished running before disabling.
pb_stopServo(vs); pb_stopServo(vs);
Dat = pb_readServo; Dat = pb_readServo;
end end
% stop recording % stop recording
...@@ -94,19 +94,12 @@ function pb_vRunExp(handles) ...@@ -94,19 +94,12 @@ function pb_vRunExp(handles)
pb_stopLSL(ses); pb_stopLSL(ses);
% store data % store data
if ~exist('LSL_Dat','var') Dat(iBlck).EV = streams(1).read;
LSL_Data = {}; Dat(iBlck).PL = streams(2).read;
end %Dat(iBlck).OT = streams(3).read;
LSL_Dat.ev_dat = streams(1).read;
LSL_Dat.pl_dat = streams(2).read;
% LSL_Dat.ot_dat = str(3).read;
% TODO: SAVE LSL DATA
% save(lsl_file, 'LSL_Dat');
% update block information % update block information
handles = updateCount(handles,'block','count'); handles.cfg = updateCount(handles.cfg,'block','count');
end end
%% CHECK OUT %% CHECK OUT
...@@ -114,28 +107,30 @@ function pb_vRunExp(handles) ...@@ -114,28 +107,30 @@ function pb_vRunExp(handles)
% check out experiment % check out experiment
pb_vEndExp(handles.cfg); pb_vEndExp(handles.cfg);
pb_vInitialize(handles,false); pb_vStoreBlockDat(handles.cfg, Dat);
pb_vInitialize(handles, false);
toc(experimentTime) toc(experimentTime)
end end
%-- Feedback functions --% %-- Feedback functions --%
function updateTrial(handles) function updateTrial(handles)
% Updates the trial information to the GUI % Updates the trial information to the GUI
tn = handles.cfg.trialnumber; tn = handles.cfg.trialnumber;
handles.figure1.Name = ['vPrime - ' num2str(tn(2)) '/' num2str(handles.cfg.Trials) ' Trials']; % counting title handles.figure1.Name = ['vPrime - ' num2str(tn(2)) '/' num2str(handles.cfg.Trials) ' Trials']; % counting title
str = num2str(tn(1),'%03d'); % blocktrial str = num2str(tn(1),'%03d'); % blocktrial
set(handles.Tn,'string',str) set(handles.Tn,'string',str);
end end
function handles = updateCount(handles,varargin) function cfg = updateCount(cfg,varargin)
% Updates the count of trialnumber and block number during experiment % Updates the count of trialnumber and block number during experiment
cfg = handles.cfg;
% initializes update information
trial = pb_keyval('trial',varargin); trial = pb_keyval('trial',varargin);
block = pb_keyval('block',varargin); block = pb_keyval('block',varargin);
% sets trials
if ~isempty(trial) if ~isempty(trial)
switch trial switch trial
case 'count' case 'count'
...@@ -145,35 +140,15 @@ function handles = updateCount(handles,varargin) ...@@ -145,35 +140,15 @@ function handles = updateCount(handles,varargin)
end end
end end
% sets block
if ~isempty(block) if ~isempty(block)
switch block switch block
case 'count' case 'count'
cfg.blocknumber = cfg.blocknumber+1; cfg.blocknumber = cfg.blocknumber+1;
end end
end end
handles.cfg = cfg;
end end
%-- Run VC functions --%
% function send_profile(profile)
% % writing profile to servo
%
% vs = vs_servo;
% vs.write_profile(profile.v,profile.h);
% end
% function Dat = read_profile(vs)
% % read profile
%
% [sv.vertical,sv.horizontal] = vs.read_profile_sv;
% [pv.vertical,pv.horizontal] = vs.read_profile_pv;
%
% delete(vs);
%
% Dat.sv = sv;
% Dat.pv = pv;
% end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % %
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment