Skip to content

Commit 565fdc8

Browse files
committed
Merge branch 'master' of github.com:NeuralEnsemble/python-neo into Convert_Data2
2 parents a1b0294 + a9a3386 commit 565fdc8

16 files changed

+3855
-2802
lines changed

doc/source/images/IODiagram.eps

Lines changed: 1212 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/source/images/IODiagram.png

443 KB
Loading

doc/source/images/IODiagram.svg

Lines changed: 525 additions & 0 deletions
Loading
27.9 KB
Loading

doc/source/images/base_schematic.svg

Lines changed: 1697 additions & 1850 deletions
Loading
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
This generate diagram of the (raw)ios and formats
5+
6+
7+
Author: Julia Sprenger
8+
"""
9+
10+
import pygraphviz
11+
import neo
12+
13+
# from datetime import datetime
14+
#
15+
# import numpy as np
16+
# import quantities as pq
17+
# from matplotlib import pyplot
18+
# from matplotlib.patches import Rectangle, ArrowStyle, FancyArrowPatch
19+
# from matplotlib.font_manager import FontProperties
20+
#
21+
# from neo.test.generate_datasets import fake_neo
22+
#
23+
# line_heigth = .22
24+
# fontsize = 10.5
25+
# left_text_shift = .1
26+
# dpi = 100
27+
28+
29+
default_style = {'shape': 'rectangle',
30+
'color': 'black',
31+
'fontcolor': 'black'}
32+
IO_style = default_style.copy()
33+
IO_style['fontsize'] = '30'
34+
IO_style['penwidth'] = 6
35+
36+
styles = {'IO': {'ro': IO_style.copy(),
37+
'rw': IO_style.copy(),
38+
'raw': IO_style.copy()
39+
},
40+
'main': default_style.copy(),
41+
'ext': default_style.copy()}
42+
43+
styles['IO']['ro']['color'] = '#20B2AA '
44+
styles['IO']['rw']['color'] = '#4169E1 '
45+
styles['IO']['raw']['color'] = '#008080 '
46+
styles['ext']['shape'] = 'circle'
47+
styles['ext']['fillcolor'] = 'red'
48+
styles['ext']['style'] = 'filled'
49+
50+
51+
# styles['ext']['fixedsize'] = 'True'
52+
53+
54+
def generate_diagram(filename, plot_extensions=False):
55+
dia = pygraphviz.AGraph(strict=False, splines='true')
56+
G = dia
57+
G.node_attr['fontname'] = 'Arial'
58+
# G.node_attr['shape'] = 'circle'
59+
# G.node_attr['fixedsize'] = 'true'
60+
# G.node_attr['sep'] = '-100'
61+
G.node_attr['fixedsize'] = 'False'
62+
# G.graph_attr['overlap'] = 'False'
63+
G.graph_attr['packMode'] = 'clust'
64+
# G.graph_attr['levelsgap'] = -500
65+
G.node_attr['fontsize'] = '20'
66+
G.edge_attr['minlen'] = '0'
67+
# G.node_attr['style'] = 'filled'
68+
# G.graph_attr['outputorder'] = 'edgesfirst'
69+
# G.graph_attr['splines'] = "compound"
70+
G.graph_attr['label'] = "NEO {}".format(neo.__version__)
71+
G.graph_attr['ratio'] = '1.0'
72+
# G.edge_attr['color'] = '#1100FF'
73+
74+
G.edge_attr['style'] = 'setlinewidth(4)'
75+
76+
dia.add_node('NEO', shape='circle', fontsize=50)
77+
78+
for io in neo.io.iolist:
79+
io_name = io.name
80+
rawio = False
81+
if issubclass(io, neo.io.basefromrawio.BaseFromRaw):
82+
rawio = True
83+
if io_name == 'BaseIO':
84+
io_name = io.__name__.rstrip('RawIO')
85+
if io_name is None:
86+
io_name = io.__name__.rstrip('IO')
87+
if 'example' in io_name:
88+
continue
89+
90+
if io.is_writable and io.is_readable:
91+
mode = 'rw'
92+
elif io.is_readable:
93+
mode = 'ro'
94+
if rawio:
95+
mode = 'raw'
96+
97+
dia.add_node(io_name, **styles['IO'][mode])
98+
dia.add_edge('NEO', io_name)
99+
100+
if plot_extensions:
101+
for ext in io.extensions:
102+
dia.add_node(ext, **styles['ext'])
103+
dia.add_edge(io_name, ext, minlen=0)
104+
105+
dia.layout(prog='fdp') # neato, dot, twopi, circo, fdp, nop, wc, acyclic, gvpr, gvcolor,
106+
# ccomps, sccmap, tred, sfdp.
107+
for ext in ['png', 'svg', 'eps']:
108+
dia.draw('{}.{}'.format(filename, ext))
109+
110+
111+
if __name__ == '__main__':
112+
generate_diagram('IODiagram', plot_extensions=False)
113+
generate_diagram('IODiagram_ext', plot_extensions=True)
114+
# pyplot.show()
-5.54 KB
Binary file not shown.
-172 KB
Binary file not shown.

doc/source/images/neo_ecosystem.drawio

Lines changed: 193 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)