Use FilesToProcess instead of raw glob in holo.Initial#391
Open
animmosmith wants to merge 3 commits into
Open
Conversation
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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 buildkern/im_stackupfront. This had a real bug: it bypassedpyopia.pipeline.FilesToProcess, which is what supports pointingraw_filesat an explicit.txtfilelist — pointing at one would makeInitialtry to load the.txtfile itself as a hologram image.FilesToProcess(which was the first version of this PR),Initialnow only stores the reconstruction parameters (wavelength,n,offset,minZ,maxZ,stepZ) on the pipeline data.Reconstructbuildskern/im_stacklazily 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 existingconfig.tomlfiles or notebooks need updating.Fixes #388
Test plan
pytest pyopia/tests/test_pipeline.py -k holopasses (same particle count as before)pytest pyopia/tests/test_pipeline.py(full suite) passespipeline-holo.ipynbandsingle-image-stats-holo.ipynbend-to-end viajupyter nbconvert --executeflake8shows no new issuesholo.generate_config()(used bypyopia.cli generate-config) output is unchanged