Skip to content

Commit

Permalink
Reformat setup and conf
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvallat committed Jun 20, 2022
1 parent 54832c7 commit 447d6cf
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 101 deletions.
89 changes: 47 additions & 42 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = ['sphinx.ext.mathjax',
'sphinx.ext.doctest',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.autosummary',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'matplotlib.sphinxext.plot_directive',
'sphinx_copybutton',
'numpydoc']
sys.path.insert(0, os.path.abspath("sphinxext"))
extensions = [
"sphinx.ext.mathjax",
"sphinx.ext.doctest",
"sphinx.ext.viewcode",
"sphinx.ext.githubpages",
"sphinx.ext.autosummary",
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"matplotlib.sphinxext.plot_directive",
"sphinx_copybutton",
"numpydoc",
]

# Generate the API documentation when building
autosummary_generate = True
autodoc_default_options = {
'members': True,
'member-order': 'groupwise',
'undoc-members': False,
"members": True,
"member-order": "groupwise",
"undoc-members": False,
# 'special-members': '__init__',
# 'exclude-members': '__weakref__'
}
Expand All @@ -49,15 +51,17 @@

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
source_suffix = '.rst'
source_suffix = ".rst"

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'yasa'
author = 'Raphael Vallat'
copyright = u'2018-{}, Dr. Raphael Vallat, Center for Human Sleep Science, UC Berkeley'.format(time.strftime("%Y"))
project = "yasa"
author = "Raphael Vallat"
copyright = "2018-{}, Dr. Raphael Vallat, Center for Human Sleep Science, UC Berkeley".format(
time.strftime("%Y")
)

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -79,56 +83,57 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False

# -- Options for HTML output ----------------------------------------------

# Bootstrap theme
html_theme = 'bootstrap'
html_theme = "bootstrap"
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
html_theme_options = {
'source_link_position': "footer",
"source_link_position": "footer",
# 'navbar_title': ' ', # we replace this with an image
'bootswatch_theme': "flatly",
'navbar_sidebarrel': False,
"bootswatch_theme": "flatly",
"navbar_sidebarrel": False,
# 'nosidebar': True,
# 'navbar_site_name': "",
'navbar_pagenav': False,
'bootstrap_version': "3",
'navbar_class': "navbar",
'navbar_links': [
"navbar_pagenav": False,
"bootstrap_version": "3",
"navbar_class": "navbar",
"navbar_links": [
("API", "api"),
("Quickstart", "quickstart"),
("FAQ", "faq"),
("What's new", "changelog"),
("Contribute", "contributing")],
("Contribute", "contributing"),
],
}

html_logo = 'pictures/yasa_128x128.png'
html_favicon = 'pictures/favicon.ico'
html_logo = "pictures/yasa_128x128.png"
html_favicon = "pictures/favicon.ico"

# -- Options for HTML output ------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'yasadoc'
htmlhelp_basename = "yasadoc"
html_show_sourcelink = False

# -- Intersphinx ------------------------------------------------

intersphinx_mapping = {
'numpy': ('http://docs.scipy.org/doc/numpy/', None),
'scipy': ('http://docs.scipy.org/doc/scipy/reference/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'sklearn': ('https://scikit-learn.org/stable/', None),
'matplotlib': ('https://matplotlib.org/', None),
'mne': ('https://martinos.org/mne/stable/', None),
'seaborn': ('https://seaborn.pydata.org/', None),
'pyriemann': ('https://pyriemann.readthedocs.io/en/latest/', None),
'tensorpac': ('https://etiennecmb.github.io/tensorpac/', None),
"numpy": ("http://docs.scipy.org/doc/numpy/", None),
"scipy": ("http://docs.scipy.org/doc/scipy/reference/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"sklearn": ("https://scikit-learn.org/stable/", None),
"matplotlib": ("https://matplotlib.org/", None),
"mne": ("https://martinos.org/mne/stable/", None),
"seaborn": ("https://seaborn.pydata.org/", None),
"pyriemann": ("https://pyriemann.readthedocs.io/en/latest/", None),
"tensorpac": ("https://etiennecmb.github.io/tensorpac/", None),
}
17 changes: 8 additions & 9 deletions notebooks/run_visbrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from yasa import spindles_detect, sw_detect

# Load the data and hypnogram
data = np.load('data_full_6hrs_100Hz_Cz+Fz+Pz.npz').get('data')
ch_names = ['Cz', 'Fz', 'Pz']
hypno = np.load('data_full_6hrs_100Hz_hypno.npz').get('hypno')
data = np.load("data_full_6hrs_100Hz_Cz+Fz+Pz.npz").get("data")
ch_names = ["Cz", "Fz", "Pz"]
hypno = np.load("data_full_6hrs_100Hz_hypno.npz").get("hypno")

# Initialize a Visbrain.gui.Sleep instance
sl = Sleep(data=data, channels=ch_names, sf=100, hypno=hypno)
Expand All @@ -22,23 +22,22 @@ def fcn_spindle(data, sf, time, hypno):
# sp = spindles_detect(data, sf).summary()
# NREM sleep only
sp = spindles_detect(data, sf, hypno=hypno).summary()
return (sp[['Start', 'End']].values * sf).astype(int)
return (sp[["Start", "End"]].values * sf).astype(int)


# Define slow-waves function
def fcn_sw(data, sf, time, hypno):
"""Replace Visbrain built-in slow-wave detection by YASA algorithm.
"""
"""Replace Visbrain built-in slow-wave detection by YASA algorithm."""
# On N2 / N3 sleep only
# Note that if you want to apply the detection on N3 sleep only, you should
# use sw_detect(..., include=(3)).summary()
sw = sw_detect(data, sf, hypno=hypno).summary()
return (sw[['Start', 'End']].values * sf).astype(int)
return (sw[["Start", "End"]].values * sf).astype(int)


# Replace the native Visbrain detections
sl.replace_detections('spindle', fcn_spindle)
sl.replace_detections('sw', fcn_sw)
sl.replace_detections("spindle", fcn_spindle)
sl.replace_detections("sw", fcn_sw)

# Launch the Graphical User Interface
sl.show()
102 changes: 52 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,71 +6,73 @@
LONG_DESCRIPTION = """YASA (Yet Another Spindle Algorithm) : fast and robust detection of spindles, slow-waves, and rapid eye movements from sleep EEG recordings..
"""

DISTNAME = 'yasa'
MAINTAINER = 'Raphael Vallat'
MAINTAINER_EMAIL = 'raphaelvallat9@gmail.com'
URL = 'https://github.com/raphaelvallat/yasa/'
LICENSE = 'BSD (3-clause)'
DOWNLOAD_URL = 'https://github.com/raphaelvallat/yasa/'
VERSION = '0.6.1'
PACKAGE_DATA = {'yasa.data.icons': ['*.svg']}
DISTNAME = "yasa"
MAINTAINER = "Raphael Vallat"
MAINTAINER_EMAIL = "raphaelvallat9@gmail.com"
URL = "https://github.com/raphaelvallat/yasa/"
LICENSE = "BSD (3-clause)"
DOWNLOAD_URL = "https://github.com/raphaelvallat/yasa/"
VERSION = "0.6.1"
PACKAGE_DATA = {"yasa.data.icons": ["*.svg"]}

INSTALL_REQUIRES = [
'numpy',
'scipy',
'pandas',
'matplotlib',
'seaborn',
'mne>=0.20.0',
'numba',
'outdated',
'antropy',
'scikit-learn',
'tensorpac>=0.6.5',
'pyriemann>=0.2.7',
'sleepecg>=0.5.0',
'lspopt',
'ipywidgets',
'joblib'
"numpy",
"scipy",
"pandas",
"matplotlib",
"seaborn",
"mne>=0.20.0",
"numba",
"outdated",
"antropy",
"scikit-learn",
"tensorpac>=0.6.5",
"pyriemann>=0.2.7",
"sleepecg>=0.5.0",
"lspopt",
"ipywidgets",
"joblib",
]

PACKAGES = [
'yasa',
"yasa",
]

CLASSIFIERS = [
'Intended Audience :: Science/Research',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: Unix',
'Operating System :: MacOS'
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
]

try:
from setuptools import setup

_has_setuptools = True
except ImportError:
from distutils.core import setup

if __name__ == "__main__":

setup(name=DISTNAME,
author=MAINTAINER,
author_email=MAINTAINER_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
license=LICENSE,
url=URL,
version=VERSION,
download_url=DOWNLOAD_URL,
install_requires=INSTALL_REQUIRES,
include_package_data=True,
packages=PACKAGES,
package_data=PACKAGE_DATA,
classifiers=CLASSIFIERS,
)
setup(
name=DISTNAME,
author=MAINTAINER,
author_email=MAINTAINER_EMAIL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
license=LICENSE,
url=URL,
version=VERSION,
download_url=DOWNLOAD_URL,
install_requires=INSTALL_REQUIRES,
include_package_data=True,
packages=PACKAGES,
package_data=PACKAGE_DATA,
classifiers=CLASSIFIERS,
)

0 comments on commit 447d6cf

Please sign in to comment.