preferences

This commit is contained in:
2026-01-30 15:38:12 -08:00
parent 92973da658
commit 98c749477c
2 changed files with 24 additions and 10 deletions

View File

@@ -19,6 +19,9 @@
- Fixed an issue where the dropdowns in the Viewer windows would immediately open and close when using a trackpad - Fixed an issue where the dropdowns in the Viewer windows would immediately open and close when using a trackpad
- glover and spm hrf models now function as intended without crashing. Currently, group analysis is still only supported by fir - glover and spm hrf models now function as intended without crashing. Currently, group analysis is still only supported by fir
- Revamped the fold channels viewer to not hang the application and to better process multiple participants at once - Revamped the fold channels viewer to not hang the application and to better process multiple participants at once
- Added a Preferences menu to the navigation bar
- Currently, there is only one preference allowing to bypass the warning of 2D data
- Fixed [Issue 8](https://git.research.dezeeuw.ca/tyler/flares/issues/8), [Issue 9](https://git.research.dezeeuw.ca/tyler/flares/issues/9), [Issue 30](https://git.research.dezeeuw.ca/tyler/flares/issues/30), [Issue 31](https://git.research.dezeeuw.ca/tyler/flares/issues/31), [Issue 34](https://git.research.dezeeuw.ca/tyler/flares/issues/34), [Issue 36](https://git.research.dezeeuw.ca/tyler/flares/issues/36)
# Version 1.1.7 # Version 1.1.7

31
main.py
View File

@@ -188,11 +188,11 @@ SECTIONS = [
{"name": "RESAMPLE_FREQ", "default": 1, "type": int, "help": "The frequency the data should be resampled to."}, {"name": "RESAMPLE_FREQ", "default": 1, "type": int, "help": "The frequency the data should be resampled to."},
{"name": "HRF_MODEL", "default": ["fir"], "type": list, "options": ["fir", "glover", "spm", "spm + derivative", "spm + derivative + dispersion", "glover + derivative", "glover + derivative + dispersion"], "exclusive": True, "help": "Specifies the hemodynamic response function."}, {"name": "HRF_MODEL", "default": ["fir"], "type": list, "options": ["fir", "glover", "spm", "spm + derivative", "spm + derivative + dispersion", "glover + derivative", "glover + derivative + dispersion"], "exclusive": True, "help": "Specifies the hemodynamic response function."},
{"name": "STIM_DUR", "default": 0.5, "type": float, "help": "The length of your stimulus."}, {"name": "STIM_DUR", "default": 0.5, "type": float, "help": "The length of your stimulus. If your HRF_MODEL is fir, this dictates how wide a bin should be."},
{"name": "DRIFT_MODEL", "default": "cosine", "type": str, "help": "Specifies the desired drift model."}, {"name": "DRIFT_MODEL", "default": ["cosine"], "type": list, "options": ["cosine", "polynomial"], "help": "Specifies the desired drift model."},
{"name": "HIGH_PASS", "default": 0.01, "type": float, "help": "High-pass frequency in case of a cosine model (in Hz)."}, {"name": "HIGH_PASS", "default": 0.01, "type": float, "help": "High-pass frequency in case of a cosine model (in Hz)."},
{"name": "DRIFT_ORDER", "default": 1, "type": int, "help": "Order of the drift model (in case it is polynomial)"}, {"name": "DRIFT_ORDER", "default": 1, "type": int, "help": "Order of the drift model (in case it is polynomial)"},
{"name": "FIR_DELAYS", "default": "None", "type": range, "help": "In case of FIR design, yields the array of delays used in the FIR model (in scans)."}, {"name": "FIR_DELAYS", "default": "None", "type": range, "depends_on": "HRF_MODEL", "depends_value": "fir", "help": "In case of FIR design, yields the array of delays used in the FIR model (in scans)."},
{"name": "MIN_ONSET", "default": -24, "type": int, "help": "Minimal onset relative to frame times (in seconds)"}, {"name": "MIN_ONSET", "default": -24, "type": int, "help": "Minimal onset relative to frame times (in seconds)"},
{"name": "OVERSAMPLING", "default": 50, "type": int, "help": "Oversampling factor used in temporal convolutions."}, {"name": "OVERSAMPLING", "default": 50, "type": int, "help": "Oversampling factor used in temporal convolutions."},
{"name": "REMOVE_EVENTS", "default": "None", "type": list, "help": "Remove events matching the names provided before generating the Design Matrix"}, {"name": "REMOVE_EVENTS", "default": "None", "type": list, "help": "Remove events matching the names provided before generating the Design Matrix"},
@@ -4342,6 +4342,7 @@ class MainApplication(QMainWindow):
self.folder_paths = [] self.folder_paths = []
self.section_widget = None self.section_widget = None
self.first_run = True self.first_run = True
self.is_2d_bypass = False
self.files_total = 0 # total number of files to process self.files_total = 0 # total number of files to process
self.files_done = set() # set of file paths done (success or fail) self.files_done = set() # set of file paths done (success or fail)
@@ -4590,6 +4591,13 @@ class MainApplication(QMainWindow):
if i == 1 or i == 3: # after the first 2 actions (0,1) if i == 1 or i == 3: # after the first 2 actions (0,1)
options_menu.addSeparator() options_menu.addSeparator()
preferences_menu = menu_bar.addMenu("Preferences")
preferences_actions = [
("2D Data Bypass", "Ctrl+B", self.is_2d_bypass_func, resource_path("icons/info_24dp_1F1F1F.svg"))
]
for name, shortcut, slot, icon in preferences_actions:
preferences_menu.addAction(make_action(name, shortcut, slot, icon=icon, checkable=True, checked=False))
terminal_menu = menu_bar.addMenu("Terminal") terminal_menu = menu_bar.addMenu("Terminal")
terminal_actions = [ terminal_actions = [
("New Terminal", "Ctrl+Alt+T", self.terminal_gui, resource_path("icons/terminal_24dp_1F1F1F.svg")), ("New Terminal", "Ctrl+Alt+T", self.terminal_gui, resource_path("icons/terminal_24dp_1F1F1F.svg")),
@@ -4670,6 +4678,8 @@ class MainApplication(QMainWindow):
self.top_left_widget.paste() # Trigger paste self.top_left_widget.paste() # Trigger paste
self.statusbar.showMessage("Pasted from clipboard") # Show status message self.statusbar.showMessage("Pasted from clipboard") # Show status message
def is_2d_bypass_func(self, checked):
self.is_2d_bypass = checked
def about_window(self): def about_window(self):
if self.about is None or not self.about.isVisible(): if self.about is None or not self.about.isVisible():
@@ -5290,13 +5300,14 @@ class MainApplication(QMainWindow):
) )
if is_2d: if is_2d:
QMessageBox.critical(None, "Error - 2D Data Detected - FLARES", f"Error: 2 dimensional data was found in {i}. " if self.is_2d_bypass == False:
"It is not possible to process this file. Please update the coordinates " QMessageBox.critical(None, "Error - 2D Data Detected - FLARES", f"Error: 2 dimensional data was found in {i}. "
"using the 'Update optodes in snirf file...' option from the Options menu or by pressing 'F6'.") "Please update the coordinates using the 'Update optodes in snirf file...' option from the Options menu or by pressing 'F6'. "
self.button1.clicked.disconnect(self.cancel_task) "You may also select the '2D Data Bypass' option from the Preferences menu to ignore this warning and process anyway. ")
self.button1.setText("Process") self.button1.clicked.disconnect(self.cancel_task)
self.button1.clicked.connect(self.on_run_task) self.button1.setText("Process")
return self.button1.clicked.connect(self.on_run_task)
return
self.files_total = len(snirf_files) self.files_total = len(snirf_files)
self.files_done = set() self.files_done = set()