Haskels/ptycho fm backend - #131
Closed
haskels wants to merge 35 commits into
Closed
Conversation
Mirrors the ptychopinn_torch subprocess-isolation pattern for the ptycho-vit foundation model. Parent-side factory produces a SubprocessReconstructor whose child entry points (run_reconstruct / run_train) are the only ptychodus modules that import torch or ptycho_vit. The parent hands the child a pre-built nested config dict (no framework types cross the pickle boundary) plus the raw payload. Inference batches diffraction amplitudes through PtychoViT, applies a central crop to each patch, and stitches phase + amplitude back onto the object grid via place_patches_fourier_shift, folding the result into layer 0 as amp*exp(1j*ph). Training runs a minimal single-device loop (no DDP, no mlflow, no wandb) with random_split train/val and saves the best-val checkpoint to output_path/best.pth. Registers Unsupervised + Supervised modes via the reconstructor library and wires a PyQt controller with Data/Model/Training/Inference groups. When ptycho_vit is absent, developer mode falls back to NullReconstructor so the GUI still boots. Optional dep ptycho-fm = ["ptycho-vit"] added to pyproject.toml; the test_parent_config_builders discipline gate covers ptycho_fm too.
CI on webservice runs `ruff format --check .` over the whole tree, including Python fenced blocks in docs/source/. Two pages had drifted (double quotes, unpacked multi-line call arguments) and were failing the check for every open PR. Running `ruff format .` reformats them in place with no logic changes.
Collaborator
Author
|
@stevehenke could you please merge this branch to webservice? I do not have write access so I am unable to merge. |
Replaces the NPZ writer with a two-HDF5 exporter matching what ptycho_vit.CombinedDataset actually reads: <stem>_dp.hdf5 with a 'dp' dataset of diffraction patterns, and <stem>_para.hdf5 with 'object', 'probe', 'probe_position_x_m', and 'probe_position_y_m' plus a 'pixel_height_m' attr on 'object'. file_path is treated as a stem (the picked filename itself is not created).
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.
No description provided.