diff --git a/.gitignore b/.gitignore index 00b4768..0c7aa7f 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ build dist src +neuroclick +_build diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..3963494 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SPHINXPROJ = neuroclick +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/code.rst b/docs/code.rst new file mode 100644 index 0000000..e5f2416 --- /dev/null +++ b/docs/code.rst @@ -0,0 +1,7 @@ +Autodoc test +=============== + + +.. click:: neuropype:cli + :prog: neuropype + :show-nested: diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..692ca05 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,179 @@ +# -*- coding: utf-8 -*- +# +# neuroclick documentation build configuration file, created by +# sphinx-quickstart on Fri Jan 27 18:55:36 2017. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('../neuropype_cli')) + + +# from mock import Mock as MagicMock + +# class Mock(MagicMock): +# @classmethod +# def __getattr__(cls, name): +# return MagicMock() + +# MOCK_MODULES = ['numpy', 'scipy', 'scipy.linalg', 'scipy.signal'] +# sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = ['sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx_click.ext'] + +# autodoc_mock_imports = ['numpy', 'nipype.pipeline.engine', 'click', 'neuropype_ephy'] +autodoc_mock_imports = ['numpy', 'nipype.pipeline.engine', 'neuropype_ephy'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'neuroclick' +copyright = u'2017, Dmitrii Altukhov' +author = u'Dmitrii Altukhov' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'0.1' +# The full version, including alpha/beta/rc tags. +release = u'0.1.1' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# 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'] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +# html_theme = 'alabaster' +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Options for HTMLHelp output ------------------------------------------ + +# Output file base name for HTML help builder. +htmlhelp_basename = 'neuroclickdoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # 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', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'neuroclick.tex', u'neuroclick Documentation', + u'Dmitrii Altukhov', '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, 'neuroclick', u'neuroclick Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'neuroclick', u'neuroclick Documentation', + author, 'neuroclick', 'One line description of project.', + 'Miscellaneous'), +] + + + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} diff --git a/docs/hahaha.rst b/docs/hahaha.rst new file mode 100644 index 0000000..efc86e8 --- /dev/null +++ b/docs/hahaha.rst @@ -0,0 +1,5 @@ +Header +====== + +Just testing things here + diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..d4ce3f1 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,24 @@ +.. neuroclick documentation master file, created by + sphinx-quickstart on Fri Jan 27 18:55:36 2017. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to neuroclick's documentation! +====================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + intro + code + hahaha + + + +.. Indices and tables +.. ================== + +.. * :ref:`genindex` +.. * :ref:`modindex` +.. * :ref:`search` diff --git a/docs/intro.rst b/docs/intro.rst new file mode 100644 index 0000000..3454979 --- /dev/null +++ b/docs/intro.rst @@ -0,0 +1,5 @@ +Introducion +=========== + +.. Some introduction here +Also I would like to thank my mom diff --git a/neuropype_cli/neuropype.py b/neuropype_cli/neuropype.py index fe5f4eb..09d8e8c 100644 --- a/neuropype_cli/neuropype.py +++ b/neuropype_cli/neuropype.py @@ -1,4 +1,4 @@ -"""Command line interface for neuropype_ephy package""" +''' Command line interface for neuropype_ephy package ''' import click import nipype.pipeline.engine as pe @@ -19,34 +19,7 @@ @click.option('--verbose/--no-verbose', default=True, help='verbosity level') def cli(ncpu, plugin, save_path, workflow_name, verbose): - """ - Parallel processing of MEG/EEG data - -Description: - - Create and connect nodes to build a data processing pipeline. - - Nodes are connected in the order of execution except for the input - node which is always the last (restriction of Click framework which allowes only - one command with undefined number of inputs given that this command goes last) - - To make the best use of this tool it's strongly recommended to use wildcards - to fetch the files that you want to process. - -Examples: - - neuropype -p Linear ds2fif epoch -l 20 ep2ts mse input ./*/Control01_closed*.ds - - This pipeline gets all .ds files that are located in subfolders of the - current folder 'input ./s/Control01_closed*.ds', - converts them to .fif format [ds2fif], cuts data in epochs of 20 seconds [epoch -l 20], - converts -epo.fif files with epochs to .npy format [ep2ts] - and computes multiscale entropy on the resulting epochs [mse]. - All calculations are run sequentially which is governed by - -p Linear option - - - """ + """Parallel processing of MEG/EEG data""" output_greeting() @@ -111,7 +84,7 @@ def process_pipeline(nodes, ncpu, plugin, save_path, workflow_name, verbose): @cli.command('input') @click.argument('fif_files', nargs=-1, type=click.Path(exists=True)) def infosrc(fif_files): - """Get input files + '''Create input node. Use wildcards to run computations on multiple files; To check yourself it's a good idea to run ls command first like this: @@ -121,7 +94,7 @@ def infosrc(fif_files): $ neuropype input ./*/*.fif - """ + ''' from os.path import abspath, split from os.path import commonprefix as cprfx @@ -158,7 +131,7 @@ def infosrc(fif_files): @click.option('--fmax', default=300., help='higher frequency bound; default=300') def psd(fmin, fmax): - """Compute power spectral density + '''Create power computation node. Lower and higher frequency bounds for computation can be changed @@ -169,7 +142,7 @@ def psd(fmin, fmax): $ neuropype pwr input ~/fif_epochs/*/*-epo.fif - """ + ''' from neuropype_ephy.interfaces.mne.power import Power # click.echo(list(fif_files)) power = pe.Node(interface=Power(), name='pwr') @@ -192,7 +165,7 @@ def psd(fmin, fmax): @click.option('--sfreq', '-s', nargs=1, type=click.INT, help='data sampling frequency') def connectivity(band, method, sfreq): - """Compute spectral connectivity measures""" + """Create spectral connectivity node""" from neuropype_ephy.interfaces.mne.spectral import SpectralConn # if not method: # method = ('imcoh',) @@ -209,7 +182,7 @@ def connectivity(band, method, sfreq): # --------------------- Epochs to timeseries node ------------------------- # @cli.command('ep2ts') def fif_ep_2_ts(): - """Convert -epo.fif files to .npy""" + ''' Create a node for epochs 2 npy timeseries conversion ''' from neuropype_ephy.nodes.import_data import Ep2ts ep2ts = pe.Node(interface=Ep2ts(), name='ep2ts') @@ -222,7 +195,7 @@ def fif_ep_2_ts(): @click.option('-m', default=2) @click.option('-r', default=0.2) def multiscale(m, r): - """Compute multiscale entropy + """Create multiscale entropy node Experimental functionality. Available only in mse branch of neuropype_ephy @@ -264,7 +237,7 @@ def ica(n_components, ecg_ch_name, eog_ch_name): @click.option('--ds_freq', '-d', type=click.INT, help='downsampling frequency') def preproc(l_freq, h_freq, ds_freq): - """Filter and downsample data + """Create preprocessing node. Filter and downsample of raw .fif data @@ -289,7 +262,12 @@ def preproc(l_freq, h_freq, ds_freq): # -------------------------- DS2FIF node --------------------------------- # @cli.command('ds2fif') def ds2fif(): - """Convert CTF data in .ds format to .fif""" + """Create ds2fif node. + + + Convert CTF .ds raw data to .fif format + + """ from neuropype_ephy.nodes.import_data import ConvertDs2Fif ds2fif_node = pe.Node(interface=ConvertDs2Fif(), name='ds2fif') @@ -303,7 +281,9 @@ def ds2fif(): @click.option('--length', '-l', type=click.FLOAT, help='epoch length') def epoch(length): - """Perform epoching on raw .fif resting state data""" + """Epoch raw .fif resting state data + + """ from neuropype_ephy.interfaces.mne.preproc import CreateEp epoch_node = pe.Node(interface=CreateEp(), name='epoch') @@ -320,7 +300,7 @@ def map_path(key, iter_mapping): def output_greeting(): - """Print greeting""" + """Output greeting""" click.echo(click.style(r''' _ _ ___ _ _ ___ ___ _____ _____ ___ diff --git a/requirements.txt b/requirements.txt index 7947f15..cbce303 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,48 @@ -e git+https://github.com/dmalt/neuropype_ephy#egg=neuropype_ephy-0.0.1 +alabaster==0.7.10 +Babel==2.5.1 +backports.functools-lru-cache==1.4 +certifi==2017.7.27.1 +chardet==3.0.4 +click==6.7 +configparser==3.5.0 +cycler==0.10.0 +decorator==4.1.2 +docutils==0.14 +funcsigs==1.0.2 +future==0.16.0 +idna==2.6 +imagesize==0.7.1 +isodate==0.6.0 +Jinja2==2.9.6 +lxml==4.1.0 +MarkupSafe==1.0 +matplotlib==2.1.0 +mne==0.15 +mock==2.0.0 +networkx==2.0 +nibabel==2.2.0 +nipype==0.13.1 +numpy==1.13.3 +pbr==3.1.1 +prov==1.5.1 +py==1.4.34 +pydotplus==2.0.2 +Pygments==2.2.0 +pyparsing==2.2.0 +pytest==3.2.3 +python-dateutil==2.6.1 +pytz==2017.2 +rdflib==4.2.2 +requests==2.18.4 +scipy==0.19.1 +simplejson==3.11.1 +six==1.11.0 +snowballstemmer==1.2.1 +Sphinx==1.6.4 +sphinx-click==1.0.3 +sphinxcontrib-websupport==1.0.1 +subprocess32==3.2.7 +traits==4.6.0 +typing==3.6.2 +urllib3==1.22