From 3eccc1dde190b498b21783a76789304e56e3ab54 Mon Sep 17 00:00:00 2001 From: Sophie Herbst Date: Tue, 2 Apr 2024 16:02:37 +0200 Subject: [PATCH 1/2] enhance documentation of caching, continuation of #914 (#918) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Richard Höchenberger --- docs/source/v1.9.md.inc | 2 +- mne_bids_pipeline/_config.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/v1.9.md.inc b/docs/source/v1.9.md.inc index a8f897da5..b81a3d8c6 100644 --- a/docs/source/v1.9.md.inc +++ b/docs/source/v1.9.md.inc @@ -20,7 +20,7 @@ - We removed the `Execution` section from configuration options documentation and replaced it with new, more explicit sections (namely, Caching, Parallelization, - Logging, and Error handling). (#914 by @hoechenberger) + Logging, and Error handling), and enhanced documentation. (#914 by @hoechenberger, #916 by @SophieHerbst) ### :bug: Bug fixes diff --git a/mne_bids_pipeline/_config.py b/mne_bids_pipeline/_config.py index c4d382a3f..e285a0e9a 100644 --- a/mne_bids_pipeline/_config.py +++ b/mne_bids_pipeline/_config.py @@ -2174,8 +2174,12 @@ def noise_cov(bids_path): # %% # # Caching # -# These settings control if and how pipeline output is being cached to avoid unnecessary -# computations on a re-run. +# Per default, the pipeline output is cached (temporarily stored), +# to avoid unnecessary reruns of previously computed steps. +# Yet, for consistency, changes in configuration parameters trigger +# automatic reruns of previous steps. +# !!! info +# To force rerunning a given step, run the pipeline with the option: `--no-cache`. memory_location: PathLike | bool | None = True """ From 628877087730e8c7e6b3b9a30ff5b4d313e1a545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20H=C3=B6chenberger?= Date: Tue, 2 Apr 2024 18:14:50 +0200 Subject: [PATCH 2/2] Improve documentation and config validation of `loose` and `depth` parameters; drop support for `loose=None` (#915) Co-authored-by: Eric Larson --- docs/source/v1.9.md.inc | 7 +++---- mne_bids_pipeline/_config.py | 37 ++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/docs/source/v1.9.md.inc b/docs/source/v1.9.md.inc index b81a3d8c6..6ac23551a 100644 --- a/docs/source/v1.9.md.inc +++ b/docs/source/v1.9.md.inc @@ -6,16 +6,15 @@ - The type annotations in the default configuration file are now easier to read: We replaced `Union[X, Y]` with `X | Y` and `Optional[X]` with `X | None`. (#908, #911 by @hoechenberger) -[//]: # (### :warning: Behavior changes) +### :warning: Behavior changes -[//]: # (- Whatever (#000 by @whoever)) +- The [`depth`][mne_bids_pipeline._config.depth] parameter doesn't accept `None` + anymore. Please use `0` instead. (#915 by @hoechenberger) ### :package: Requirements - We dropped support for Python 3.9. You now need Python 3.10 or newer. (#908 by @hoechenberger) -[//]: # (- Whatever (#000 by @whoever)) - ### :book: Documentation - We removed the `Execution` section from configuration options documentation and diff --git a/mne_bids_pipeline/_config.py b/mne_bids_pipeline/_config.py index e285a0e9a..b28c096dd 100644 --- a/mne_bids_pipeline/_config.py +++ b/mne_bids_pipeline/_config.py @@ -1979,24 +1979,33 @@ def mri_landmarks_kind(bids_path): # ## Inverse solution -loose: float | Literal["auto"] = 0.2 +loose: Annotated[float, Interval(ge=0, le=1)] | Literal["auto"] = 0.2 """ -Value that weights the source variances of the dipole components -that are parallel (tangential) to the cortical surface. If `0`, then the -inverse solution is computed with **fixed orientation.** -If `1`, it corresponds to **free orientation.** -The default value, `'auto'`, is set to `0.2` for surface-oriented source -spaces, and to `1.0` for volumetric, discrete, or mixed source spaces, -unless `fixed is True` in which case the value 0. is used. +A value between 0 and 1 that weights the source variances of the dipole components +that are parallel (tangential) to the cortical surface. + +If `0`, then the inverse solution is computed with **fixed orientation**, i.e., +only dipole components perpendicular to the cortical surface are considered. + +If `1`, it corresponds to **free orientation**, i.e., dipole components with any +orientation are considered. + +The default value, `0.2`, is suitable for surface-oriented source spaces. + +For volume or mixed source spaces, choose `1.0`. + +!!! info + Support for modeling volume and mixed source spaces will be added in a future + version of MNE-BIDS-Pipeline. """ -depth: float | dict | None = 0.8 +depth: Annotated[float, Interval(ge=0, le=1)] | dict = 0.8 """ -If float (default 0.8), it acts as the depth weighting exponent (`exp`) -to use (must be between 0 and 1). None is equivalent to 0, meaning no -depth weighting is performed. Can also be a `dict` containing additional -keyword arguments to pass to :func:`mne.forward.compute_depth_prior` -(see docstring for details and defaults). +If a number, it acts as the depth weighting exponent to use +(must be between `0` and`1`), with`0` meaning no depth weighting is performed. + +Can also be a dictionary containing additional keyword arguments to pass to +`mne.forward.compute_depth_prior` (see docstring for details and defaults). """ inverse_method: Literal["MNE", "dSPM", "sLORETA", "eLORETA"] = "dSPM"