99function test_initDotsBasic()
1010
1111 %% set up
12-
12+
1313 % % Dot life time in seconds
1414 % cfg.dot.lifeTime
1515 % % Number of dots
@@ -21,32 +21,32 @@ function test_initDotsBasic()
2121 % thisEvent.direction
2222 % % Speed expressed in pixels per frame
2323 % thisEvent.speed
24-
24+
2525 cfg.design.motionType = ' translation' ;
2626 cfg.dot.number = 10 ;
2727 cfg.dot.coherence = 1 ; % proportion
2828 cfg.dot.lifeTime = 0.250 ; % in seconds
2929 cfg.screen.winWidth = 2000 ; % in pixels
3030 cfg.eventDuration = 1 ; % in seconds
3131 cfg.screen.ifi = 0.01 ; % in seconds
32-
32+
3333 thisEvent.direction = 0 ;
3434 thisEvent.speed = 10 ;
3535
3636 [dots ] = initDots(cfg , thisEvent );
37-
37+
3838 %% Undeterministic ouput
3939 assertTrue(all(dots .positions(: ) >= 0 ));
4040 assertTrue(all(dots .positions(: ) <= 2000 ));
4141 assertTrue(all(dots .time(: ) >= 0 ));
4242 assertTrue(all(dots .time(: ) <= 1 / 0.01 ));
4343
44- %% Deterministic output : data to test against
45- expectedStructure.lifeTime = 25 ;
44+ %% Deterministic output : data to test against
45+ expectedStructure.lifeTime = 25 ;
4646 expectedStructure.isSignal = ones(10 , 1 );
4747 expectedStructure.speeds = repmat([1 0 ], 10 , 1 ) * 10 ;
48-
49- % remove undeterministic output
48+
49+ % remove undeterministic output
5050 dots = rmfield(dots , ' time' );
5151 dots = rmfield(dots , ' positions' );
5252
@@ -64,27 +64,26 @@ function test_initDotsStatic()
6464 cfg.screen.winWidth = 2000 ; % in pixels
6565 cfg.eventDuration = 1 ; % in seconds
6666 cfg.screen.ifi = 0.01 ; % in seconds
67-
67+
6868 thisEvent.direction = - 1 ;
6969 thisEvent.speed = 10 ;
7070
7171 [dots ] = initDots(cfg , thisEvent );
72-
72+
7373 % remove undeterministic output
7474 dots = rmfield(dots , ' time' );
7575 dots = rmfield(dots , ' positions' );
7676
77- %% data to test against
78- expectedStructure.lifeTime = Inf ;
77+ %% data to test against
78+ expectedStructure.lifeTime = Inf ;
7979 expectedStructure.isSignal = ones(10 , 1 );
8080 expectedStructure.speeds = zeros(10 , 2 );
81-
81+
8282 %% test
8383 assertEqual(expectedStructure , dots );
8484
8585end
8686
87-
8887function test_initDotsRadial()
8988
9089 cfg.design.motionType = ' radial' ;
@@ -94,20 +93,20 @@ function test_initDotsRadial()
9493 cfg.screen.winWidth = 2000 ; % in pixels
9594 cfg.eventDuration = 1 ; % in seconds
9695 cfg.screen.ifi = 0.01 ; % in seconds
97-
96+
9897 thisEvent.direction = 666 ; % outward motion
9998 thisEvent.speed = 10 ;
10099
101100 [dots ] = initDots(cfg , thisEvent );
102-
103- %% data to test against
104- XY = dots .positions - 2000 / 2 ;
105- angle = cart2pol(XY(: ,1 ), XY(: ,2 ));
101+
102+ %% data to test against
103+ XY = dots .positions - 2000 / 2 ;
104+ angle = cart2pol(XY(: , 1 ), XY(: , 2 ));
106105 angle = angle / pi * 180 ;
107106 [horVector , vertVector ] = decomposeMotion(angle );
108107 speeds = [horVector , vertVector ] * 10 ;
109108
110109 %% test
111110 assertEqual(speeds , dots .speeds );
112111
113- end
112+ end
0 commit comments