-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgalvoTestPatterns.m
More file actions
48 lines (35 loc) · 1.15 KB
/
galvoTestPatterns.m
File metadata and controls
48 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
%% initialize
adaptorVendor = 'ni';
galvoDeviceID = 'Dev1';
xChID = 'ao0';
yChID = 'ao1';
s = daq.createSession(adaptorVendor);
mirrorXChannel = s.addAnalogOutputChannel(galvoDeviceID, xChID, 'Voltage');
mirrorYChannel = s.addAnalogOutputChannel(galvoDeviceID, yChID, 'Voltage');
sampleRate = s.Rate; % maybe try lower?
s.queueOutputData([0 0]); s.startForeground;
%% test square
gridSize = 2; % units?
holdTime = 0.002; % sec, at each corner
nSamp = holdTime*sampleRate;
a = repmat(gridSize*[-1 -1 1 1]'/2, 1, nSamp);
a = reshape(a', nSamp*4, 1);
b = repmat(gridSize*[-1 1 1 -1]'/2, 1, nSamp);
b = reshape(b', nSamp*4, 1);
for n = 1:100
s.queueOutputData([a b]); s.startForeground;
end
%% test brain coordinate pattern
mmPerVolt = 3.6;
gridSize = 1; % mm
parkPosition = [-10 -10];
holdTime = 0.002; % sec, at each corner
nSamp = holdTime*sampleRate;
coords = expandedBrainCoords()';
a = repmat(gridSize*coords(:,1)', 1, nSamp);
a = reshape(a', nSamp*numel(coords(:,1)), 1);
b = repmat(gridSize*coords(:,2)', 1, nSamp);
b = reshape(b', nSamp*numel(coords(:,2)), 1);
for n = 1:100
s.queueOutputData([a -b; parkPosition]/mmPerVolt); s.startForeground;
end