diff --git a/changelog.md b/changelog.md
index 12d8cef..53705eb 100644
--- a/changelog.md
+++ b/changelog.md
@@ -5,7 +5,7 @@
- Optimized calculations being performed when calculating the Heart Rate to speed up step 5 by up to ~35% on a per-file basis
- Optimized calculations being performed when running the General Linear Model to speed up step 5 by up to ~35% on a per-file basis
- The Group Stats Viewer windows will now properly load the Right/Left or Front/Back fallback ROIs if JSON_LOCATION is not set
-- Changed the warning message for lots of short channels to be percentage based (25%) instead of numerical based (6)
+- Changed the warning message for lots of short channels and changed when it shows to be percentage based (35%) instead of numerical based (6)
- Renames GENDER to SEX to better represent the values that the field expects and to be more BIDS compliant
- Changed the Assign Groups by AGE window to now be the Assign Groups by Metadata window and added support for grouping by other metadata values
- Added a new metadata value of HAND to allow for grouping participants based on their handiness
@@ -24,8 +24,10 @@
- Fixed an issue where when loading a save file some list dropdowns could go blue and bold even if the value was default
- Fixed an issue where the Analysis button would not be clickable if the user had previously pushed Clear. Fixes [Issue 83](https://git.research.dezeeuw.ca/tyler/flares/issues/83)
- Fixed an issue where some popup windows would not properly display the application name when they would open
-- Fixed instances of the word MacOS to now read macOS to match Apple branding
-- Fixed welcom dialog application image not displaying correctly on macOS
+- Fixed an issue where the welcome dialog image would not display correctly on macOS
+- Fixed an issue where the Linux version would fail at 0 seconds when attempting to process files
+- Fixed an issue where fOLDing channels could cause the same channels to be repeated misaligning the labels
+- Fixed all instances of the word MacOS to now read macOS to match Apple branding
# Version 1.5.2
diff --git a/flares.py b/flares.py
index e902141..0baf805 100644
--- a/flares.py
+++ b/flares.py
@@ -1840,7 +1840,8 @@ def fold_channels(raw: BaseRaw, p_name: str, atlas: str='Brodmann', progress_que
channel_results = {}
step_idx = 0
- for cidx, channel_name in enumerate(hbo_channel_names):
+ for channel_name in hbo_channel_names:
+ cidx = raw.ch_names.index(channel_name)
tbl = _source_detector_fold_table(
raw, cidx, reference_locations, fold_tbl, interpolate=True
)
@@ -2179,8 +2180,14 @@ def brain_3d_visualization(
-def brain_landmarks_3d(raw_haemo: BaseRaw, show_optodes: Literal['sensors', 'labels', 'none', 'all'] = 'all', show_brodmann: bool = True) -> None:
+def brain_landmarks_3d(raw_haemo: BaseRaw, show_optodes: Literal['sensors', 'labels', 'none', 'all'] = 'all', show_brodmann: bool = True, subjects_dir = None) -> None:
+ if subjects_dir is None:
+ subjects_dir = os.environ.get("SUBJECTS_DIR")
+ if subjects_dir is None:
+ subjects_dir = str(data_path()) + "/subjects" # type: ignore
+ os.environ["SUBJECTS_DIR"] = subjects_dir
+
brain = Brain("fsaverage", background="white", size=(800, 700)) # type: ignore
distances = source_detector_distances(raw_haemo.info)
diff --git a/main.py b/main.py
index d0a8701..f187b3d 100644
--- a/main.py
+++ b/main.py
@@ -19,7 +19,7 @@ from queue import Empty
from copy import deepcopy
from pathlib import Path
from datetime import datetime
-from multiprocessing import Process, current_process, freeze_support, Queue
+from multiprocessing import Process, current_process, freeze_support, Queue, set_start_method
# External library imports
import psutil
@@ -2038,7 +2038,7 @@ class MainApplication(QMainWindow):
msgbox.setWindowTitle(f"Warning - {APP_NAME.upper()}")
message = (
- f"{APP_NAME.upper} has encountered an error processing the file {title}.
"
+ f"{APP_NAME.upper()} has encountered an error processing the file {title}.
"
"This error was likely due to incorrect parameters on the right side of the screen and not an error with your data. "
"Processing of the remaining files continues in the background and this participant will be ignored in the analysis. "
f"If you think the parameters on the right side are correct for your data, raise an issue here.
"
@@ -2449,8 +2449,9 @@ def exception_hook(exc_type, exc_value, exc_traceback):
show_critical_error(error_msg)
# Exit the app after user acknowledges
- sys.exit(1)
-
+ if getattr(sys, 'frozen', False):
+ sys.exit(1)
+
def show_critical_error(error_msg):
msg_box = QMessageBox()
@@ -2459,22 +2460,25 @@ def show_critical_error(error_msg):
if PLATFORM_NAME == "darwin":
log_path = os.path.join(os.path.dirname(sys.executable), "../../../flares.log")
- log_path2 = os.path.join(os.path.dirname(sys.executable), "../../../flares_error.log")
+ error_path = os.path.join(os.path.dirname(sys.executable), "../../../flares_error.log")
save_path = os.path.join(os.path.dirname(sys.executable), "../../../flares_autosave.flare")
else:
log_path = os.path.join(os.getcwd(), "flares.log")
- log_path2 = os.path.join(os.getcwd(), "flares_error.log")
+ error_path = os.path.join(os.getcwd(), "flares_error.log")
save_path = os.path.join(os.getcwd(), "flares_autosave.flare")
- shutil.copy(log_path, log_path2)
- log_path2 = Path(log_path2).absolute().as_posix()
+ shutil.copy(log_path, error_path)
+ error_path = Path(error_path).absolute().as_posix()
autosave_path = Path(save_path).absolute().as_posix()
- log_link = f"file:///{log_path2}"
+ error_link = f"file:///{error_path}"
autosave_link = f"file:///{autosave_path}"
-
- window.save_project(True) #TODO: If the window is the one to crash, the file can't get saved. Could be fine as the window is what was storing the data to begin with?
+
+ try:
+ window.project_manager.save_project(True)
+ except:
+ pass
message = (
f"{APP_NAME.upper()} has encountered an unrecoverable error and needs to close.
"
@@ -2482,7 +2486,7 @@ def show_critical_error(error_msg):
"If the file was saved, it still may not be intact, openable, or contain the correct data. Use the autosave at your own discretion.
"
f"This unrecoverable error was due to an error with {APP_NAME.upper()} and not your data.
"
f"If this crash occured inside a [BETA] branch, it is likely to eventually be fixed.
"
- f"Please raise an issue here and attach the error file located at {log_path2}
"
+ f"Please raise an issue here and attach the error file located at {error_path}
"
f"
{error_msg}"
)
@@ -2583,6 +2587,7 @@ if __name__ == "__main__":
config_init()
freeze_support() # Required for PyInstaller + multiprocessing
+ set_start_method('spawn', force=True)
# Only run GUI in the main process
if current_process().name == 'MainProcess':
diff --git a/project_manager.py b/project_manager.py
index 8d71a44..cdfb134 100644
--- a/project_manager.py
+++ b/project_manager.py
@@ -776,8 +776,8 @@ def extract_metadata_worker(file_name):
snirf_info['Short Channels'] = f"Likely - {names}"
total_chans = len(raw.ch_names)
pct_short = (len(names) / total_chans * 100) if total_chans else 0
- if pct_short > 25:
- snirf_info['Short Channels'] += "\n There are a lot of short channels. Optode distances are likely incorrect!"
+ if pct_short > 35:
+ snirf_info['Short Channels'] += "\n There are a lot of short channels. Perhaps the optode distances are incorrect?"
except:
snirf_info['Short Channels'] = "Unlikely"
diff --git a/src/analysis/intergroupbrainimage.py b/src/analysis/intergroupbrainimage.py
index 10e94b5..8d447e7 100644
--- a/src/analysis/intergroupbrainimage.py
+++ b/src/analysis/intergroupbrainimage.py
@@ -99,7 +99,7 @@ class InterGroupBrainImageWidget(InterGroupUIMixin, FlaresBaseWidget):
self.df_ind_dict = df_ind_dict
self.design_matrix_dict = design_matrix_dict
self.contrast_results_dict = contrast_results_dict
- # self.group_dict = group_dict
+ self.group_dict = group_dict
self.setup_inter_group_ui(["0 (GLM Results)", "1 (Significance)", "2 (Brain Activity Visualization)",])
diff --git a/src/shared/flaresbasewidget.py b/src/shared/flaresbasewidget.py
index c9d8b4c..a455954 100644
--- a/src/shared/flaresbasewidget.py
+++ b/src/shared/flaresbasewidget.py
@@ -50,7 +50,7 @@ class ClickableLabel(QLabel):
def mousePressEvent(self, event):
viewer = QWidget()
- viewer.setWindowTitle(f"Expanded View" - {APP_NAME.upper()})
+ viewer.setWindowTitle(f"Expanded View - {APP_NAME.upper()}")
layout = QVBoxLayout(viewer)
label = QLabel()
label.setPixmap(self._pixmap_full)