Hardware control and image analysis code for Fourier Ptychography.
This is a port of the Fourier Ptychography MATLAB code presented in this paper: Jiang, et al., Spatial and Fourier-domain ptychography for high-throughput bio-imaging, Nature Protocols 18, 2051 (2023)
from leb.ptycho import fp_simulation, fp_recover
# Simulate a Fourier Ptychography dataset
dataset, unaberrated_pupil, ground_truth_object, ground_truth_pupil = fp_simulation()
# Recover the complex object function and pupil
obj, pupil = fp_recover(dataset=dataset, pupil=unaberrated_pupil)
This library provides the following scripts for automating certain tasks:
- calibrate_ptycho - Acquire a Fourier Ptychography calibration dataset.
See the script docstrings for documentation on their use.
After you clone this repo, you will need to also synchronize the submodules that hold the test data for this project.
git submodule init
git submodule update
To pull any upstream changes to the test data:
git submodule update --remote led-array-datasets
- Install Python >= 3.11 OR install pyenv:
curl https://pyenv.run | bash
, then install Python interpreter(s):pyenv install 3.11.4
- Install poetry:
# Linux, macOS, WSL
curl -sSL https://install.python-poetry.org | python3 -
# Windows
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
-
Verify that Poetry is installed by running the command
poetry --version
. If the command is not found, you might need to add the directory containing the Poetry executable to your PATH environment variable. On Windows, the directory to add is%APPDATA%\Python\Scripts
. On Linux/macOS, it's$HOME/.local/bin
. -
Tell Poetry to use virtual environments in the project root directory:
poetry config virtualenvs.in-project true
-
Set the virtual environment Python version to 3.11:
poetry env use 3.11
-
Activate the virtual environment:
poetry shell
-
Install the dependencies:
poetry install
From inside the poetry shell:
pytest
From inside the poetry shell:
ruff check .
To reformat the code automatically:
black .
- Add or remove your dependency to pyproject.toml
- Regenerate the lock file:
poetry lock
- Synchronize your virtual environment with the new lock file:
poetry install
See arduino_src/led_matrix_controller/README.md.
See umanager/README.md.