Skip to content

Commit 3b2b7db

Browse files
authored
black formatting
1 parent e4cc754 commit 3b2b7db

File tree

245 files changed

+16668
-15641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

245 files changed

+16668
-15641
lines changed

doc/source/conf.py

+39-37
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717

1818
from packaging.version import Version
1919

20-
with open('../../pyproject.toml', mode='r') as f:
20+
with open("../../pyproject.toml", mode="r") as f:
2121
txt = f.read()
2222
neo_release = re.findall('version = "(\S+)"', txt)[0]
2323

24-
neo_version = '.'.join((str(e) for e in Version(neo_release).release[:2]))
24+
neo_version = ".".join((str(e) for e in Version(neo_release).release[:2]))
2525

26-
AUTHORS = 'Neo authors and contributors <[email protected]>'
26+
AUTHORS = "Neo authors and contributors <[email protected]>"
2727

2828
# If extensions (or modules to document with autodoc) are in another directory,
2929
# add these directories to sys.path here. If the directory is relative to the
@@ -34,28 +34,33 @@
3434

3535
# Add any Sphinx extension module names here, as strings. They can be
3636
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
37-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
38-
'IPython.sphinxext.ipython_console_highlighting',
39-
'IPython.sphinxext.ipython_directive',
40-
'matplotlib.sphinxext.plot_directive',
41-
'sphinx_gallery.gen_gallery',
42-
'sphinx_inline_tabs', "sphinx_design"]
37+
extensions = [
38+
"sphinx.ext.autodoc",
39+
"sphinx.ext.doctest",
40+
"sphinx.ext.todo",
41+
"IPython.sphinxext.ipython_console_highlighting",
42+
"IPython.sphinxext.ipython_directive",
43+
"matplotlib.sphinxext.plot_directive",
44+
"sphinx_gallery.gen_gallery",
45+
"sphinx_inline_tabs",
46+
"sphinx_design",
47+
]
4348

4449
# Add any paths that contain templates here, relative to this directory.
45-
templates_path = ['_templates']
50+
templates_path = ["_templates"]
4651

4752
# The suffix of source filenames.
48-
source_suffix = '.rst'
53+
source_suffix = ".rst"
4954

5055
# The encoding of source files.
5156
# source_encoding = 'utf-8'
5257

5358
# The master toctree document.
54-
master_doc = 'index'
59+
master_doc = "index"
5560

5661
# General information about the project.
57-
project = 'Neo'
58-
copyright = '2010-2024, ' + AUTHORS
62+
project = "Neo"
63+
copyright = "2010-2024, " + AUTHORS
5964

6065
# The version info for the project you're documenting, acts as replacement for
6166
# |version| and |release|, also used in various other places throughout the
@@ -99,7 +104,7 @@
99104
# show_authors = False
100105

101106
# The name of the Pygments (syntax highlighting) style to use.
102-
pygments_style = 'sphinx'
107+
pygments_style = "sphinx"
103108

104109
# A list of ignored prefixes for module index sorting.
105110
# modindex_common_prefix = []
@@ -115,32 +120,28 @@
115120
# html_theme = 'scrolls'
116121
# html_theme = 'agogo'
117122
# html_theme = 'alabaster'
118-
html_theme = 'pydata_sphinx_theme'
123+
html_theme = "pydata_sphinx_theme"
119124

120125
# Theme options are theme-specific and customize the look and feel of a theme
121126
# further. For a list of options available for each theme, see the
122127
# documentation.
123128

124129
html_theme_options = {
125130
"logo": {
126-
"image_light": "images/neologo_small.png",
127-
"image_dark": "images/neologo_small_darkmode.png",
131+
"image_light": "images/neologo_small.png",
132+
"image_dark": "images/neologo_small_darkmode.png",
128133
},
129-
'icon_links': [
130-
{
131-
"name": 'GitHub',
132-
"url": 'https://github.com/NeuralEnsemble/python-neo',
133-
"icon": 'fa-brands fa-square-github'
134-
},
134+
"icon_links": [
135+
{"name": "GitHub", "url": "https://github.com/NeuralEnsemble/python-neo", "icon": "fa-brands fa-square-github"},
135136
{
136137
"name": "PyPI",
137138
"url": "https://pypi.org/project/neo",
138139
"icon": "fa-solid fa-box",
139140
},
140141
],
141-
'icon_links_label': 'External Links', # for screen reader
142-
'use_edit_page_button': False,
143-
'navbar_end': ['theme-switcher', 'navbar-icon-links'],
142+
"icon_links_label": "External Links", # for screen reader
143+
"use_edit_page_button": False,
144+
"navbar_end": ["theme-switcher", "navbar-icon-links"],
144145
}
145146

146147
# Add any paths that contain custom themes here, relative to this directory.
@@ -155,22 +156,22 @@
155156

156157
# The name of an image file (relative to this directory) to place at the top
157158
# of the sidebar.
158-
html_logo = 'images/neologo_small.png'
159+
html_logo = "images/neologo_small.png"
159160

160161

161162
# The name of an image file (within the static path) to use as favicon of the
162163
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
163164
# pixels large.
164-
html_favicon = 'images/neologo_favicon.png'
165+
html_favicon = "images/neologo_favicon.png"
165166

166167

167168
# Add any paths that contain custom static files (such as style sheets) here,
168169
# relative to this directory. They are copied after the builtin static files,
169170
# so a file named "default.css" will overwrite the builtin "default.css".
170-
html_static_path = ['images', '_static']
171+
html_static_path = ["images", "_static"]
171172

172173
html_css_files = [
173-
'css/custom.css',
174+
"css/custom.css",
174175
]
175176

176177
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
@@ -209,7 +210,7 @@
209210
# html_file_suffix = ''
210211

211212
# Output file base name for HTML help builder.
212-
htmlhelp_basename = 'neodoc'
213+
htmlhelp_basename = "neodoc"
213214

214215

215216
# -- Options for LaTeX output -------------------------------------------------
@@ -223,8 +224,7 @@
223224
# Grouping the document tree into LaTeX files. List of tuples
224225
# (source start file, target name, title, author,
225226
# documentclass [howto/manual]).
226-
latex_documents = [('index', 'neo.tex', 'Neo Documentation',
227-
AUTHORS, 'manual')]
227+
latex_documents = [("index", "neo.tex", "Neo Documentation", AUTHORS, "manual")]
228228

229229
# The name of an image file (relative to this directory) to place at the
230230
# top of the title page.
@@ -247,9 +247,11 @@
247247

248248
rst_epilog = """
249249
.. |neo_github_url| replace:: https://github.com/NeuralEnsemble/python-neo/archive/neo-{}.zip
250-
""".format(neo_release)
250+
""".format(
251+
neo_release
252+
)
251253

252254
sphinx_gallery_conf = {
253-
'examples_dirs': '../../examples', # path to your example scripts
254-
'gallery_dirs': 'examples', # path to where to save gallery generated output
255+
"examples_dirs": "../../examples", # path to your example scripts
256+
"gallery_dirs": "examples", # path to where to save gallery generated output
255257
}

doc/source/images/generate_io_overview.py

+40-43
Original file line numberDiff line numberDiff line change
@@ -26,89 +26,86 @@
2626
# dpi = 100
2727

2828

29-
default_style = {'shape': 'rectangle',
30-
'color': 'black',
31-
'fontcolor': 'black'}
29+
default_style = {"shape": "rectangle", "color": "black", "fontcolor": "black"}
3230
IO_style = default_style.copy()
33-
IO_style['fontsize'] = '30'
34-
IO_style['penwidth'] = 6
31+
IO_style["fontsize"] = "30"
32+
IO_style["penwidth"] = 6
3533

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()}
34+
styles = {
35+
"IO": {"ro": IO_style.copy(), "rw": IO_style.copy(), "raw": IO_style.copy()},
36+
"main": default_style.copy(),
37+
"ext": default_style.copy(),
38+
}
4239

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'
40+
styles["IO"]["ro"]["color"] = "#20B2AA "
41+
styles["IO"]["rw"]["color"] = "#4169E1 "
42+
styles["IO"]["raw"]["color"] = "#008080 "
43+
styles["ext"]["shape"] = "circle"
44+
styles["ext"]["fillcolor"] = "red"
45+
styles["ext"]["style"] = "filled"
4946

5047

5148
# styles['ext']['fixedsize'] = 'True'
5249

5350

5451
def generate_diagram(filename, plot_extensions=False):
55-
dia = pygraphviz.AGraph(strict=False, splines='true')
52+
dia = pygraphviz.AGraph(strict=False, splines="true")
5653
G = dia
57-
G.node_attr['fontname'] = 'Arial'
54+
G.node_attr["fontname"] = "Arial"
5855
# G.node_attr['shape'] = 'circle'
5956
# G.node_attr['fixedsize'] = 'true'
6057
# G.node_attr['sep'] = '-100'
61-
G.node_attr['fixedsize'] = 'False'
58+
G.node_attr["fixedsize"] = "False"
6259
# G.graph_attr['overlap'] = 'False'
63-
G.graph_attr['packMode'] = 'clust'
60+
G.graph_attr["packMode"] = "clust"
6461
# G.graph_attr['levelsgap'] = -500
65-
G.node_attr['fontsize'] = '20'
66-
G.edge_attr['minlen'] = '0'
62+
G.node_attr["fontsize"] = "20"
63+
G.edge_attr["minlen"] = "0"
6764
# G.node_attr['style'] = 'filled'
6865
# G.graph_attr['outputorder'] = 'edgesfirst'
6966
# G.graph_attr['splines'] = "compound"
70-
G.graph_attr['label'] = "NEO {}".format(neo.__version__)
71-
G.graph_attr['ratio'] = '1.0'
67+
G.graph_attr["label"] = "NEO {}".format(neo.__version__)
68+
G.graph_attr["ratio"] = "1.0"
7269
# G.edge_attr['color'] = '#1100FF'
7370

74-
G.edge_attr['style'] = 'setlinewidth(4)'
71+
G.edge_attr["style"] = "setlinewidth(4)"
7572

76-
dia.add_node('NEO', shape='circle', fontsize=50)
73+
dia.add_node("NEO", shape="circle", fontsize=50)
7774

7875
for io in neo.io.iolist:
7976
io_name = io.name
8077
rawio = False
8178
if issubclass(io, neo.io.basefromrawio.BaseFromRaw):
8279
rawio = True
83-
if io_name == 'BaseIO':
84-
io_name = io.__name__.rstrip('RawIO')
80+
if io_name == "BaseIO":
81+
io_name = io.__name__.rstrip("RawIO")
8582
if io_name is None:
86-
io_name = io.__name__.rstrip('IO')
87-
if 'example' in io_name:
83+
io_name = io.__name__.rstrip("IO")
84+
if "example" in io_name:
8885
continue
8986

9087
if io.is_writable and io.is_readable:
91-
mode = 'rw'
88+
mode = "rw"
9289
elif io.is_readable:
93-
mode = 'ro'
90+
mode = "ro"
9491
if rawio:
95-
mode = 'raw'
92+
mode = "raw"
9693

97-
dia.add_node(io_name, **styles['IO'][mode])
98-
dia.add_edge('NEO', io_name)
94+
dia.add_node(io_name, **styles["IO"][mode])
95+
dia.add_edge("NEO", io_name)
9996

10097
if plot_extensions:
10198
for ext in io.extensions:
102-
dia.add_node(ext, **styles['ext'])
99+
dia.add_node(ext, **styles["ext"])
103100
dia.add_edge(io_name, ext, minlen=0)
104101

105-
dia.layout(prog='fdp') # neato, dot, twopi, circo, fdp, nop, wc, acyclic, gvpr, gvcolor,
102+
dia.layout(prog="fdp") # neato, dot, twopi, circo, fdp, nop, wc, acyclic, gvpr, gvcolor,
106103
# ccomps, sccmap, tred, sfdp.
107-
for ext in ['png', 'svg', 'eps']:
108-
dia.draw('{}.{}'.format(filename, ext))
104+
for ext in ["png", "svg", "eps"]:
105+
dia.draw("{}.{}".format(filename, ext))
109106

110107

111-
if __name__ == '__main__':
112-
generate_diagram('IODiagram', plot_extensions=False)
113-
generate_diagram('IODiagram_ext', plot_extensions=True)
108+
if __name__ == "__main__":
109+
generate_diagram("IODiagram", plot_extensions=False)
110+
generate_diagram("IODiagram_ext", plot_extensions=True)
114111
# pyplot.show()

doc/source/scripts/multi_tetrode_example.py

+9-15
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,19 @@
1111
store_signals = False
1212

1313
block = Block(name="probe data", tetrode_ids=["Tetrode #1", "Tetrode #2"])
14-
block.segments = [Segment(name="trial #1", index=0),
15-
Segment(name="trial #2", index=1),
16-
Segment(name="trial #3", index=2)]
14+
block.segments = [
15+
Segment(name="trial #1", index=0),
16+
Segment(name="trial #2", index=1),
17+
Segment(name="trial #3", index=2),
18+
]
1719

18-
n_units = {
19-
"Tetrode #1": 2,
20-
"Tetrode #2": 5
21-
}
20+
n_units = {"Tetrode #1": 2, "Tetrode #2": 5}
2221

2322
# Create a group for each neuron, annotate each group with the tetrode from which it was recorded
2423
groups = []
2524
counter = 0
2625
for tetrode_id, n in n_units.items():
27-
groups.extend(
28-
[Group(name=f"neuron #{counter + i + 1}", tetrode_id=tetrode_id)
29-
for i in range(n)]
30-
)
26+
groups.extend([Group(name=f"neuron #{counter + i + 1}", tetrode_id=tetrode_id) for i in range(n)])
3127
counter += n
3228
block.groups.extend(groups)
3329

@@ -38,10 +34,8 @@
3834

3935
# create two 4-channel AnalogSignals with dummy data
4036
signals = {
41-
"Tetrode #1": AnalogSignal(np.random.rand(1000, 4) * mV,
42-
sampling_rate=10 * kHz, tetrode_id="Tetrode #1"),
43-
"Tetrode #2": AnalogSignal(np.random.rand(1000, 4) * mV,
44-
sampling_rate=10 * kHz, tetrode_id="Tetrode #2")
37+
"Tetrode #1": AnalogSignal(np.random.rand(1000, 4) * mV, sampling_rate=10 * kHz, tetrode_id="Tetrode #1"),
38+
"Tetrode #2": AnalogSignal(np.random.rand(1000, 4) * mV, sampling_rate=10 * kHz, tetrode_id="Tetrode #2"),
4539
}
4640
if store_signals:
4741
segment.analogsignals.extend(signals.values())

doc/source/scripts/spike_sorting_example.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@
99
# generate some fake data
1010
seg = Segment()
1111
seg.analogsignals.append(
12-
AnalogSignal([[0.1, 0.1, 0.1, 0.1],
13-
[-2.0, -2.0, -2.0, -2.0],
14-
[0.1, 0.1, 0.1, 0.1],
15-
[-0.1, -0.1, -0.1, -0.1],
16-
[-0.1, -0.1, -0.1, -0.1],
17-
[-3.0, -3.0, -3.0, -3.0],
18-
[0.1, 0.1, 0.1, 0.1],
19-
[0.1, 0.1, 0.1, 0.1]],
20-
sampling_rate=1000 * Hz, units='V'))
12+
AnalogSignal(
13+
[
14+
[0.1, 0.1, 0.1, 0.1],
15+
[-2.0, -2.0, -2.0, -2.0],
16+
[0.1, 0.1, 0.1, 0.1],
17+
[-0.1, -0.1, -0.1, -0.1],
18+
[-0.1, -0.1, -0.1, -0.1],
19+
[-3.0, -3.0, -3.0, -3.0],
20+
[0.1, 0.1, 0.1, 0.1],
21+
[0.1, 0.1, 0.1, 0.1],
22+
],
23+
sampling_rate=1000 * Hz,
24+
units="V",
25+
)
26+
)
2127

2228
# extract spike trains from all channels
2329
st_list = []
@@ -32,7 +38,7 @@
3238
# remember the spike waveforms
3339
wf_list = []
3440
for spike_idx in np.nonzero(spike_mask)[0]:
35-
wf_list.append(signal[spike_idx - 1:spike_idx + 2, :])
41+
wf_list.append(signal[spike_idx - 1 : spike_idx + 2, :])
3642
st.waveforms = np.array(wf_list)
3743

3844
st_list.append(st)

0 commit comments

Comments
 (0)