Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: formatted with black #147

Merged
merged 17 commits into from
Mar 11, 2021
Merged
46 changes: 18 additions & 28 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
sphinx_gallery_conf = {
'examples_dirs': ['../../examples', '../../tutorials'],
'gallery_dirs': ['auto_examples', 'auto_tutorials'],
'backreferences_dir': False}
'backreferences_dir': False,
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -124,34 +125,29 @@
html_theme_options = {
# Navigation bar title. (Default: ``project`` value)
# 'navbar_title': "Demo",

# Tab name for entire site. (Default: "Site")
# 'navbar_site_name': "Site",

# A list of tuples containing pages or urls to link to.
# Valid tuples should be in the following forms:
# (name, page) # a link to a page
# (name, "/aa/bb", 1) # a link to an arbitrary relative url
# (name, "http://example.com", True) # arbitrary absolute url
# Note the "1" or "True" value above as the third argument to indicate
# an arbitrary url.
'navbar_links': [("API", "api"),
("Gallery", "auto_examples/index"),
("Tutorials", "auto_tutorials/index")],

'navbar_links': [
("API", "api"),
("Gallery", "auto_examples/index"),
("Tutorials", "auto_tutorials/index"),
],
# Render the next and previous page links in navbar. (Default: true)
'navbar_sidebarrel': False,

# Render the current pages TOC in the navbar. (Default: true)
'navbar_pagenav': True,

# Tab name for the current pages TOC. (Default: "Page")
'navbar_pagenav_name': "Page",

# Global TOC depth for "site" navbar tab. (Default: 1)
# Switching to -1 shows all levels.
'globaltoc_depth': 2,

# Include hidden TOCs in Site navbar?
#
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
Expand All @@ -160,19 +156,15 @@
#
# Values: "true" (default) or "false"
'globaltoc_includehidden': "true",

# HTML navbar class (Default: "navbar") to attach to <div> element.
# For black navbar, do "navbar navbar-inverse"
'navbar_class': "navbar navbar-inverse",

# Fix navigation bar to top of page?
# Values: "true" (default) or "false"
'navbar_fixed_top': "true",

# Location of link to source.
# Options are "nav" (default), "footer" or anything else to exclude.
'source_link_position': "footer",

# Bootswatch (http://bootswatch.com/) theme.
#
# Options are nothing (default) or the name of a valid theme
Expand All @@ -185,7 +177,6 @@
# - Bootstrap 2: https://bootswatch.com/2
# - Bootstrap 3: https://bootswatch.com/3
'bootswatch_theme': "united",

# Choose Bootstrap version.
# Values: "3" (default) or "2" (in quotes)
'bootstrap_version': "3",
Expand Down Expand Up @@ -219,15 +210,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -237,19 +225,15 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'moabb.tex', 'moabb Documentation',
'Alexandre Barachant', 'manual'),
(master_doc, 'moabb.tex', 'moabb Documentation', 'Alexandre Barachant', 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'moabb', 'moabb Documentation',
[author], 1)
]
man_pages = [(master_doc, 'moabb', 'moabb Documentation', [author], 1)]


# -- Options for Texinfo output ----------------------------------------------
Expand All @@ -258,9 +242,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'moabb', 'moabb Documentation',
author, 'moabb', 'One line description of project.',
'Miscellaneous'),
(
master_doc,
'moabb',
'moabb Documentation',
author,
'moabb',
'One line description of project.',
'Miscellaneous',
),
]


Expand Down
37 changes: 22 additions & 15 deletions examples/plot_cross_session_motor_imagery.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@

pipelines = {}

pipelines['CSP + LDA'] = make_pipeline(CSP(n_components=8),
LDA())
pipelines['CSP + LDA'] = make_pipeline(CSP(n_components=8), LDA())

pipelines['RG + LR'] = make_pipeline(Covariances(),
TangentSpace(),
LogisticRegression(solver='lbfgs'))
pipelines['RG + LR'] = make_pipeline(
Covariances(), TangentSpace(), LogisticRegression(solver='lbfgs')
)

##############################################################################
# Evaluation
Expand All @@ -79,8 +78,9 @@
dataset.subject_list = dataset.subject_list[:2]
datasets = [dataset]
overwrite = False # set to True if we want to overwrite cached results
evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets,
suffix='examples', overwrite=overwrite)
evaluation = CrossSessionEvaluation(
paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite
)

results = evaluation.process(pipelines)

Expand All @@ -98,21 +98,28 @@

fig, axes = plt.subplots(1, 2, figsize=[8, 4], sharey=True)

sns.stripplot(data=results, y='score', x='pipeline', ax=axes[0], jitter=True,
alpha=.5, zorder=1, palette="Set1")
sns.pointplot(data=results, y='score', x='pipeline', ax=axes[0],
zorder=1, palette="Set1")
sns.stripplot(
data=results,
y='score',
x='pipeline',
ax=axes[0],
jitter=True,
alpha=0.5,
zorder=1,
palette="Set1",
)
sns.pointplot(data=results, y='score', x='pipeline', ax=axes[0], zorder=1, palette="Set1")

axes[0].set_ylabel('ROC AUC')
axes[0].set_ylim(0.5, 1)

# paired plot
paired = results.pivot_table(values='score', columns='pipeline',
index=['subject', 'session'])
paired = results.pivot_table(
values='score', columns='pipeline', index=['subject', 'session']
)
paired = paired.reset_index()

sns.regplot(data=paired, y='RG + LR', x='CSP + LDA', ax=axes[1],
fit_reg=False)
sns.regplot(data=paired, y='RG + LR', x='CSP + LDA', ax=axes[1], fit_reg=False)
axes[1].plot([0, 1], [0, 1], ls='--', c='k')
axes[1].set_xlim(0.5, 1)

Expand Down
19 changes: 13 additions & 6 deletions examples/plot_cross_session_multiple_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
freqs = paradigm.used_events(datasets[0])

pipeline = {}
pipeline["CCA"] = make_pipeline(
SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))
pipeline["CCA"] = make_pipeline(SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))

##############################################################################
# Get data (optional)
Expand Down Expand Up @@ -97,8 +96,9 @@

overwrite = True # set to True if we want to overwrite cached results

evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=datasets,
suffix='examples', overwrite=overwrite)
evaluation = CrossSessionEvaluation(
paradigm=paradigm, datasets=datasets, suffix='examples', overwrite=overwrite
)
results = evaluation.process(pipeline)

print(results.head())
Expand All @@ -109,6 +109,13 @@
#
# Here we plot the results, indicating the score for each session and subject

sns.catplot(data=results, x='session', y='score', hue='subject',
col='dataset', kind='bar', palette='viridis')
sns.catplot(
data=results,
x='session',
y='score',
hue='subject',
col='dataset',
kind='bar',
palette='viridis',
)
plt.show()
11 changes: 5 additions & 6 deletions examples/plot_cross_session_ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
freqs = paradigm.used_events(dataset)

pipeline = {}
pipeline["CCA"] = make_pipeline(
SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))
pipeline["CCA"] = make_pipeline(SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))

##############################################################################
# Get data (optional)
Expand All @@ -90,8 +89,9 @@

overwrite = True # set to True if we want to overwrite cached results

evaluation = CrossSessionEvaluation(paradigm=paradigm, datasets=dataset,
suffix='examples', overwrite=overwrite)
evaluation = CrossSessionEvaluation(
paradigm=paradigm, datasets=dataset, suffix='examples', overwrite=overwrite
)
results = evaluation.process(pipeline)

print(results.head())
Expand All @@ -103,7 +103,6 @@
# Here we plot the results, indicating the score for each session and subject

plt.figure()
sns.barplot(data=results, y='score', x='session',
hue='subject', palette='viridis')
sns.barplot(data=results, y='score', x='session', hue='subject', palette='viridis')

plt.show()
31 changes: 20 additions & 11 deletions examples/plot_cross_subject_ssvep.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@
ExtendedSSVEPSignal(),
Covariances(estimator='lwf'),
TangentSpace(),
LogisticRegression(solver='lbfgs', multi_class='auto'))
LogisticRegression(solver='lbfgs', multi_class='auto'),
)

pipelines = {}
pipelines['CCA'] = make_pipeline(
SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))
pipelines['CCA'] = make_pipeline(SSVEP_CCA(interval=interval, freqs=freqs, n_harmonics=3))

##############################################################################
# Evaluation
Expand All @@ -107,14 +107,16 @@

overwrite = False # set to True if we want to overwrite cached results

evaluation = CrossSubjectEvaluation(paradigm=paradigm,
datasets=dataset, overwrite=overwrite)
evaluation = CrossSubjectEvaluation(
paradigm=paradigm, datasets=dataset, overwrite=overwrite
)
results = evaluation.process(pipelines)

# Filter bank processing, determine automatically the filter from the
# stimulation frequency values of events.
evaluation_fb = CrossSubjectEvaluation(paradigm=paradigm_fb,
datasets=dataset, overwrite=overwrite)
evaluation_fb = CrossSubjectEvaluation(
paradigm=paradigm_fb, datasets=dataset, overwrite=overwrite
)
results_fb = evaluation_fb.process(pipelines_fb)

###############################################################################
Expand All @@ -129,10 +131,17 @@
# Here we plot the results.

fig, ax = plt.subplots(facecolor='white', figsize=[8, 4])
sns.stripplot(data=results, y='score', x='pipeline', ax=ax, jitter=True,
alpha=.5, zorder=1, palette="Set1")
sns.pointplot(data=results, y='score', x='pipeline', ax=ax,
zorder=1, palette="Set1")
sns.stripplot(
data=results,
y='score',
x='pipeline',
ax=ax,
jitter=True,
alpha=0.5,
zorder=1,
palette="Set1",
)
sns.pointplot(data=results, y='score', x='pipeline', ax=ax, zorder=1, palette="Set1")
ax.set_ylabel('Accuracy')
ax.set_ylim(0.1, 0.6)
plt.savefig('ssvep.png')
Expand Down
Loading