CompoundPye
0.93
Modelling and Simulation Framework for Neural Networks of Arthropod Compound Eyes
|
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... | |
Provides functions to determine neighbourhood of ommatidia.
def CompoundPye.src.Graph.sensors.coords_to_graph | ( | coords, | |
index_offset = 0 |
|||
) |
Creates a Graph containing one node for each ommatidiuml (x,y)-coordinate.
coords | Array of ommatidial (x,y)-coordinates. |
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.
coords | Array of coordinates. |
neighbours_per_direction | Maximum number of neighbours per direction (for each ommatidium). |
neighbour_range | Maximum range between neighbours. |
bi_directional | NOT IMPLEMENTED YET. |
directions_dict | Dictionary containing direction labels as keys and angle ranges as values. |
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.
G | Graph containing one node per ommatidium and their coordinates as values. |
neighbours | Lists 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.
ax | Axis-object. |
G | Graph-object. |
direction_colors | Dictionary with directions as keys and colors as values. |