Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT, DOC: some testing maintenance and doc updates #143

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ instance/
# Sphinx documentation
docs/_build/
docs/build/
docs/source/generated/auto_tutorials/

# PyBuilder
target/
Expand Down Expand Up @@ -131,6 +132,7 @@ dmypy.json

# Demo thing to let people not pollute repos
my_project_ll_config.yaml
project_ll_config_face13_egi.yaml

# VSCode ignore
.vscode
4 changes: 2 additions & 2 deletions docs/requirements_doc.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sphinx!=4.1.0,<6
pydata-sphinx-theme
sphinx>=6
shibuya
sphinx-design
sphinx-gallery
sphinxemoji
Expand Down
15 changes: 7 additions & 8 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,21 @@
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "pydata_sphinx_theme"
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 pylossless/tests/test_simulated.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def data_fun(times):
add_eog(raw_sim, random_state=rng)
raw_sim.pick("eeg")

# Save Info and Montage for later re-use
# Save Info and Montage for later reuse
montage = raw_sim.get_montage()
info = mne.create_info(
ch_names=raw_sim.ch_names,
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
Loading