diff --git a/doc/changes/dev/13593.other.rst b/doc/changes/dev/13593.other.rst new file mode 100644 index 00000000000..fe9694f2c92 --- /dev/null +++ b/doc/changes/dev/13593.other.rst @@ -0,0 +1 @@ +make :func:`mne.sys_info` work on Windows systems with Powershell version 7+, by `Marijn van Vliet`_ diff --git a/mne/io/egi/events.py b/mne/io/egi/events.py index 9c853dd73eb..c160ceb208c 100644 --- a/mne/io/egi/events.py +++ b/mne/io/egi/events.py @@ -68,7 +68,7 @@ def _read_mff_events(filename, sfreq): marker = { "name": event["code"], "start": start, - "start_sample": int(np.fix(start * sfreq)), + "start_sample": int(np.trunc(start * sfreq)), "end": start + float(event["duration"]) / 1e9, "chan": None, } diff --git a/mne/preprocessing/infomax_.py b/mne/preprocessing/infomax_.py index b445ac7116c..8880a0f280f 100644 --- a/mne/preprocessing/infomax_.py +++ b/mne/preprocessing/infomax_.py @@ -247,7 +247,7 @@ def infomax( oldsigns = signs if signcount >= signcount_threshold: - ext_blocks = np.fix(ext_blocks * signcount_step) + ext_blocks = np.trunc(ext_blocks * signcount_step) signcount = 0 # here we continue after the for loop over the ICA training blocks diff --git a/mne/utils/config.py b/mne/utils/config.py index 9d5cf9f3c40..4bc90072401 100644 --- a/mne/utils/config.py +++ b/mne/utils/config.py @@ -681,11 +681,9 @@ def _get_gpu_info(): def _get_total_memory(): """Return the total memory of the system in bytes.""" if platform.system() == "Windows": + ps = shutil.which("pwsh") or shutil.which("powershell") o = subprocess.check_output( - [ - "powershell.exe", - "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory", - ] + [ps, "-c", "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory"] ).decode() # Can get for example a "running scripts is disabled on this system" # error where "o" will be a long string rather than an int @@ -708,8 +706,9 @@ def _get_total_memory(): def _get_cpu_brand(): """Return the CPU brand string.""" if platform.system() == "Windows": + ps = shutil.which("pwsh") or shutil.which("powershell") o = subprocess.check_output( - ["powershell.exe", "(Get-CimInstance Win32_Processor).Name"] + [ps, "-c", "(Get-CimInstance Win32_Processor).Name"] ).decode() cpu_brand = o.strip().splitlines()[-1] elif platform.system() == "Linux": diff --git a/mne/viz/utils.py b/mne/viz/utils.py index 9c71714040a..5f624730b8d 100644 --- a/mne/viz/utils.py +++ b/mne/viz/utils.py @@ -1926,7 +1926,7 @@ def _setup_ax_spines( def log_fix(tval): exp = np.log10(np.abs(tval)) - return np.sign(tval) * 10 ** (np.fix(exp) - (exp < 0)) + return np.sign(tval) * 10 ** (np.trunc(exp) - (exp < 0)) xlims = np.array([xmin, xmax]) temp_ticks = log_fix(xlims)