Commit 2aee18c1 authored by Jesse Heckman's avatar Jesse Heckman

light warning

parent 8b8c6a2c
function pb_vGenExp_Vis(varargin) function pb_vGenExp_VisFlash(varargin)
% PB_VGENEXP_VIS() % PB_VGENEXP_VIS()
% %
% PB_VGENEXP_VIS() will generate an EXP-file for a default localization experiment. % PB_VGENEXP_VIS() will generate an EXP-file for a default localization experiment.
...@@ -19,7 +19,7 @@ function pb_vGenExp_Vis(varargin) ...@@ -19,7 +19,7 @@ function pb_vGenExp_Vis(varargin)
% %
% See also WRITESND, WRITELED, WRITETRG, GENWAV_DEFAULT, etc % See also WRITESND, WRITELED, WRITETRG, GENWAV_DEFAULT, etc
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl % PBToolbox (2019): JJH: j.heckman@donders.ru.nl
%% Initialization %% Initialization
% Clear, empty, default imputs % Clear, empty, default imputs
...@@ -30,8 +30,15 @@ function pb_vGenExp_Vis(varargin) ...@@ -30,8 +30,15 @@ function pb_vGenExp_Vis(varargin)
cfn = 0; cfn = 0;
% Get Filename
st = dbstack;
sname = st.name;
ind = strfind(sname,'_');
if isempty(ind); ind = 0; end
fn = sname(max(ind)+1:end);
showexp = pb_keyval('showexp',varargin,true); showexp = pb_keyval('showexp',varargin,true);
expfile = pb_keyval('fname',varargin,'VOR.exp'); expfile = pb_keyval('fname',varargin,[fn '.exp']);
datdir = pb_keyval('datdir',varargin,'DEFAULT'); datdir = pb_keyval('datdir',varargin,'DEFAULT');
cdir = pb_keyval('cdir',varargin,userpath); cdir = pb_keyval('cdir',varargin,userpath);
...@@ -132,8 +139,8 @@ function pb_vGenExp_Vis(varargin) ...@@ -132,8 +139,8 @@ function pb_vGenExp_Vis(varargin)
blockconditions = []; blockconditions = [];
nblockreps = N/trialsinblock; nblockreps = N/trialsinblock;
block(1).Horizontal = struct('Amplitude', 0, 'Signal', 1, 'Duration', blockdur, 'Frequency',.1); block.Horizontal = struct('Amplitude', 0, 'Signal', 1, 'Duration', blockdur, 'Frequency',.16);
block(1).Vertical = struct('Amplitude', 0, 'Signal', 2, 'Duration', blockdur, 'Frequency',.1); block.Vertical = struct('Amplitude', 30, 'Signal', 2, 'Duration', blockdur, 'Frequency',.16);
%% Save data somewhere %% Save data somewhere
writeexp(expfile,datdir,X,Y,int,dur,block,fixled); writeexp(expfile,datdir,X,Y,int,dur,block,fixled);
% see below, these are helper functions to write an exp-file line by line / stimulus by stimulus % see below, these are helper functions to write an exp-file line by line / stimulus by stimulus
...@@ -171,18 +178,21 @@ function writeexp(expfile,datdir,theta,phi,int,dur,block,fixled) ...@@ -171,18 +178,21 @@ function writeexp(expfile,datdir,theta,phi,int,dur,block,fixled)
Mtr = 'n'; % the motor should be on Mtr = 'n'; % the motor should be on
pb_vWriteHeader(fid,datdir,ITI,blocksz,blocksz*trialsz*Rep,Rep,Rnd,Mtr,'Lab',5); % helper-function pb_vWriteHeader(fid,datdir,ITI,blocksz,blocksz*trialsz*Rep,Rep,Rnd,Mtr,'Lab',5); % helper-function
for iBlock = 1:blocksz
% Write blocks
pb_vWriteBlock(fid,iBlock);
pb_vWriteSignal(fid,block(iBlock));
%pl = 1:trialsz;
pl = randperm(trialsz); % randomize trialorder in blocks pl = randperm(trialsz); % randomize trialorder in blocks
newBlock = true;
totalDur = 0;
iBlock = 1;
for iTrial = 1:trialsz for iTrial = 1:trialsz
% Write trials % Write trials
if newBlock == true
% Write blocks
pb_vWriteBlock(fid,iBlock);
pb_vWriteSignal(fid,block);
newBlock = false;
iBlock = iBlock+1;
end
pb_vWriteTrial(fid,trlIdx); pb_vWriteTrial(fid,trlIdx);
VIS = []; VIS = [];
...@@ -200,7 +210,8 @@ function writeexp(expfile,datdir,theta,phi,int,dur,block,fixled) ...@@ -200,7 +210,8 @@ function writeexp(expfile,datdir,theta,phi,int,dur,block,fixled)
trlIdx = trlIdx+1; trlIdx = trlIdx+1;
pb_vWriteStim(fid,2,[],VIS); pb_vWriteStim(fid,2,[],VIS);
end totalDur = totalDur + VIS.Offset + 1000;
if totalDur >= (200-1.5)*1000; totalDur = 0; newBlock = true; end
end end
fclose(fid); fclose(fid);
end end
......
...@@ -10,8 +10,8 @@ function pb_vWriteSignal(fid,block) ...@@ -10,8 +10,8 @@ function pb_vWriteSignal(fid,block)
h = block.Horizontal; h = block.Horizontal;
v = block.Vertical; v = block.Vertical;
fprintf(fid,'%s\t\t%d\t%d\t%d\t%0.1f\n','HOR',h.Signal,h.Amplitude,h.Duration,h.Frequency); fprintf(fid,'%s\t\t%d\t%d\t%d\t%0.2f\n','HOR',h.Signal,h.Amplitude,h.Duration,h.Frequency);
fprintf(fid,'%s\t\t%d\t%d\t%d\t%0.1f\n','VER',v.Signal,v.Amplitude,v.Duration,v.Frequency); fprintf(fid,'%s\t\t%d\t%d\t%d\t%0.2f\n','VER',v.Signal,v.Amplitude,v.Duration,v.Frequency);
end end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
......
function pb_lightwarning()
% PB_LIGHTWARNING()
%
% PB_LIGHTWARNING() ...
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
import org.zeromq.ZMQ
leds = ledcontroller_pi('dcn-led06','dcn-led07','dcn-led09','dcn-led10');
n = 4;
s = ledpattern(n);
ir = 50;
ig = ir;
% Sequence needs updating due to new SLC distribution
seq1 = [0:9 fliplr(16:1:63)]; %% [0:2:63];
seq2 = []; %% [1:2:63];
for iC = 1:n
if mod(iC,2) == 0
s(iC).set(seq1,'r');
else
s(iC).set(seq2,'g');
end
s(iC).intensity('r', ir);
s(iC).intensity('g', ig);
end
leds.write(s);
for iC = 1:n
leds.trigger;
if isodd(iC); pause(0.3); else; pause(0.15); end
end
delete(s);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
Markdown is supported
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