Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pbtoolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jesse Heckman
pbtoolbox
Commits
58ca2365
Commit
58ca2365
authored
Mar 11, 2019
by
Jesse Heckman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update vPrime + draft
parent
37ec3c7d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
66 additions
and
75 deletions
+66
-75
setups/vestibular chair/vPrime/core/experiment/block/trial/pb_vSetSound.m
...r chair/vPrime/core/experiment/block/trial/pb_vSetSound.m
+1
-1
setups/vestibular chair/vPrime/core/experiment/block/trial/pb_vSetupTrial.m
...chair/vPrime/core/experiment/block/trial/pb_vSetupTrial.m
+6
-3
setups/vestibular chair/vPrime/core/experiment/pb_vReadExp.m
setups/vestibular chair/vPrime/core/experiment/pb_vReadExp.m
+1
-0
setups/vestibular chair/vPrime/lookup/vPrime Measurement.xlsx
...ps/vestibular chair/vPrime/lookup/vPrime Measurement.xlsx
+0
-0
subtools/draft/@pb_draft/draft.m
subtools/draft/@pb_draft/draft.m
+1
-5
subtools/draft/@pb_draft/private/make_axes.m
subtools/draft/@pb_draft/private/make_axes.m
+17
-15
subtools/draft/@pb_draft/private/make_legend.m
subtools/draft/@pb_draft/private/make_legend.m
+16
-29
subtools/draft/example_draft.m
subtools/draft/example_draft.m
+24
-22
No files found.
setups/vestibular chair/vPrime/core/experiment/block/trial/pb_vSetSound.m
View file @
58ca2365
...
...
@@ -24,7 +24,7 @@ function pb_vSetSound(snd,cfg,RZ6str)
cfg
.
RZ6_1
.
SetTagVal
(
'eventSND'
,
snd
.
onevent
+
1
);
cfg
.
RZ6_1
.
SetTagVal
(
'delaySND'
,
snd
.
ondelay
);
cfg
.
RZ6_1
.
SetTagVal
(
'soundDur'
,
snd
.
duration
);
%
cfg
.
RZ6_1
.
SetTagVal
(
'soundDur'
,
snd
.
duration
);
cfg
.
RZ6_1
.
SetTagVal
(
'AttenuationA'
,
atten
);
% Note: sounds are set for 2 channels, but only 1 sound is played (see MUX below)
cfg
.
RZ6_1
.
SetTagVal
(
'AttenuationB'
,
atten
);
...
...
setups/vestibular chair/vPrime/core/experiment/block/trial/pb_vSetupTrial.m
View file @
58ca2365
...
...
@@ -52,7 +52,6 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
end
end
end
stim
(
find
(
selled
,
1
))
.
ledhandle
=
ledcontroller_pi
(
'dcn-led06'
,
'dcn-led07'
);
stim
(
find
(
selled
,
1
))
.
ledhandle
.
write
(
s
);
end
...
...
@@ -71,8 +70,12 @@ function [stim, cfg] = pb_vSetupTrial(stim,cfg)
%% WAIT
ev
=
stim
.
offevent
;
de
=
stim
.
offdelay
;
ev
=
0
;
de
=
2500
;
if
isfield
(
stim
,
'offevent'
);
ev
=
stim
.
offevent
;
end
if
isfield
(
stim
,
'offdelay'
);
de
=
stim
.
offdelay
;
end
mxevent
=
max
(
ev
);
sel
=
ismember
(
ev
,
mxevent
);
mxdelay
=
max
([
de
(
sel
)
ceil
(
1000
*
cfg
.
nsamples
.
/
cfg
.
RZ6Fs
)
]);
...
...
setups/vestibular chair/vPrime/core/experiment/pb_vReadExp.m
View file @
58ca2365
...
...
@@ -67,6 +67,7 @@ function [block,cfg] = pb_vReadExp(cfg)
block
(
bn
)
.
trial
(
tn
)
.
stim
(
sn
)
.
ondelay
=
par
(
6
);
block
(
bn
)
.
trial
(
tn
)
.
stim
(
sn
)
.
offdelay
=
par
(
5
)
+
par
(
7
);
block
(
bn
)
.
trial
(
tn
)
.
stim
(
sn
)
.
duration
=
par
(
7
);
block
(
bn
)
.
trial
(
tn
)
.
stim
(
sn
)
.
offevent
=
par
(
5
);
case
{
'LED'
,
'LED1'
,
'LED2'
}
% Updates count and writes stimulus
...
...
setups/vestibular chair/vPrime/lookup/vPrime Measurement.xlsx
View file @
58ca2365
No preview for this file type
subtools/draft/@pb_draft/draft.m
View file @
58ca2365
...
...
@@ -98,13 +98,9 @@ function draft(obj)
%% Adjust Axis Handles
% Set super labels
% TO DO:
% 1. Scale and move axis to make graph nice, pleasing and non-overlapping
obj
.
make_axes
(
ax
);
obj
.
make_legend
;
obj
.
make_axes
(
ax
);
obj
.
make_suplabel
;
end
...
...
subtools/draft/@pb_draft/private/make_axes.m
View file @
58ca2365
...
...
@@ -9,44 +9,43 @@ function make_axes(obj,ax,varargin)
linkaxes
(
ax
,
'xy'
);
positions
=
zeros
(
length
(
ax
),
4
);
nAx
=
length
(
ax
);
% Get legend data
h
=
pb_fobj
(
gcf
,
'Tag'
,
'legend'
);
scale
=
[
h
.
Position
(
1
)
1
];
sz
=
obj
(
1
)
.
h_ax_plot
.
sz
;
szfl
=
fliplr
(
sz
);
opObj
=
ax
(
1
)
.
OuterPosition
(
3
:
4
)
*
scale
(
1
);
nAx
=
length
(
ax
);
for
iAx
=
1
:
nAx
sz
=
obj
(
1
)
.
h_ax_plot
.
sz
;
cAx
=
pb_invidx
(
sz
,
iAx
);
% align axes and objects
ax
(
cAx
);
% Scale for legend
if
obj
(
1
)
.
h_ax_legend
.
bool
scale
=
[
0.8
1
];
szfl
=
fliplr
(
sz
);
[
xN
,
yN
]
=
pb_mod
(
iAx
,
sz
(
2
));
if
xN
==
0
;
xN
=
sz
(
2
);
end
N
=
[
xN
,
yN
+
1
];
ax
(
cAx
)
.
OuterPosition
(
3
:
4
)
=
ax
(
cAx
)
.
OuterPosition
(
3
:
4
)
*
scale
(
1
);
spacing
=
[];
for
iDir
=
1
:
2
width
=
ax
(
cAx
)
.
OuterPosition
(
2
+
iDir
);
width
=
ax
(
cAx
)
.
OuterPosition
(
2
+
iDir
);
spacing
(
iDir
)
=
(
scale
(
iDir
)
-
(
width
*
szfl
(
iDir
)))/(
szfl
(
iDir
)
+
1
);
if
iDir
==
1
;
ax
(
cAx
)
.
OuterPosition
(
1
)
=
(
N
(
1
)
-
1
)
*
width
+
N
(
1
)
*
spacing
(
iDir
);
end
if
iDir
==
2
if
spacing
(
2
)
>
spacing
(
1
)
*
1.5
spacing
(
2
)
=
spacing
(
1
)
*
1.5
;
end
margin
=
(
1
-
(
sz
(
1
)
*
width
+
(
sz
(
1
)
-
1
)
*
spacing
(
2
)))/
2
;
margin
=
(
1
-
(
sz
(
1
)
*
width
+
(
sz
(
1
)
-
1
)
*
spacing
(
2
)))/
2
*
1.1
;
ax
(
cAx
)
.
OuterPosition
(
2
)
=
1
-
margin
-
(
N
(
2
)
*
width
)
-
(
N
(
2
)
-
1
)
*
spacing
(
iDir
);
end
end
ax
(
cAx
)
.
OuterPosition
(
3
:
4
)
=
opObj
;
end
% Set Limits
if
obj
(
1
)
.
pva
.
setAxes
xlim
(
obj
(
1
)
.
pva
.
limits
.
x
);
ylim
(
obj
(
1
)
.
pva
.
limits
.
y
);
xlim
(
ax
(
cAx
),
obj
(
1
)
.
pva
.
limits
.
x
);
ylim
(
ax
(
cAx
),
obj
(
1
)
.
pva
.
limits
.
y
);
end
% Set Grids
...
...
@@ -71,6 +70,9 @@ function make_axes(obj,ax,varargin)
% Set Label Positions
% TODO: THIS MUST BE DONE WAY BETTER!!
% NOTE THAT AXES ARE NOT SAME SIZE? (SEE MOST RIGHT FIGURES), ALSO
% POSITION IS NOT ALIGNED!
obj
(
1
)
.
labels
.
ypos
=
min
(
positions
(:,
2
));
obj
(
1
)
.
labels
.
xpos
=
min
(
positions
(:,
1
));
obj
(
1
)
.
labels
.
pos
=
[
min
(
positions
(:,
1
))/
1.33
min
(
positions
(:,
2
))/
1.33
max
(
positions
(:,
1
)
+
positions
(:,
3
))
max
(
positions
(:,
2
)
+
positions
(:,
4
))];
...
...
subtools/draft/@pb_draft/private/make_legend.m
View file @
58ca2365
...
...
@@ -9,37 +9,24 @@ function make_legend(obj,varargin)
lgnd
=
obj
(
1
)
.
h_ax_legend
;
if
lgnd
.
bool
h
=
axes
(
'Units'
,
'Normal'
,
'Position'
,[
.
8
.
3
.
15
.
4
],
'Visible'
,
'off'
,
'tag'
,
'legend
'
);
h
=
axes
(
'Units'
,
'Normal'
,
'Position'
,[
.
8
5
.
3
.
15
.
4
],
'tag'
,
'legend'
,
'Visible'
,
'off
'
);
hold
on
;
t
=
text
(
0
,
0.5
,
'LEGEND1'
,
'Visible'
,
'on'
);
p
=
plot
(
0
,
0.5
,
'o'
,
'Visible'
,
'on'
);
xlim
=
[
0
1
];
ylim
=
[
0
1
];
%[n,m] = readlegend(lgnd.features.entries,lgnd.features.fontsize);
end
end
function
[
n
,
m
]
=
readlegend
(
entries
,
fontsize
)
% returns the size of the legend
if
isempty
(
entries
)
n
=
0
;
m
=
0
;
return
ncol
=
length
(
unique
(
obj
(
1
)
.
pva
.
color
));
col
=
pb_selectcolor
(
ncol
,
obj
(
1
)
.
pva
.
def
);
move
=
0
;
for
iCol
=
1
:
ncol
pos
=
0.575
-
(
iCol
-
1
)
*.
075
;
t
(
iCol
)
=
text
(
0.1
,
pos
,
lgnd
.
features
.
entries
{
iCol
},
'Visible'
,
'on'
,
'FontSize'
,
lgnd
.
features
.
fontsize
);
p
(
iCol
)
=
plot
(
0
,
pos
,
'Marker'
,
'o'
,
'Visible'
,
'on'
,
'Color'
,
col
(
iCol
,:),
'MarkerFaceColor'
,
col
(
iCol
,:));
xlim
([
0
1
]);
ylim
([
0
1
]);
if
move
<
t
(
iCol
)
.
Extent
(
3
);
move
=
t
(
iCol
)
.
Extent
(
3
);
end
end
move
=
(
.
95
-
move
)
*
0.15
;
h
.
Position
(
1
)
=
h
.
Position
(
1
)
+
move
;
end
n
=
length
(
entries
);
n
=
(
n
+
1
)
*
0.04
;
z
=
axes
();
set
(
z
,
units
,
'centimeters'
);
end
...
...
subtools/draft/example_draft.m
View file @
58ca2365
...
...
@@ -4,31 +4,33 @@
pb_clean
;
% Empty
load
(
'exD_saccade'
);
% load example data
cfn
=
0
;
% Initialize current figure number
run
=
1
;
% Set # of blocks to run
run
=
2
;
% Set # of blocks to run
%% 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_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:
...
...
@@ -37,7 +39,7 @@ run = 1; % Set # of blocks to run
if
run
>
cfn
tic
% Make figure
cfn
=
pb_newfig
(
cfn
,
'size'
,[
0
0
17
1
2
],
'resize'
,
'off'
);
cfn
=
pb_newfig
(
cfn
,
'size'
,[
0
0
17
1
1
],
'resize'
,
'off'
);
for
iR
=
1
:
2
% Build draft-objs
d
(
iR
,
1
)
=
pb_draft
(
'x'
,
Saccades
.
GazeLatency
,
'y'
,
Saccades
.
HeadLatency
,
'color'
,
Saccades
.
Modality
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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