| |
| |
|
|
| import inspect |
| import os |
| import os.path as op |
| import sys |
|
|
| import matplotlib |
|
|
|
|
| matplotlib.use("agg") |
|
|
| from datetime import datetime |
|
|
| import sphinx_gallery |
| from numpydoc import docscrape, numpydoc |
| from sphinx_gallery.sorting import ExplicitOrder, FileNameSortKey |
|
|
| import moabb |
|
|
|
|
| sys.path.insert(0, os.path.abspath("../")) |
| sys.path.insert(0, os.path.abspath("../../")) |
|
|
| |
| _local_init = op.join(op.dirname(__file__), "..", "..", "moabb", "__init__.py") |
| if op.isfile(_local_init): |
| import re as _re |
|
|
| with open(_local_init) as _f: |
| _match = _re.search(r'^__version__\s*=\s*["\']([^"\']+)', _f.read(), _re.M) |
| if _match and _match.group(1) != moabb.__version__: |
| print( |
| f"WARNING: Building docs with moabb v{moabb.__version__} but " |
| f"source tree is v{_match.group(1)}. " |
| f"Run 'pip install -e .' from the project root first." |
| ) |
|
|
| matplotlib.use("Agg") |
| |
|
|
| project = "moabb" |
| year = datetime.now().year |
| copyright = f"2018-{year} MOABB contributors" |
| author = "Alexandre Barachant, Vinay Jayaram, Sylvain Chevallier" |
|
|
| |
| version = moabb.__version__ |
| |
| release = f"{moabb.__version__}-dev" |
|
|
| |
| html_title = "MOABB Documentation" |
| html_short_title = "MOABB" |
|
|
|
|
| |
|
|
| |
| needs_sphinx = "2.0" |
|
|
| curdir = os.path.dirname(__file__) |
| sys.path.append(os.path.abspath(os.path.join(curdir, "sphinxext"))) |
|
|
| |
| |
| |
| extensions = [ |
| "sphinx.ext.autodoc", |
| "sphinx.ext.autosummary", |
| "sphinx.ext.doctest", |
| "sphinx.ext.todo", |
| "sphinx.ext.coverage", |
| "sphinx.ext.githubpages", |
| "sphinx.ext.mathjax", |
| "sphinx.ext.ifconfig", |
| "sphinx.ext.intersphinx", |
| "sphinx.ext.napoleon", |
| "sphinx.ext.linkcode", |
| "sphinx_copybutton", |
| "sphinx_design", |
| "sphinx_gallery.gen_gallery", |
| "gh_substitutions", |
| "dataset_timeline_ext", |
| "macro_table_ext", |
| "myst_parser", |
| "numpydoc", |
| "sphinx_favicon", |
| "sphinxcontrib.jquery", |
| "sphinx_sitemap", |
| "sphinxext.opengraph", |
| ] |
|
|
| _build_sitemap = os.environ.get("MOABB_BUILD_SITEMAP", "1").strip().lower() |
| if _build_sitemap in {"0", "false", "no"}: |
| extensions = [ext for ext in extensions if ext != "sphinx_sitemap"] |
|
|
| |
| |
| |
| dataset_card_generate_svgs = os.environ.get( |
| "MOABB_DATASET_CARD_GENERATE_SVGS", "1" |
| ).strip().lower() in {"1", "true", "yes"} |
|
|
|
|
| def linkcode_resolve(domain, info): |
| """Determine the URL corresponding to a Python object. |
| |
| Parameters |
| ---------- |
| domain : str |
| Only useful when "py". |
| info : dict |
| With keys "module" and "fullname". |
| |
| Returns |
| ------- |
| url : str |
| The code URL. |
| |
| Notes |
| ----- |
| This has been adapted to deal with our "verbose" decorator. |
| Adapted from SciPy (doc/source/conf.py). |
| """ |
| repo = "https://github.com/NeuroTechX/moabb" |
|
|
| if domain != "py": |
| return None |
| if not info["module"]: |
| return None |
|
|
| modname = info["module"] |
| fullname = info["fullname"] |
|
|
| submod = sys.modules.get(modname) |
| if submod is None: |
| return None |
|
|
| obj = submod |
| for part in fullname.split("."): |
| try: |
| obj = getattr(obj, part) |
| except Exception: |
| return None |
|
|
| try: |
| fn = inspect.getsourcefile(obj) |
| except Exception: |
| fn = None |
| if not fn: |
| try: |
| fn = inspect.getsourcefile(sys.modules[obj.__module__]) |
| except Exception: |
| fn = None |
| if not fn: |
| return None |
| fn = op.relpath(fn, start=op.dirname(moabb.__file__)) |
| fn = "/".join(op.normpath(fn).split(os.sep)) |
|
|
| try: |
| source, lineno = inspect.getsourcelines(obj) |
| except Exception: |
| lineno = None |
|
|
| if lineno: |
| linespec = "#L%d-L%d" % (lineno, lineno + len(source) - 1) |
| else: |
| linespec = "" |
|
|
| |
| |
| |
| |
| return f"{repo}/blob/develop/moabb/{fn}{linespec}" |
|
|
|
|
| |
|
|
| |
| |
| |
| curdir = os.path.dirname(__file__) |
| sys.path.append(os.path.abspath(os.path.join(curdir, "..", "moabb"))) |
| sys.path.append(os.path.abspath(os.path.join(curdir, "sphinxext"))) |
|
|
| sphinx_gallery_conf = { |
| "examples_dirs": ["../../examples"], |
| "gallery_dirs": ["auto_examples"], |
| "doc_module": ("moabb", "mne"), |
| "backreferences_dir": "generated", |
| "show_memory": True, |
| "reference_url": dict(moabb=None), |
| "filename_pattern": "(/plot_|/tutorial_)", |
| "default_thumb_file": "../images/moabb_logo_copy.png", |
| "subsection_order": ExplicitOrder( |
| [ |
| "../../examples/tutorials", |
| "../../examples/paradigm_examples", |
| "../../examples/data_management_and_configuration", |
| "../../examples/how_to_benchmark", |
| "../../examples/advanced_examples", |
| "../../examples/learning_curve", |
| ] |
| ), |
| "within_subsection_order": "FileNameSortKey", |
| |
| "parallel": os.environ.get("SPHINX_GALLERY_PARALLEL", "true").lower() == "true", |
| } |
|
|
|
|
| autodoc_default_options = {} |
| autodoc_default_flags = {} |
| autosummary_generate = True |
|
|
| numpydoc_show_class_members = False |
|
|
| exclude_patterns = ["build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"] |
|
|
| |
| templates_path = ["_templates"] |
|
|
| |
| |
| |
| source_suffix = [".rst", ".md"] |
|
|
| |
| master_doc = "index" |
|
|
| |
| |
| |
| |
| |
| language = "en" |
|
|
| |
| pygments_style = "sphinx" |
|
|
| |
|
|
| |
| |
|
|
|
|
| html_theme = "pydata_sphinx_theme" |
| switcher_version_match = "dev" if release.endswith("dev0") else version |
| |
| |
| |
|
|
| html_theme_options = { |
| "icon_links": [ |
| dict( |
| name="GitHub", |
| url="https://github.com/NeuroTechX/moabb", |
| icon="fa-brands fa-github", |
| ), |
| dict( |
| name="PyPI", |
| url="https://pypi.org/project/moabb/", |
| icon="fa-brands fa-python", |
| ), |
| ], |
| "icon_links_label": "External Links", |
| "use_edit_page_button": True, |
| "navigation_with_keys": False, |
| "collapse_navigation": False, |
| "navigation_depth": -1, |
| "show_toc_level": 1, |
| "nosidebar": True, |
| "navbar_end": ["theme-switcher", "navbar-icon-links"], |
| "announcement": ( |
| "<strong>Using MOABB in academic work?</strong> " |
| "<a class='moabb-announcement-cta' href='cite.html'>Cite MOABB</a> " |
| "<span class='moabb-announcement-secondary'>" |
| "DOI: <a href='https://doi.org/10.5281/zenodo.10034223'>10.5281/zenodo.10034223</a> · " |
| "Explore <a href='paper_results.html'>benchmark results</a>" |
| "</span>" |
| ), |
| "show_version_warning_banner": True, |
| "analytics": dict(google_analytics_id="G-5WJBKDMSTE"), |
| "pygments_light_style": "tango", |
| "pygments_dark_style": "monokai", |
| "logo": { |
| "image_light": "moabb_light.svg", |
| "image_dark": "moabb_dark.svg", |
| }, |
| "secondary_sidebar_items": { |
| "**": [ |
| "page-toc", |
| "sg_download_links", |
| "sg_launcher_links", |
| ], |
| }, |
| "footer_start": ["copyright"], |
| "footer_end": ["sphinx-version", "theme-version"], |
| } |
|
|
| html_sidebars = { |
| "whats_new": [], |
| "paper_results": [], |
| "dataset_summary": [], |
| "api": [], |
| } |
|
|
| |
| |
| html_logo = "_static/moabb_logo.svg" |
|
|
| |
| |
| |
| html_static_path = ["_static"] |
|
|
| |
| html_baseurl = "https://moabb.neurotechx.com/docs/" |
|
|
| |
| sitemap_url_scheme = "{link}" |
| sitemap_excludes = [ |
| "genindex", |
| "py-modindex", |
| "search", |
| "auto_examples/*/sg_execution_times", |
| "auto_examples/sg_execution_times", |
| ] |
|
|
| |
| ogp_site_url = "https://moabb.neurotechx.com/docs/" |
| ogp_site_name = "MOABB - Mother of all BCI Benchmarks" |
| ogp_image = "https://moabb.neurotechx.com/docs/_static/moabb_og_card.png" |
| ogp_image_alt = ( |
| "MOABB - Mother of all BCI Benchmarks: " |
| "158 open EEG datasets for reproducible BCI research" |
| ) |
| ogp_description_length = 200 |
| ogp_type = "website" |
| ogp_custom_meta_tags = [ |
| '<meta name="twitter:card" content="summary_large_image" />', |
| '<meta name="twitter:site" content="@NeuroTechX" />', |
| ] |
|
|
| |
| |
| |
| ogp_social_cards = { |
| "image": "_static/moabb_logo.png", |
| "line_color": "#4a90d9", |
| } |
|
|
| |
| html_extra_path = ["robots.txt", "llms.txt", "llms-full.txt", "google07a8f2e31a591297.html"] |
|
|
| html_css_files = [ |
| "css/custom.css", |
| "https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap", |
| "css/macro-table.css", |
| |
| "https://cdn.datatables.net/2.2.0/css/dataTables.dataTables.css", |
| "https://cdn.datatables.net/buttons/3.2.6/css/buttons.dataTables.css", |
| "https://cdn.datatables.net/searchpanes/2.3.5/css/searchPanes.dataTables.css", |
| "https://cdn.datatables.net/select/3.1.3/css/select.dataTables.css", |
| "https://cdn.datatables.net/fixedheader/4.0.6/css/fixedHeader.dataTables.css", |
| ] |
|
|
| html_js_files = [ |
| "https://code.jquery.com/jquery-3.7.1.min.js", |
| |
| "https://cdn.datatables.net/2.2.0/js/dataTables.js", |
| |
| "https://cdn.datatables.net/buttons/3.2.6/js/dataTables.buttons.js", |
| "https://cdn.datatables.net/buttons/3.2.6/js/buttons.html5.js", |
| "https://cdn.datatables.net/buttons/3.2.6/js/buttons.colVis.js", |
| "https://cdn.datatables.net/buttons/3.2.6/js/buttons.print.js", |
| |
| "https://cdn.datatables.net/select/3.1.3/js/dataTables.select.js", |
| "https://cdn.datatables.net/searchpanes/2.3.5/js/dataTables.searchPanes.js", |
| "https://cdn.datatables.net/searchpanes/2.3.5/js/searchPanes.dataTables.js", |
| |
| "https://cdn.datatables.net/fixedheader/4.0.6/js/dataTables.fixedHeader.js", |
| "js/section-nav-hierarchy.js", |
| "js/macro-table.js", |
| ] |
|
|
| |
| html_show_sourcelink = False |
| html_copy_source = False |
|
|
| |
| html_show_sphinx = False |
|
|
| |
|
|
| |
| htmlhelp_basename = "moabbdoc" |
|
|
| |
| xs = "2" |
| sm = "2.5" |
| md = "3" |
| lg = "4.5" |
| xl = "5" |
| xxl = "6" |
|
|
| html_context = { |
| "build_dev_html": bool(int(os.environ.get("BUILD_DEV_HTML", False))), |
| "default_mode": "light", |
| "icon_links_label": "Quick Links", |
| "show_toc_level": 1, |
| "github_user": "neurotechx", |
| "github_repo": "moabb", |
| "github_version": "develop", |
| "doc_path": "docs", |
| |
| "colab_repo": "NeuroTechX/moabb", |
| "colab_branch": "gh-pages", |
| |
| "colab_docs_path": "docs", |
| |
| "carousel": [ |
| dict( |
| title="Datasets", |
| text="Access 158 open EEG datasets for motor imagery, P300, SSVEP, and c-VEP paradigms.", |
| url="dataset_summary.html", |
| img="datasets_overview.png", |
| alt="Datasets overview", |
| ), |
| dict( |
| title="Evaluations", |
| text="Cross-session, cross-subject, and within-session evaluation schemes.", |
| url="api.html#evaluations", |
| img="crosssubj.png", |
| alt="Cross-subject evaluation", |
| ), |
| dict( |
| title="Preprocessing", |
| text="Flexible preprocessing pipelines with MNE-Python integration.", |
| url="auto_examples/advanced_examples/plot_pre_processing_steps.html", |
| img="architecture.png", |
| alt="Preprocessing steps", |
| ), |
| dict( |
| title="Paradigms", |
| text="Motor imagery, P300, SSVEP, and other BCI paradigms ready to use.", |
| url="auto_examples/paradigm_examples/index.html", |
| img="moabb_logo_copy.png", |
| alt="Paradigms", |
| ), |
| dict( |
| title="Analysis & Statistics", |
| text="Comprehensive analysis tools, statistical tests, and visualizations.", |
| url="auto_examples/advanced_examples/plot_statistical_analysis.html", |
| img="statistical_analysis.png", |
| alt="Statistical analysis", |
| ), |
| dict( |
| title="Benchmark Results", |
| text="Explore the largest BCI EEG benchmark with standardized results.", |
| url="paper_results.html", |
| img="withinsess.png", |
| alt="Benchmark results", |
| ), |
| ], |
| } |
|
|
|
|
| |
|
|
| latex_elements = { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| } |
|
|
| latex_logo = "_static/moabb_logo.svg" |
| latex_toplevel_sectioning = "part" |
|
|
| |
| |
| |
| latex_documents = [ |
| (master_doc, "moabb.tex", "moabb Documentation", "Alexandre Barachant", "manual"), |
| ] |
|
|
|
|
| |
|
|
| |
| |
| brand_icons = ("apple", "linux", "windows", "discourse", "python") |
| fixed_icons = ( |
| |
| "book", |
| "code-branch", |
| "newspaper", |
| "question-circle", |
| "quote-left", |
| |
| "bug", |
| "comment", |
| "hand-sparkles", |
| "magic", |
| "pencil-alt", |
| "remove-format", |
| "universal-access", |
| "discourse", |
| "python", |
| ) |
| other_icons = ( |
| "hand-paper", |
| "question", |
| "rocket", |
| "server", |
| "code", |
| "desktop", |
| "terminal", |
| "cloud-download-alt", |
| "wrench", |
| "hourglass", |
| ) |
| icons = dict() |
| for icon in brand_icons + fixed_icons + other_icons: |
| font = ("fab" if icon in brand_icons else "fas",) |
| fw = ("fa-fw",) if icon in fixed_icons else () |
| icons[icon] = font + fw |
|
|
| prolog = "" |
| for icon, classes in icons.items(): |
| prolog += f""" |
| .. |{icon}| raw:: html |
| |
| <i class="{" ".join(classes)} fa-{icon}"></i> |
| """ |
|
|
| prolog += """ |
| .. |fix-bug| raw:: html |
| |
| <span class="fa-stack small-stack"> |
| <i class="fas fa-bug fa-stack-1x"></i> |
| <i class="fas fa-ban fa-stack-2x"></i> |
| </span> |
| """ |
|
|
| prolog += """ |
| .. |ensp| unicode:: U+2002 .. EN SPACE |
| """ |
|
|
|
|
| |
|
|
| |
| |
| man_pages = [(master_doc, "moabb", "moabb Documentation", [author], 1)] |
|
|
|
|
| |
|
|
| |
| |
| |
| texinfo_documents = [ |
| ( |
| master_doc, |
| "moabb", |
| "moabb Documentation", |
| author, |
| "moabb", |
| "Mother of all BCI benchmarks.", |
| "Miscellaneous", |
| ), |
| ] |
|
|
| |
| intersphinx_mapping = { |
| "python": ("https://docs.python.org/{.major}".format(sys.version_info), None), |
| "numpy": ("https://docs.scipy.org/doc/numpy/", None), |
| "scipy": ("https://docs.scipy.org/doc/scipy/reference", None), |
| "matplotlib": ("https://matplotlib.org/", None), |
| "sklearn": ("https://scikit-learn.org/stable/", None), |
| "mne": ("https://mne.tools/stable/", None), |
| "skorch": ("https://skorch.readthedocs.io/en/stable/", None), |
| "torch": ("https://pytorch.org/docs/stable/", None), |
| "pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None), |
| } |
|
|
| |
| |
| |
| |
| |
| |
| nitpick_ignore_regex = [ |
| |
| (r"py:class", r"default.*"), |
| (r"py:class", r"optional"), |
| (r"py:class", r"shape"), |
| (r"py:class", r"array-like"), |
| (r"py:class", r"n_\w+"), |
| (r"py:class", r"True"), |
| (r"py:class", r"False"), |
| (r"py:class", r"numeric"), |
| (r"py:class", r"RandomState instance"), |
| (r"py:class", r"\d+\.?"), |
| (r"py:class", r"string"), |
| (r"py:class", r"strings"), |
| (r"py:class", r"boolean"), |
| (r"py:class", r"Unused"), |
| (r"py:class", r"ignored"), |
| (r"py:class", r"callable"), |
| (r"py:class", r"length.*"), |
| ] |
|
|
| |
| favicons = [ |
| { |
| "rel": "moabb icon", |
| "sizes": "180x180", |
| "href": "_static/moabb_logo.png", |
| }, |
| {"rel": "icon", "href": "favicon.svg", "type": "image/svg+xml"}, |
| {"rel": "icon", "sizes": "144x144", "href": "favicon-144.png", "type": "image/png"}, |
| {"rel": "mask-icon", "href": "favicon_mask-icon.svg", "color": "#222832"}, |
| {"rel": "apple-touch-icon", "sizes": "500x500", "href": "favicon-500.png"}, |
| ] |
|
|
| |
| |
| suppress_warnings = ["myst.header"] |
|
|