% to be run before run_test.sli

% Doughnut mask, outer radius 0.25, inner radius 0.1
%
% Setup:
%     - 5x5 -> 5x5, extent 1.25x1.25
%     - nodes "freely placed" at regular grid locations
% expectation:
%   /anchor [ -0.25 0.0 ] : right edge of mask aligned with source
%
%   each node is connected to
%     - the node in the same location in the target layer
%     - the node two grid steps to the left of that location
%     - the two nodes to the left and above and below that location
%     - should give identical results to reg_mask_donut_anchor_01.sli
%
%   nodes at the edges have no connections beyond the edge
%
%    Sources                      Targets
%     2  7 12 17 22    	          28 33 38 43 48
%     3  8 13 18 23		  29 34	39 44 49
%     4	 9 14 19 24		  30 35	40 45 50
%     5	10 15 20 25		  31 36	41 46 51
%     6	11 16 21 26		  32 37	42 47 52
%
%    Exemplary connections
%      2 -> 28    17 -> 33    43    22 -> 38    48
%	                   39                44
%
%                          41                46
%      6 -> 32    21 -> 37    47    26 -> 42    52

% loop y-coords backwards so that we get same gid-pos mapping as on grid
[-0.5 0.5 0.25] Range 
{ /x Set [0.5 -0.5 -0.25] Range { x exch 2 arraystore } Map } Map 1 Flatten
/pos Set

/layer << /positions pos
          /extent [1.25 1.25]
          /center [0. 0.]
          /edge_wrap false
          /elements /iaf_neuron
        >> def

/src_layer layer def
/tgt_layer layer def

/conns << /connection_type (divergent)
          /mask << /doughnut << /outer_radius 0.25 /inner_radius 0.1 >> /anchor [ -0.25 0.0 ] >>
       >> def