Commit 503c4d54 authored by Jesse Heckman's avatar Jesse Heckman

update draft and vPrime/sound

parent bdd9ad59
function pb_vSetSound(snd,cfg,RZ6str)
% PB_VSETSOUND()
% PB_VSETSOUND
%
% PB_VSETSOUND() ...
% PB_VSETSOUND(snd,cfg,RZ6str) sets sound parameters for modulated GWNs.
%
% See also ...
% See also PB_VPRIME, PB_VRUNEXP,PB_VSETUPTRIAL
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
......@@ -15,15 +15,12 @@ function pb_vSetSound(snd,cfg,RZ6str)
%% Filter properties
% The filter properties are set in the parameter file, which has the same
% name as the exp file, but with the extensenion .mat
id = snd.parameters;
par = cfg.parameters(id);
snd = addfields(snd,par);
%%
% cfg.(RZ6str).SetTagVal('delaySND1',snd.ondelay); %
% cfg.(RZ6str).SetTagVal('delaySND2',snd.ondelay); %
% cfg.(RZ6str).SetTagVal('soundDur1',dur); % default?
% cfg.(RZ6str).SetTagVal('soundDur2',dur); % default?
cfg.RZ6_1.SetTagVal('eventSND',snd.onevent+1);
cfg.RZ6_1.SetTagVal('delaySND',snd.ondelay);
......@@ -53,3 +50,4 @@ end
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
a
\ No newline at end of file
......@@ -21,24 +21,23 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
s = ledpattern(n);
cnt = 0;
for iLED = 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*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);
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(iLED).colour;
col = led(iLed).colour;
else
col = 1;
end
......@@ -46,26 +45,18 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
for ii = 1:2
cnt = cnt+1;
if ii==1
s(cnt).set(led(iLED).Z,cfg.ledcolours{col},1);
s(cnt).intensity(cfg.ledcolours{col},led(iLED).intensity); % Vestibular range 0-100;
s(cnt).set(led(iLed).Z,cfg.ledcolours{col},1);
s(cnt).intensity(cfg.ledcolours{col},led(iLed).intensity); % Vestibular range 0-100;
else
s(cnt).set(led(iLED).Z,cfg.ledcolours{col},0);
s(cnt).set(led(iLed).Z,cfg.ledcolours{col},0);
end
end
end
stim(find(selled,1)).ledhandle = ledcontroller_pi('dcn-led06','dcn-led07'); %% CORRECT THESE LOCATIONS
stim(find(selled,1)).ledhandle = ledcontroller_pi('dcn-led06','dcn-led07');
stim(find(selled,1)).ledhandle.write(s);
end
%% Acquisition
if any(selacq)
acq = stim(selacq);
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
%% Sound
if any(selsnd)
......@@ -87,18 +78,14 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
end
cfg.maxSamples = maxSamples;
%% Wait for?
% search for latest event with longest offset
% which should also include sampling period and sound although this does not have an
% offevent
%% Wait
e = [stim.offevent];
d = [stim.offdelay];
mxevent = max(e);
sel = ismember(e,mxevent);
mxdelay = max([d(sel) ceil(1000*cfg.nsamples./cfg.RZ6Fs) ]);
ev = stim.offevent;
de = stim.offdelay;
mxevent = max(ev);
sel = ismember(ev,mxevent);
mxdelay = max([de(sel) ceil(1000*cfg.nsamples./cfg.RZ6Fs) ]);
%%
cfg.RZ6_1.SetTagVal('eventWait',mxevent+1);
cfg.RZ6_1.SetTagVal('delayWait',mxdelay);
end
......
......@@ -35,22 +35,7 @@ function draft(obj)
hold on;
% Plot data
if ~isempty(obj(iAx).pva.y)
uC = unique(obj(iAx).pva.color);
nc = length(uC);
p = gobjects(0);
col = pb_selectcolor(nc,obj(iAx).pva.def);
% Group data
for iPl = 1:nc
x = obj(iAx).pva.x;
y = obj(iAx).pva.y;
ind = obj(iAx).pva.color == uC(iPl);
p(iPl) = plot(x(ind),y(ind),obj(iAx).pva.ls);
p(iPl).Color = col(iPl,:);
end
end
% Set proper labels
xlabel(obj(iAx).labels.xlab);
......
function draft2(obj)
% PB_DRAFT>DRAFT
%
% OBJ.DRAFT will draw a figure from a pb_draft-object.
%
% See also PB_DRAFT, SET_LABELS, SET_TITLE, SET_GRID, PRINT
% PBToolbox (2018): JJH: j.heckman@donders.ru.nl
% Select/make figure
if isempty(obj(1).parent)
for iObj = 1:numel(obj)
obj(iObj).parent = gcf;
end
end
% Set figure
set(obj(1).parent,'color','w');
t = sgtitle(obj(1).parent,obj(1).title);
set(t,'FontSize',20);
ax = gobjects(0);
dsz = size(obj);
% Draft each subplot
for iObj = 1:numel(obj)
iAx = pb_invidx([dsz(1), dsz(2)],iObj);
% Make axes
ax(iAx) = subplot(dsz(1),dsz(2),iObj); % pb_invidx([dsz(1), dsz(2)],iAx)
if obj(iAx).pva.subtitle; title(obj(iAx).pva.subtitle); end
axis(obj(iAx).pva.axis);
hold on;
% Plot data
if ~isempty(obj(iAx).pva.y)
uC = unique(obj(iAx).pva.color);
nc = length(uC);
p = gobjects(0);
col = pb_selectcolor(nc,obj(iAx).pva.def);
% Group data
for iPl = 1:nc
x = obj(iAx).pva.x;
y = obj(iAx).pva.y;
ind = obj(iAx).pva.color == uC(iPl);
p(iPl) = plot(x(ind),y(ind),obj(iAx).pva.ls);
p(iPl).Color = col(iPl,:);
end
end
% Set proper labels
xlabel(obj(iAx).labels.xlab);
ylabel(obj(iAx).labels.ylab);
% Make scientific notations on the axes.
ax(iAx).YAxis.Exponent = length(num2str(max(abs(round(ax(iAx).YLim)))))-1;
ax(iAx).XAxis.Exponent = length(num2str(max(abs(round(ax(iAx).XLim)))))-1;
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
......@@ -12,5 +12,3 @@ end
d.set_title('Saccade Latencies');
d.draft;
%d.print('disp',true);
\ No newline at end of file
% plotting order is wrong?
\ No newline at end of file
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