Repository navigation
feat: Stage 3 npj Computational Materials upgrade (2.5D SwinIR, physics/topology losses, epistemic uncertainty & 3D FSC metrology) - #4
Merged
Conversation
…uncertainty, and FSC/tri-phase metrology
…cs in Zn-13X study
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
Implements the Stage 3 (npj Computational Materials) novelty roadmap across four pillars:
1. Zero-Overhead Orthogonal Epistemic Uncertainty &
2.5DMulti-Slice Context (Phase 3A)compute_orthogonal_uncertainty(src/openlsrx/inference/orthogonal.py): Computes zero-overhead voxel-wise epistemic uncertaintyrange, andcvacross perpendicular 2D/2.5D sweep planes.mode="confidence" | "confidence_fourier"): Suppresses single-axis streak/blur outliers via inverse-disagreement weighting, optionally combined with directional Fourier cone weighting and optical PSF cutoff (psf_cutoff).2.5DMulti-Slice Context (context_slices = 2k + 1): Boundary-safe per-axis reflect-padded windowing with zero cross-axis boundary bleeding andz-flip symmetry inextract_paired_slices_from_subvolume,PairedSliceDataset,PairedVolumeDataModule, andsuper_resolve_volume_orthogonal.2. Physics- & Topology-Preserving Objectives (Phase 3B)
AttenuationConservationLoss(src/openlsrx/losses/physics.py): Enforces Beer–Lambert X-ray linear attenuation conservation between super-resolved sub-voxels and measured LR voxels under the optical PSF ($\mathcal{P}{\sigma, s}(\hat{I}{\text{SR}}) = I_{\text{LR}}$) in 2D, 2.5D, and 3D.SoftCLDiceLoss&soft_skeletonize: Differentiable morphological skeletonization preserving narrow percolating pore throats.SobelGradientLoss&FocalFrequencyLoss: 2D/3D Sobel phase-boundary sharpness and adaptive high-frequency Fourier reconstruction losses, wired into bothSRGANandSR3DResNet.3.
2.5D SwinIRShifted-Window Transformer Backbone (Phase 3C)SwinIRGenerator(src/openlsrx/models/swinir.py): Pure-PyTorch shifted-window 2D self-attention generator (WindowAttention2D,SwinTransformerLayer,ResidualSwinBlock) supporting oddcontext_slices, arbitrary input dimensions (automatic pad-and-crop), and integer/fractional synchrotron optical magnifications (2x,2.5x,4x) viaArbitraryScaleUpsample.configs/i13-xct/zn13x_2x_swinir_25d_physics.yaml.4. Synchrotron
3D FSC/2D FRCMetrology, Tri-PhaseZn-13X& Uncertainty-Propagated Transport (Phase 3D)compute_fsc_3d,compute_frc_2d,evaluate_spectral_metrics(src/openlsrx/metrics/spectral.py): Radial Fourier Shell/Ring Correlation against0.143and information-theoretic1/2-bit curves, reporting effective spatial resolution inevaluate_triphase_zn13x_metrics(src/openlsrx/metrics/petrophysics.py): Multi-Otsu reactive ion-exchange evaluation (Macropore,Na-13X Core,Zn-13X RimDice & volume-fraction errors).compute_tortuosity_uncertainty_bounds(src/openlsrx/metrics/transport.py): Propagates orthogonal epistemic uncertainty--include-spectraland--include-triphasetoopenlsrx evaluate, expandedzn13x_synchrotron_study.pyto 7 methods (includingOpenLSR-X-SwinIR-2.5D-Physics-ConfFourier), updatedaggregate_campaign.py, and addeddocs/npj-study-design.md.Verification
ruff format --check&ruff check: 0 issuesmypy src tests scripts examples: 0 issues across 44 filesmkdocs build --strict: clean strict buildpytest --cov=openlsrx --cov-fail-under=85: 71/71 passed, 90.45% total coveragezn13x_synchrotron_study.py --fast+aggregate_campaign.pysmoke test verified.