CompoundPye  0.93
Modelling and Simulation Framework for Neural Networks of Arthropod Compound Eyes
 All Classes Namespaces Functions Variables Pages
CompoundPye.src.Graph.sensors Namespace Reference

Provides functions to determine neighbourhood of ommatidia. More...

Functions

def determine_neighbours
 Determines edges depending on node coordinates. More...
 
def plot_neighbourhood
 Plots the Graph using networkx' draw method. More...
 
def coords_to_graph
 Creates a Graph containing one node for each ommatidiuml (x,y)-coordinate. More...
 
def neighbours_to_graph_edges
 Takes the lists of neighbours and adds appropriate edges to the graph. More...
 

Detailed Description

Provides functions to determine neighbourhood of ommatidia.

Author
Ilyas Kuhlemann ilyas.nosp@m.p.ku.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Date
09.10.15 Mainly uses tools from networkx to do so.

Function Documentation

def CompoundPye.src.Graph.sensors.coords_to_graph (   coords,
  index_offset = 0 
)

Creates a Graph containing one node for each ommatidiuml (x,y)-coordinate.

Parameters
coordsArray of ommatidial (x,y)-coordinates.
Returns
Graph-object.
def CompoundPye.src.Graph.sensors.determine_neighbours (   coords,
  neighbours_per_direction = 1,
  neighbour_range = 0.1,
  bi_directional = False,
  directions_dict = {'HP':([-np.pi*5./36,np.pi*5./36],
  HN 
)

Determines edges depending on node coordinates.

The direction dict needs to provide names of directions as keys and angle ranges as values (see the default parameter). On default, there are four directions: HP = horizontal positive, i.e. to the right, HN = horizontal negative, i.e. to the left, VP = vertical positive, i.e. upwards, VN = vertical negative, i.e. downwards.

Parameters
coordsArray of coordinates.
neighbours_per_directionMaximum number of neighbours per direction (for each ommatidium).
neighbour_rangeMaximum range between neighbours.
bi_directionalNOT IMPLEMENTED YET.
directions_dictDictionary containing direction labels as keys and angle ranges as values.
Returns
tuple of three values: (1) List containing neighbours for each ommatidium, (2) distance matrix, (3) angle matrix.
def CompoundPye.src.Graph.sensors.neighbours_to_graph_edges (   G,
  neighbours,
  index_offset = 0 
)

Takes the lists of neighbours and adds appropriate edges to the graph.

Parameters
GGraph containing one node per ommatidium and their coordinates as values.
neighboursLists of neighbours for each node/ommatidium.
def CompoundPye.src.Graph.sensors.plot_neighbourhood (   ax,
  G,
  direction_colors = {},
  node_color = 'white',
  alpha = 0.8,
  labels = True,
  node_size = 300,
  font_size = 12 
)

Plots the Graph using networkx' draw method.

Each edge should have an direction assigned to it; with the direction_colors parameter you can assign different directions different colors for plotting.

Parameters
axAxis-object.
GGraph-object.
direction_colorsDictionary with directions as keys and colors as values.