Skip to content

Commit

Permalink
FIX: fix flakes and doc errors
Browse files Browse the repository at this point in the history
  • Loading branch information
scott-huberty committed Oct 26, 2023
1 parent 8119eb7 commit 0721378
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 16 deletions.
13 changes: 6 additions & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,19 @@

html_theme = "shibuya"
html_static_path = ["_static"]
html_theme_options = {
"logo": {
"image_light": "logo-lightmode_color.png",
"image_dark": "logo_white.png",
}
}
# TODO: add a svg file for the logo
# html_theme_options = {
# "light_logo": "logo-lightmode_color.png",
# "dark_logo": "logo_white.png",
# }

# user made CSS to customize look
html_css_files = [
"css/custom.css",
]

# Custom sidebar templates, maps document names to template names.
html_sidebars = {"index": ["search-field.html", "sidebar-nav-bs", "globaltoc.html"]}
# html_sidebars = {"index": ["search-field.html", "sidebar-nav-bs", "globaltoc.html"]}

# NumPyDoc configuration -----------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Building and Contributing to the Docs
pyLossless uses `Sphinx <https://www.sphinx-doc.org/en/master/>`__ for building
documentation. Specifically, we use the `PyData-sphinx-theme
<https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html>`__ as a
design template for our page. We also use the `Napolean
<https://sphinxcontrib-napoleon.readthedocs.io/en/latest/index.html>`__
design template for our page. We also use the `Numpydoc
<https://numpydoc.readthedocs.io/en/latest/index.html>`__
and
`autodoc <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`__
sphinx extensions to build API documentation directly from the pyLossless
Expand Down
2 changes: 1 addition & 1 deletion docs/source/implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Step 13: Run final ICA
----------------------

A final ICA will be run, excluding the epochs that were identified to contain
large deviations across ICs. These time periods are exlcuded to improve the
large deviations across ICs. These time periods are excluded to improve the
final ICA's decomposition.

MNE-ICAlabel will be run on this decomposition to classify the ICs as brain,
Expand Down
7 changes: 4 additions & 3 deletions pylossless/flagging.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class FlaggedChs(dict):
Attributes
----------
ll : LosslessPipeline
the LosslessPipeline object that is flagging artifactual channels.
the :class:`~pylossless.pipeline.LosslessPipeline` object that is flagging
artifactual channels.
Methods
-------
Expand Down Expand Up @@ -86,10 +87,10 @@ def rereference(self, inst, **kwargs):
Parameters
----------
inst : mne.io.Raw
An instance of :class:`mne.io.Raw` that contains EEG channels.
An instance of :class:`~mne.io.Raw` that contains EEG channels.
kwargs : dict
dictionary of valid keyword arguments for the
:meth:`mne.io.Raw.set_eeg_reference` method.
:meth:`~mne.io.Raw.set_eeg_reference` method.
"""
# Concatenate and remove duplicates
bad_chs = list(
Expand Down
34 changes: 32 additions & 2 deletions pylossless/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,37 @@ def warp_locs(self, raw):


class LosslessPipeline:
"""Class used to handle pipeline parameters."""
"""Class used to handle pipeline parameters.
Parameters
----------
config_fname : pathlib.Path
path to config file specifying the parameters to be used
in the pipeline.
Attributes
----------
flags : dict
A dictionary of detailing the flagged channels, epochs, and ICs.
keys are ``'ch'``, ``'epoch'``, and ``'ic'``, and values are instances of
:class:`~pylossless.flagging.FlaggedChs`,
:class:`~pylossless.flagging.FlaggedEpochs`, and
:class:`~pylossless.flagging.FlaggedICs`, respectively.
config_fname : pathlib.Path
path to the config file specifying the parameters to be used in the
in the pipeline.
config : dict
A dictionary containing the pipeline parameters.
raw : mne.Raw
An instance of :class:`~mne.io.Raw` containing that will
be processed by the pipeline.
ica1 : mne.preprocessing.ICA
An instance of :class:`~mne.preprocessing.ICA`. The result of the initial ICA
run during the pipeline.
ica2 : mne.preprocessing.ICA
An instance of :class:`~mne.preprocessing.ICA`. The result of the final ICA run
during the pipeline.
"""

def __init__(self, config_fname=None):
"""Initialize class.
Expand Down Expand Up @@ -695,7 +725,7 @@ def _flag_volt_std(self, flag_dim, threshold=5e-5):

def find_outlier_chs(self, inst):
"""Detect outlier Channels to leave out of rereference."""
# TODO: Re-use _detect_outliers here.
# TODO: Reuse _detect_outliers here.
logger.info("🔍 Detecting channels to leave out of reference.")
if isinstance(inst, mne.Epochs):
epochs = inst
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.codespell]
skip = "docs/source/generated"
skip = "docs/source/generated,pylossless/assets"

[tool.ruff]
select = ["E", "F", "W", "D"] # pycodestle, pyflakes, Warning, Docstring
Expand Down

0 comments on commit 0721378

Please sign in to comment.