Skip to content

Commit 3941a38

Browse files
authored
Merge branch 'main' into sensitivity_map_doc_imp
2 parents c4749e0 + f337a0d commit 3941a38

File tree

9 files changed

+59
-9
lines changed

9 files changed

+59
-9
lines changed

doc/changes/dev/13591.other.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Documentation improvement for eSSS in docstring :func:`mne.preprocessing.maxwell_filter` and in the MaxFilter example by `Simon Kern`_.

doc/changes/dev/13593.other.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make :func:`mne.sys_info` work on Windows systems with Powershell version 7+, by `Marijn van Vliet`_

doc/references.bib

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,17 @@ @book{Heiman2002
813813
year = {2002}
814814
}
815815

816+
@ARTICLE{HelleEtAl2021,
817+
author={Helle, Liisa and Nenonen, Jukka and Larson, Eric and Simola, Juha and Parkkonen, Lauri and Taulu, Samu},
818+
journal={IEEE Transactions on Biomedical Engineering},
819+
title={Extended Signal-Space Separation Method for Improved Interference Suppression in MEG},
820+
year={2021},
821+
volume={68},
822+
number={7},
823+
pages={2211-2221},
824+
doi={10.1109/TBME.2020.3040373}
825+
}
826+
816827
@article{HippEtAl2011,
817828
author = {Hipp, Joerg F. and Engel, Andreas K. and Siegel, Markus},
818829
doi = {10.1016/j.neuron.2010.12.027},

mne/io/egi/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _read_mff_events(filename, sfreq):
6868
marker = {
6969
"name": event["code"],
7070
"start": start,
71-
"start_sample": int(np.fix(start * sfreq)),
71+
"start_sample": int(np.trunc(start * sfreq)),
7272
"end": start + float(event["duration"]) / 1e9,
7373
"chan": None,
7474
}

mne/preprocessing/infomax_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def infomax(
247247
oldsigns = signs
248248

249249
if signcount >= signcount_threshold:
250-
ext_blocks = np.fix(ext_blocks * signcount_step)
250+
ext_blocks = np.trunc(ext_blocks * signcount_step)
251251
signcount = 0
252252

253253
# here we continue after the for loop over the ICA training blocks

mne/utils/config.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,9 @@ def _get_gpu_info():
681681
def _get_total_memory():
682682
"""Return the total memory of the system in bytes."""
683683
if platform.system() == "Windows":
684+
ps = shutil.which("pwsh") or shutil.which("powershell")
684685
o = subprocess.check_output(
685-
[
686-
"powershell.exe",
687-
"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory",
688-
]
686+
[ps, "-c", "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory"]
689687
).decode()
690688
# Can get for example a "running scripts is disabled on this system"
691689
# error where "o" will be a long string rather than an int
@@ -708,8 +706,9 @@ def _get_total_memory():
708706
def _get_cpu_brand():
709707
"""Return the CPU brand string."""
710708
if platform.system() == "Windows":
709+
ps = shutil.which("pwsh") or shutil.which("powershell")
711710
o = subprocess.check_output(
712-
["powershell.exe", "(Get-CimInstance Win32_Processor).Name"]
711+
[ps, "-c", "(Get-CimInstance Win32_Processor).Name"]
713712
).decode()
714713
cpu_brand = o.strip().splitlines()[-1]
715714
elif platform.system() == "Linux":

mne/utils/docs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,14 @@ def _reflow_param_docstring(docstring, has_first_line=True, width=75):
15591559
docdict["extended_proj_maxwell"] = """
15601560
extended_proj : list
15611561
The empty-room projection vectors used to extend the external
1562-
SSS basis (i.e., use eSSS).
1562+
SSS basis (i.e., use eSSS). You can use any SSP projections that contain
1563+
pure *external* noise that you expect to be present in your signal.
1564+
Typically, this should be the case during an empty room recording. Get the
1565+
projections e.g. by calling::
1566+
1567+
proj = mne.compute_proj_raw(
1568+
raw_empty_room.pick('meg'), n_grad=3, n_mag=3, meg="combined"
1569+
)
15631570
15641571
.. versionadded:: 0.21
15651572
"""

mne/viz/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,7 @@ def _setup_ax_spines(
19261926

19271927
def log_fix(tval):
19281928
exp = np.log10(np.abs(tval))
1929-
return np.sign(tval) * 10 ** (np.fix(exp) - (exp < 0))
1929+
return np.sign(tval) * 10 ** (np.trunc(exp) - (exp < 0))
19301930

19311931
xlims = np.array([xmin, xmax])
19321932
temp_ticks = log_fix(xlims)

tutorials/preprocessing/60_maxwell_filtering_sss.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,36 @@
307307
# :func:`~mne.preprocessing.maxwell_filter` for details.
308308
#
309309
#
310+
# Extended SSS (eSSS)
311+
# ^^^^^^^^^^^^^^^^^^^
312+
#
313+
# Extended SSS (eSSS) is a variant of SSS that improves suppression of external
314+
# interference especially, when the “ideal” external model is not perfect
315+
# (e.g., because of small calibration/geometry errors). It does this by
316+
# extending the *external* part of the SSS model with interference patterns
317+
# learned from a separate empty-room recording :footcite:`HelleEtAl2021`.
318+
#
319+
# Practical notes:
320+
#
321+
# - Keep the number of added components small (the ~8 in the original paper);
322+
# adding too many can worsen numerical conditioning and increase noise.
323+
# - Prefer empty-room data from the same session/environment.
324+
# - eSSS can be combined with tSSS (“teSSS”, i.e. setting ``st_duration=X``).
325+
# - You can get projections from an empty room recording via
326+
# :func:`mne.compute_proj_raw` like::
327+
#
328+
# proj = mne.compute_proj_raw(
329+
# noise_raw, n_grad=3, n_mag=3, n_eeg=0, meg="combined",
330+
# )
331+
#
332+
# You can enable eSSS by setting ``extended_proj=proj`` in
333+
# :func:`~mne.preprocessing.maxwell_filter`.
334+
#
335+
# An external example using spatiotemporal extended SSS (teSSS) with movement
336+
# compensation can be found at
337+
# `github.com/ilabsbrainteam/2022-Best-Practices-Infant-MEG`_.
338+
#
339+
#
310340
# Movement compensation
311341
# ^^^^^^^^^^^^^^^^^^^^^
312342
#
@@ -379,3 +409,4 @@
379409
# .. LINKS
380410
#
381411
# .. _spherical harmonics: https://en.wikipedia.org/wiki/Spherical_harmonics
412+
# .. _github.com/ilabsbrainteam/2022-Best-Practices-Infant-MEG: https://github.com/ilabsbrainteam/2022-Best-Practices-Infant-MEG/blob/c62019b4d37a20f0c82420b73595ea241b892a17/pipeline.py#L119-L147

0 commit comments

Comments
 (0)