Commit 9ece08f3 authored by Jesse Heckman's avatar Jesse Heckman

update new directions

parent 4eee5544
function [out,certainty] = pb_neuralnetwork(varargin)
% PB_NEURALNETWORK()
%
% PB_NEURALNETWORK() ...
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
v = varargin;
in = pb_keyval('in',v);
out = in;
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\ No newline at end of file
......@@ -23,10 +23,10 @@ function signal = pb_cleanSP(signal,len)
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2018) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
......@@ -51,7 +51,7 @@ function pb_vGenexp_defAud
%length sound
maxsnd = 200 ;
minsnd = 200 ;
dur = [250];
dur = [100];
dur = dur(:) ;
......@@ -155,7 +155,7 @@ function writeexp(expfile,datdir,X,Y,snd,int,ledon,sndon,dur,block)
Rep = 1; % we have 0 repetitions, so insert 1...
Rnd = 0; % we randomized ourselves already
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*ntrials*Rep,Rep,Rnd,Mtr,'Lab',5); % helper-function
%% Body of exp-file
% Create a trial
......
......@@ -33,18 +33,18 @@ function draft(obj)
%% Set Compare Axis
% Check and set comparing axis
% ax = gobjects(0);
% objsz = size(obj);
%
% nCmp = length(unique(obj(1).pva.axcomp.feature));
% if min(objsz) > 1; nCmp = 1; end
%
% cmpsz = [1 1];
% [~,cmpInd] = max(cmpsz);
% cmpsz(cmpInd) = nCmp;
% cmpsz = fliplr(cmpsz);
%
% obj(1).h_ax_plot.sz = cmpsz .* size(obj);
ax = gobjects(0);
objsz = size(obj);
nCmp = length(unique(obj(1).pva.axcomp.feature));
if min(objsz) > 1; nCmp = 1; end
cmpsz = [1 1];
[~,cmpInd] = max(cmpsz);
cmpsz(cmpInd) = nCmp;
cmpsz = fliplr(cmpsz);
obj(1).h_ax_plot.sz = cmpsz .* size(obj);
%% Create Plots
% Draft each subplot
......
......@@ -6,30 +6,48 @@ load('exD_saccade'); % load example data
cfn = 0; % Initialize current figure number
run = 9; % Set # of blocks to run
%%
%%
d = pb_draft('x',Saccades.GazeLatency,'y',Saccades.HeadLatency,'color',Saccades.Modality);
d.plot_bubble;
d.set_title('Saccade Latencies');
d.set_grid;
d.set_legend('Entries',{'Audio','Visual','Audiovisual'});
% Build
d.draft;
%%
figure;
bubbleplot(Saccades.GazeLatency,Saccades.HeadLatency,'Xwidth',50,'Ywidth',50);
%% Block 1:
% Make figure 1: Plot data
% if run>cfn
% % Make figure & draft-obj
% cfn = pb_newfig(cfn,'size',[0 0 17 17],'resize','off');
% d = pb_draft('x',Saccades.GazeLatency,'y',Saccades.HeadLatency,'color',Saccades.Modality);
%
% % Plots
% d.plot_rawdata
% d.plot_vline('type','mode');
% d.plot_hline('type','mode');
%
% % Layout
% %d.set_axcomp(Saccades.Subject);
% d.set_title('Saccade Latencies');
% d.set_labels('x','Gaze Latency (ms)','y','Head Latency (ms)');
% d.set_grid;
% d.set_legend('Entries',{'Audio','Visual','Audiovisual'});
%
% % Build
% d.draft
% d.print('disp',true);
% end
if run>cfn
% Make figure & draft-obj
cfn = pb_newfig(cfn,'size',[0 0 17 17],'resize','off');
d = pb_draft('x',Saccades.GazeLatency,'y',Saccades.HeadLatency,'color',Saccades.Modality);
% Plots
d.plot_rawdata
d.plot_vline('type','mode');
d.plot_hline('type','mode');
% Layout
%d.set_axcomp(Saccades.Subject);
d.set_title('Saccade Latencies');
d.set_labels('x','Gaze Latency (ms)','y','Head Latency (ms)');
d.set_grid;
d.set_legend('Entries',{'Audio','Visual','Audiovisual'});
% Build
d.draft
d.print('disp',true);
end
%% Block 2:
......
function pb_genpassword(varargin)
% PB_GENPASSWORD
%
% PB_GENPASSWORD generates a random strong password (i.e. too long for brute force hacking.
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
v = varargin;
nchunk = pb_keyval('chunks',v,4);
nchar = pb_keyval('chars',v,5);
maxl = pb_keyval('length',v);
abc = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz';
num = '0123456789';
spc = '±§!@€#$%^&*+=:;|\~<,>.?';
password = '';
for iChunk = 1:nchunk
s = blanks(nchar);
order = randperm(nchar);
s(order(1)) = num(randi(length(num)));
s(order(2)) = spc(randi(length(spc)));
for iChar = 3:nchar
s(order(iChar)) = abc(randi(length(abc)));
end
password = [password s];
if iChunk < nchunk
password = [password '-'];
end
end
clc;
len = length(password);
strength = (length(abc)+length(num)+length(spc))^len;
disp([sprintf('<strong>Password:</strong> ') password]);
disp([sprintf('<strong>Length:</strong> ') num2str(len) ' characters']);
disp(newline);
clipboard('copy',password);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
function [TOT,h] = pb_bubbleplot(X,Y,varargin)
% PB_BUBBLEPLOT()
%
% PB_BUBBLEPLOT() ...
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
XW = pb_keyval('Xwidth',varargin);
YW = pb_keyval('Ywidth',varargin);
scale = pb_keyval('scale',varargin,1);
def = pb_keyval('col',varargin,5);
if isempty(XW); [~,~,XW,~] = pb_binsize(X); XW = XW*scale; end
if isempty(YW); [~,~,YW,~] = pb_binsize(Y); YW = YW*scale; end
%% Histogram
X = round(X/XW)*XW;
Y = round(Y/YW)*YW;
uX = unique(X);
uY = unique(Y);
[UX,UY] = meshgrid(uX,uY);
x = uY;
TOT = NaN(size(UX));
for ii = 1:length(uX)
sel = X == uX(ii);
r = Y(sel);
N = hist(r,x);
if isscalar(x)
N = histogram(r,[x-XW x+XW]);
end
TOT(:,ii) = N;
end
%% Normalize
TOT = log10(TOT+1);
mxTOT = nanmax(nanmax(TOT));
mnTOT = nanmin(nanmin(TOT));
TOT = (TOT-mnTOT)./(mxTOT-mnTOT);
%% Plot
M = TOT(:);
x = UX(:);
y = UY(:);
sel = M>0;
M = M(sel);
x = x(sel);
y = y(sel);
SZ = ceil(100*M)*scale;
[~,~,idx] = unique(M);
col = statcolor(max(idx),[],[],[],'def',def);
C = col(idx,:);
h = scatter(x,y,SZ,C,'filled');
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
function x = pb_filtnoise(mu, dur, SR)
% PB_FILTNOISE()
%
% PB_FILTNOISE() ...
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
% noise signal
sigma = 0;
t = 0:1/SR:dur;
x = mu+sigma;
x = x+randn(length(t),1);
% cheby filtered signal
n = 10;
Ws = 1;
Rs = 80;
LPfil = designfilt('lowpassiir', 'FilterOrder', n,...
'StopbandFrequency', Ws,...
'StopbandAttenuation', Rs,...
'SampleRate', SR);
x = filtfilt(LPfil,x);
% tukey window
L = length(t);
x = x.* tukeywin(L,0.25);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
function p = pb_trigonomics(varargin)
% PB_TRIGONOMICS
%
% PB_TRIGONOMICS(varargin) provides you with an output of all measures of
% a triangle given any 2 inputs.
%
% See also ...
% PBToolbox (2019): JJH: j.heckman@donders.ru.nl
p = struct([]);
p.A = pb_keyval('A',varargin);
p.O = pb_keyval('O',varargin);
p.H = pb_keyval('H',varargin);
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% %
% Part of Programmeer Beer Toolbox (PBToolbox) %
% Written by: Jesse J. Heckman (2019) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
......@@ -12,10 +12,10 @@ function [h,b,r] = pb_regplot(X,Y,varargin)
v = varargin;
marker = pb_keyval('marker',v,'o');
data = pb_keyval('data',v,true);
text = pb_keyval('text',v,false);
textOut = pb_keyval('text',v,false);
color = pb_keyval('color',v,'k');
linestyle = pb_keyval('linestyle',v,'--');
linewidth = pb_keyval('linewidth',v,2);
linestyle = pb_keyval('linestyle',v,'-');
linewidth = pb_keyval('linewidth',v,3);
X = X(:)';
Y = Y(:)';
......@@ -29,13 +29,15 @@ function [h,b,r] = pb_regplot(X,Y,varargin)
gain = b(2);
bias = b(1);
r = corrcoef(X,Y); r = r(2);
r = corrcoef(X,Y); r = b(2);
%% Graphics
h = gobjects(0);
if data; h(1) = plot(X, Y, ['k' marker]); end
axxes = axis;
h(end+1) = plot(axxes([1 2]),gain*axxes([1 2])+bias,'Color',color,'LineStyle',linestyle,'LineWidth',linewidth);
mov = max(axxes)/10;
if textOut; text(mov,-mov,['r = ' num2str(gain)],'FontSize',18); end
if ~hs; hold off; end
end
......
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