Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Jesse Heckman
pbtoolbox
Commits
2aee18c1
Commit
2aee18c1
authored
Sep 17, 2019
by
Jesse Heckman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
light warning
parent
8b8c6a2c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
93 additions
and
34 deletions
+93
-34
setups/vestibular chair/vPrime/expfile/experiments/pb_vGenExp_VisFlash.m
...ar chair/vPrime/expfile/experiments/pb_vGenExp_VisFlash.m
+43
-32
setups/vestibular chair/vPrime/expfile/pb_vWriteSignal.m
setups/vestibular chair/vPrime/expfile/pb_vWriteSignal.m
+2
-2
setups/vestibular chair/vPrime/led/pb_lightwarning.m
setups/vestibular chair/vPrime/led/pb_lightwarning.m
+48
-0
No files found.
setups/vestibular chair/vPrime/expfile/experiments/pb_vGenExp_VisFlash.m
View file @
2aee18c1
function
pb_vGenExp_Vis
(
varargin
)
function
pb_vGenExp_Vis
Flash
(
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 (201
8
): JJH: j.heckman@donders.ru.nl
% PBToolbox (201
9
): JJH: j.heckman@donders.ru.nl
%% Initialization
%% Initialization
% Clear, empty, default imputs
% Clear, empty, default imputs
...
@@ -29,9 +29,16 @@ function pb_vGenExp_Vis(varargin)
...
@@ -29,9 +29,16 @@ function pb_vGenExp_Vis(varargin)
disp
(
' ...'
)
disp
(
' ...'
)
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'
,
.
1
6
);
block
(
1
)
.
Vertical
=
struct
(
'Amplitude'
,
0
,
'Signal'
,
2
,
'Duration'
,
blockdur
,
'Frequency'
,
.
1
);
block
.
Vertical
=
struct
(
'Amplitude'
,
3
0
,
'Signal'
,
2
,
'Duration'
,
blockdur
,
'Frequency'
,
.
1
6
);
%% 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,36 +178,40 @@ function writeexp(expfile,datdir,theta,phi,int,dur,block,fixled)
...
@@ -171,36 +178,40 @@ 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
pl
=
randperm
(
trialsz
);
% randomize trialorder in blocks
for
iBlock
=
1
:
blocksz
newBlock
=
true
;
% Write blocks
totalDur
=
0
;
iBlock
=
1
;
pb_vWriteBlock
(
fid
,
iBlock
);
for
iTrial
=
1
:
trialsz
pb_vWriteSignal
(
fid
,
block
(
iBlock
));
%pl = 1:trialsz;
% Write trials
pl
=
randperm
(
trialsz
);
% randomize trialorder in blocks
if
newBlock
==
true
% Write blocks
for
iTrial
=
1
:
trialsz
pb_vWriteBlock
(
fid
,
iBlock
);
% Write trials
pb_vWriteSignal
(
fid
,
block
);
newBlock
=
false
;
pb_vWriteTrial
(
fid
,
trlIdx
);
iBlock
=
iBlock
+
1
;
VIS
=
[];
VIS
.
LED
=
'LED'
;
VIS
.
X
=
theta
(
pl
(
iTrial
));
VIS
.
Y
=
phi
(
pl
(
iTrial
));
VIS
.
Int
=
int
(
pl
(
iTrial
));
VIS
.
EventOn
=
0
;
VIS
.
Onset
=
500
+
randi
(
100
,
1
,
1
)
-
50
;
VIS
.
EventOff
=
0
;
VIS
.
Offset
=
VIS
.
Onset
+
dur
(
pl
(
iTrial
));
VIS
=
pb_vFixLed
(
VIS
,
fixled
,
'x'
,
fixled
.
x
,
'y'
,
fixled
.
y
,
'dur'
,
fixled
.
dur
,
'pause'
,
fixled
.
pause
);
trlIdx
=
trlIdx
+
1
;
pb_vWriteStim
(
fid
,
2
,[],
VIS
);
end
end
pb_vWriteTrial
(
fid
,
trlIdx
);
VIS
=
[];
VIS
.
LED
=
'LED'
;
VIS
.
X
=
theta
(
pl
(
iTrial
));
VIS
.
Y
=
phi
(
pl
(
iTrial
));
VIS
.
Int
=
int
(
pl
(
iTrial
));
VIS
.
EventOn
=
0
;
VIS
.
Onset
=
500
+
randi
(
100
,
1
,
1
)
-
50
;
VIS
.
EventOff
=
0
;
VIS
.
Offset
=
VIS
.
Onset
+
dur
(
pl
(
iTrial
));
VIS
=
pb_vFixLed
(
VIS
,
fixled
,
'x'
,
fixled
.
x
,
'y'
,
fixled
.
y
,
'dur'
,
fixled
.
dur
,
'pause'
,
fixled
.
pause
);
trlIdx
=
trlIdx
+
1
;
pb_vWriteStim
(
fid
,
2
,[],
VIS
);
totalDur
=
totalDur
+
VIS
.
Offset
+
1000
;
if
totalDur
>=
(
200
-
1.5
)
*
1000
;
totalDur
=
0
;
newBlock
=
true
;
end
end
end
fclose
(
fid
);
fclose
(
fid
);
end
end
...
...
setups/vestibular chair/vPrime/expfile/pb_vWriteSignal.m
View file @
2aee18c1
...
@@ -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.
1
f\n'
,
'HOR'
,
h
.
Signal
,
h
.
Amplitude
,
h
.
Duration
,
h
.
Frequency
);
fprintf
(
fid
,
'%s\t\t%d\t%d\t%d\t%0.
2
f\n'
,
'HOR'
,
h
.
Signal
,
h
.
Amplitude
,
h
.
Duration
,
h
.
Frequency
);
fprintf
(
fid
,
'%s\t\t%d\t%d\t%d\t%0.
1
f\n'
,
'VER'
,
v
.
Signal
,
v
.
Amplitude
,
v
.
Duration
,
v
.
Frequency
);
fprintf
(
fid
,
'%s\t\t%d\t%d\t%d\t%0.
2
f\n'
,
'VER'
,
v
.
Signal
,
v
.
Amplitude
,
v
.
Duration
,
v
.
Frequency
);
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
...
...
setups/vestibular chair/vPrime/led/pb_lightwarning.m
0 → 100644
View file @
2aee18c1
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) %
% %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
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