pre merge cleanup

This commit is contained in:
Thomas Ales
2026-08-06 21:20:35 -05:00
parent 8154c57066
commit 1a8187138f
6 changed files with 294 additions and 55 deletions
+11 -4
View File
@@ -189,7 +189,10 @@ class BatchCacheWorker(QObject):
*mode* is ``"dc"`` (CH3/CH4 mean images) or ``"fft"`` (CH1 peak-frequency
images, unmasked — masking is applied at display time, same as v5's PREC
convention).
convention). FFT images are computed and stored at *pad_factor*, the
viewer's own zero-padding setting: a stored image only serves a view
asking for the same padding, so caching at any other one produces a file
the viewer will never read back.
Files are processed one per subprocess: they are fully independent, each
opens its own memmap and writes only its own bytes, and only path strings
@@ -201,11 +204,13 @@ class BatchCacheWorker(QObject):
file_done = pyqtSignal(str, str)
finished = pyqtSignal()
def __init__(self, paths: list[str], mode: str, apply_bg_sub: bool):
def __init__(self, paths: list[str], mode: str, apply_bg_sub: bool,
pad_factor: int = 1):
super().__init__()
self._paths = paths
self._mode = mode
self._apply_bg_sub = apply_bg_sub
self._pad_factor = pad_factor
def _report(self, path: str, err: str, done: int, total: int):
self.file_done.emit(path, err)
@@ -230,7 +235,8 @@ class BatchCacheWorker(QObject):
with ProcessPoolExecutor(max_workers=n_procs) as executor:
futures = {
executor.submit(cache_file, p, self._mode, self._apply_bg_sub,
compute.get_fft_backend(), per_proc_workers): p
compute.get_fft_backend(), per_proc_workers,
self._pad_factor): p
for p in paths
}
for fut in as_completed(futures):
@@ -254,7 +260,8 @@ class BatchCacheWorker(QObject):
try:
err = cache_file(path, self._mode, self._apply_bg_sub,
compute.get_fft_backend(),
compute.default_max_workers())
compute.default_max_workers(),
self._pad_factor)
except Exception as exc:
err = str(exc)
done += 1