Skip to content

Haskels/ptycho fm backend - #131

Closed
haskels wants to merge 35 commits into
AdvancedPhotonSource:PtychoFMfrom
haskels:haskels/ptycho-fm-backend
Closed

Haskels/ptycho fm backend#131
haskels wants to merge 35 commits into
AdvancedPhotonSource:PtychoFMfrom
haskels:haskels/ptycho-fm-backend

Conversation

@haskels

@haskels haskels commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

stevehenke and others added 29 commits June 30, 2026 13:16
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.
@haskels

haskels commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

@stevehenke could you please merge this branch to webservice? I do not have write access so I am unable to merge.

stevehenke and others added 6 commits August 11, 2026 15:38
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).
@haskels
haskels changed the base branch from main to PtychoFM August 17, 2026 20:38
@haskels haskels closed this Aug 17, 2026
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.

2 participants