changes and improvements

This commit is contained in:
2026-01-29 17:23:52 -08:00
parent 7007478c3b
commit f82978e2e8
4 changed files with 371 additions and 149 deletions

26
fold.py Normal file
View File

@@ -0,0 +1,26 @@
# workers.py
import flares
# This function must be completely standalone.
# No PyQt imports here!
def run_fold_process(haemo_obj, label, shared_dict):
"""
Runs in a separate OS process.
Writes progress to shared_dict so the GUI can see it.
"""
try:
def progress_callback(value):
# Only update shared memory if the value has changed
# This significantly reduces "noise" on the GUI thread
if shared_dict.get(label) != value:
shared_dict[label] = value
# Run the heavy calculation
# Ensure 'flares' logic does not try to open any plots/GUIs itself!
figures = flares.fold_channels(haemo_obj, progress_callback=progress_callback)
except Exception as e:
# If something breaks here, we return the error string
# so the main thread knows what happened.
return f"ERROR: {str(e)}"