|
1 | 1 | % (C) Copyright 2020 CPP_PTB developers |
2 | 2 |
|
3 | | -function [dots] = initDots(cfg, thisEvent) |
4 | | - % [dots] = initDots(cfg, thisEvent) |
| 3 | +function dots = initDots(cfg, thisEvent) |
5 | 4 | % |
6 | | - % % Dot life time in seconds |
7 | | - % cfg.dot.lifeTime |
8 | | - % % Number of dots |
9 | | - % cfg.dot.number |
10 | | - % Proportion of coherent dots. |
11 | | - % cfg.dot.coherence |
| 5 | + % Initialize dots for RDK |
12 | 6 | % |
13 | | - % % Direction (an angle in degrees) |
14 | | - % thisEvent.direction |
15 | | - % % Speed expressed in pixels per frame |
16 | | - % thisEvent.speed |
| 7 | + % USAGE:: |
17 | 8 | % |
| 9 | + % dots = initDots(cfg, thisEvent) |
| 10 | + % |
| 11 | + % :param cfg: |
| 12 | + % :type cfg: structure |
| 13 | + % :param thisEvent: |
| 14 | + % :type thisEvent: structure |
| 15 | + % |
| 16 | + % :returns: - :dots: (structure) |
| 17 | + % |
| 18 | + % |
| 19 | + % - ``cfg.dot.lifeTime``: dot life time in seconds |
| 20 | + % - ``cfg.dot.number``: number of dots |
| 21 | + % - ``cfg.dot.coherence``: proportion of coherent dots. |
| 22 | + % |
| 23 | + % - ``thisEvent.direction``: direction (an angle in degrees) |
| 24 | + % - ``thisEvent.speed``: speed expressed in pixels per frame |
| 25 | + % |
| 26 | + % - ``dots.direction`` |
| 27 | + % - ``dots.isSignal``: signal dots (1) and those are noise dots (0) |
| 28 | + % - ``dots.directionAllDots`` |
| 29 | + % - ``dots.lifeTime``: in frames |
| 30 | + % - ``dots.speeds``: ``[ndots, 2]`` ; horizontal and vertical speed ; in pixels per frame |
| 31 | + % - ``dots.speedPixPerFrame`` |
18 | 32 | % |
19 | | - % dots.direction |
20 | | - % dots.isSignal : signal dots (1) and those are noise dots (0) |
21 | | - % dots.directionAllDots |
22 | | - % dots.lifeTime : in frames |
23 | | - % dots.speeds : [ndots, 2] ; horizontal and vertical speed ; in pixels per frame |
24 | | - % dots.speedPixPerFrame |
25 | 33 |
|
26 | 34 | dots.direction = thisEvent.direction(1); |
27 | 35 |
|
28 | | - % decide which dots are signal dots (1) and those are noise dots (0) |
29 | 36 | dots.isSignal = rand(cfg.dot.number, 1) < cfg.dot.coherence; |
30 | 37 |
|
31 | 38 | dots.speedPixPerFrame = thisEvent.speedPix(1); |
|
38 | 45 | lifeTime = Inf; |
39 | 46 | end |
40 | 47 |
|
41 | | - % set position and directions fo the dots |
| 48 | + % set position and directions of the dots |
42 | 49 | [dots.positions, dots.speeds, dots.time] = ... |
43 | 50 | seedDots(dots, cfg, dots.isSignal); |
44 | 51 |
|
|
0 commit comments