Skip to content

Use FilesToProcess instead of raw glob in holo.Initial#391

Open
animmosmith wants to merge 3 commits into
mainfrom
388-holo-globbing
Open

Use FilesToProcess instead of raw glob in holo.Initial#391
animmosmith wants to merge 3 commits into
mainfrom
388-holo-globbing

Conversation

@animmosmith

@animmosmith animmosmith commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • holo.Initial.__call__ used to glob the raw files just to peek at one for its dimensions before any real image was loaded, purely to build kern/im_stack upfront. This had a real bug: it bypassed pyopia.pipeline.FilesToProcess, which is what supports pointing raw_files at an explicit .txt filelist — pointing at one would make Initial try to load the .txt file itself as a hologram image.
  • Per nepstad's feedback on holo.py does globing in holo initial class #388, rather than just swapping to FilesToProcess (which was the first version of this PR), Initial now only stores the reconstruction parameters (wavelength, n, offset, minZ, maxZ, stepZ) on the pipeline data. Reconstruct builds kern/im_stack lazily on its first call, using the dimensions of the image that's actually already been loaded by the pipeline by that point. This removes the need to list/glob raw files for holo setup at all — a more direct fix for the root cause than swapping to a more robust file lister.
  • Initial's public config interface is unchanged, so no existing config.toml files or notebooks need updating.

Fixes #388

Test plan

  • pytest pyopia/tests/test_pipeline.py -k holo passes (same particle count as before)
  • pytest pyopia/tests/test_pipeline.py (full suite) passes
  • Ran pipeline-holo.ipynb and single-image-stats-holo.ipynb end-to-end via jupyter nbconvert --execute
  • flake8 shows no new issues
  • Confirmed holo.generate_config() (used by pyopia.cli generate-config) output is unchanged

glob() doesn't understand the .txt filelist convention supported by
pyopia.pipeline.FilesToProcess, so pointing raw_files at an explicit
filelist caused holo.Initial to try loading the .txt file itself as
a hologram image.

Fixes #388
@animmosmith animmosmith requested a review from emlynjdavies June 18, 2026 12:46
Per nepstad's feedback on #388: rather than peeking at the raw file
list just to determine image dimensions, store the reconstruction
parameters on the pipeline data in Initial, and build kern/im_stack
lazily inside Reconstruct the first time it runs, using the
dimensions of the image actually loaded by the pipeline. This removes
the need to list/glob raw files at all during holo setup, which is a
more direct fix for the reported bug than swapping to FilesToProcess.

Initial's public config interface (wavelength, n, offset, minZ, maxZ,
stepZ) is unchanged, so no existing config.toml files or notebooks
need updating.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

holo.py does globing in holo initial class

1 participant