How ries-lab/uipsf works
Main System Components
a. User Interface Layer
• Jupyter Notebooks (demo/*.ipynb)
• Tutorial PDFs (tutorial/*.pdf)
• CLI/pip install -e . entry point (psflearning/psflearninglib.py)
b. Configuration Layer
• YAML config files (config/*/*.yaml, config/config_base.yaml, config/config_user.yaml)
• Parameter description docs (config/parameter description.md)
• Omegaconf loader
c. Data I/O Layer
• Raw data readers (psflearning/io/h5.py, io/param.py)
• czifile, tif, mat parsers
d. Core PSF Learning Library
• Data loader & interfaces (dataloader.py, data_representation/*)
• PSF model interfaces & implementations (learning/psfs/*)
• Fitters (learning/fitters/*)
• Optimizers & loss functions (learning/optimizers.py, learning/loss_functions.py)
• Utilities & image tools (imagetools.py, loclib.py, utilities.py)
e. Native Compute Layer
• Precompiled binaries for maximum-likelihood fitting (source/mleFit_LM_dylib/*.dylib, source/mleFit_LM_so)
• Python wrappers (ctypes/cffi) invoked by PSFInterface implementations
f. External Dependencies
• Python runtime & packages (TensorFlow, numpy, scipy, omeagconf, hdfdict, etc.)
• GPU hardware (CUDA, cuDNN) or CPU fallback
g. Output & Visualization
• PSF model files (.h5 via hdfdict)
• Generated plots (makeplots.py)
• Demo “output parameters” docs (demo/Description of output parameters.md)
Relationships & Data Flows
• Notebooks/CLI load a user-provided config via Omegaconf.
• Config → Data I/O layer: determines data paths and parameters (e.g. channel counts, ROI sizes).
• Data I/O → Core Library: raw image stacks flow into DataRepresentation classes, then into Fitters.
• Core Library ↔ Native Compute: some fitters call the mleFit_LM dynamic libraries for heavy compute.
• Core Library → TensorFlow: deep-learning-based PSF fitters invoke TensorFlow/TF-Probability.
• Core Library → Output: learned PSF models are serialized to .h5; makeplots generates figures.
• Demo notebooks / Tutorial consume output PSF models for downstream localization.
Architectural Patterns & Design Principles
• Modular Plugin-style Interfaces: PSFInterface, FitterInterface allow new PSF types or fitting methods to be dropped into learning/psfs or learning/fitters.
• Config-Driven Execution: Omegaconf loads hierarchical YAMLs to parameterize every aspect (systemtype, channeltype, psftype).
• Separation of Concerns: clear layers for I/O, data representation, modeling, compute, and visualization.
• Cross-Platform Build: Python wrappers decouple high-performance C/C++ binaries from the pure-Python logic.
Essential Detail Checklist
• Every top-level directory as a logical component.
• How config_base.yaml and config_user.yaml combine.
• Call out the demo/ folder as driving examples.
• Test/unit/io as verification of the I/O layer.
• Cross-platform solver selection (GPU vs CPU).