Skip to content

Commit

Permalink
more documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
robintibor committed Jul 5, 2017
1 parent 8ca5207 commit 6555ffc
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions braindecode/datautil/signal_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def apply_to_X_y(fn, *sets):
Apply a function to all `X` and `y` attributes of all given sets.
Applies function to list of X arrays and to list of y arrays separately.
Parameters
----------
fn: function
Expand Down
13 changes: 7 additions & 6 deletions braindecode/datautil/trial_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def create_signal_target_from_raw_mne(raw, name_to_start_codes, epoch_ival_ms,
Epoching interval in milliseconds. In case only `name_to_codes` given,
represents start offset and stop offset from start markers. In case
`name_to_stop_codes` given, represents offset from start marker
and offset from stop marker. E.g. [500, -500] would mean 500ms
after the start marker until 500 ms before the stop marker.
and offset from stop marker. E.g. [500, -500] would mean 500ms
after the start marker until 500 ms before the stop marker.
name_to_stop_codes: dict (str -> int or list of int), optional
Dictionary mapping class names to stop marker code or stop marker codes.
Order does not matter, dictionary should contain each class in
Expand Down Expand Up @@ -71,8 +71,8 @@ def create_signal_target(data, events, fs, name_to_start_codes, epoch_ival_ms,
Epoching interval in milliseconds. In case only `name_to_codes` given,
represents start offset and stop offset from start markers. In case
`name_to_stop_codes` given, represents offset from start marker
and offset from stop marker. E.g. [500, -500] would mean 500ms
after the start marker until 500 ms before the stop marker.
and offset from stop marker. E.g. [500, -500] would mean 500ms
after the start marker until 500 ms before the stop marker.
name_to_stop_codes: dict (str -> int or list of int), optional
Dictionary mapping class names to stop marker code or stop marker codes.
Order does not matter, dictionary should contain each class in
Expand Down Expand Up @@ -217,7 +217,7 @@ def add_breaks(
Marker code that will be used for break start markers.
break_stop_code: int
Marker code that will be used for break stop markers.
name_to_start_codes: OrderedDict (str -> int or list of int)
name_to_start_codes: OrderedDict (str -> int or list of int)
Ordered dictionary mapping class names to start marker code or
start marker codes.
name_to_stop_codes: dict (str -> int or list of int), optional
Expand All @@ -229,7 +229,8 @@ def add_breaks(
Returns
-------
events: 2d-array
Events with break start and stop markers.
"""
min_samples = (None if min_break_length_ms is None
else ms_to_samples(min_break_length_ms, fs))
Expand Down
3 changes: 3 additions & 0 deletions braindecode/experiments/monitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def compute_preds_per_trial_for_set(all_preds, input_time_length,
dataset, ):
"""
Compute predictions per trial from predictions for crops.
Parameters
----------
all_preds: list of 2darrays (classes x time)
Expand All @@ -182,6 +183,7 @@ def compute_preds_per_trial_for_set(all_preds, input_time_length,
Temporal length of one input to the model.
dataset: :class:`.SignalAndTarget`
Dataset the crops were taken from.
Returns
-------
preds_per_trial: list of 2darrays (classes x time)
Expand All @@ -201,6 +203,7 @@ def compute_preds_per_trial_from_n_preds_per_trial(
all_preds, n_preds_per_trial):
"""
Compute predictions per trial from predictions for crops.
Parameters
----------
all_preds: list of 2darrays (classes x time)
Expand Down
1 change: 1 addition & 0 deletions braindecode/mne_ext/signalproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def concatenate_raws_with_events(raws):
def resample_cnt(cnt, new_fs):
"""
Resample continuous recording using `resampy`.
Parameters
----------
cnt: `mne.io.RawArray`
Expand Down
8 changes: 5 additions & 3 deletions braindecode/torch_ext/modules.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import torch


class Expression(torch.nn.Module):
"""Compute given expression on forward pass.
"""
Compute given expression on forward pass.
Parameters
----------
expression_fn: function
Should accept variable number of `torch.autograd.Variable`s to compute
its output.
Should accept variable number of objects of type
`torch.autograd.Variable` to compute its output.
"""
def __init__(self, expression_fn):
super(Expression, self).__init__()
Expand Down
10 changes: 7 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@
# 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',
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
#'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon',
'nbsphinx',
Expand Down Expand Up @@ -73,8 +74,11 @@ def find_source():
return "https://github.com/robintibor/braindecode/blob/master/%s" % filename

autosummary_generate = True #https://stackoverflow.com/a/21665947/1469195
autodoc_member_order = 'bysource'
## Default flags used by autodoc directives
autodoc_default_flags = ['members', 'show-inheritance']

exclude_patterns = ['_build', 'notebooks/.ipynb_checkpoints', '_templates']
exclude_patterns = ['_build', '_templates',]

napoleon_google_docstring = False
napoleon_use_param = False
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ API
===

.. autosummary::
:toctree: _autosummary
:toctree: source

braindecode.datautil
braindecode.experiments
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# http://packaging.python.org/en/latest/tutorial.html#version
version='0.1.4.09',
version='0.1.5', # TODO: read form __init__.py?

description='A deep learning toolbox to decode raw time-domain EEG.',
long_description=long_description,
Expand Down

0 comments on commit 6555ffc

Please sign in to comment.