Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/examples/cli/configs/fluorescence_2d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ fluorescence:
wavelength_emission: 0.532 # emission wavelength in micrometers
confocal_pinhole_diameter: null # confocal pinhole diameter (null = widefield)
apply_inverse:
reconstruction_algorithm: Tikhonov # 'Tikhonov' or 'TV' regularization
reconstruction_algorithm: Tikhonov # 'Tikhonov'/'TV' filters or 'RL'/'RLGC' iterative deconvolution
regularization_strength: 0.01 # strength of regularization
TV_rho_strength: 0.001 # ADMM rho parameter for TV regularization
TV_iterations: 1 # ADMM iterations for TV regularization
rl: null # Richardson-Lucy knobs; only valid with reconstruction_algorithm 'RL'/'RLGC', and filled with defaults if omitted there
3 changes: 2 additions & 1 deletion docs/examples/cli/configs/fluorescence_3d.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ fluorescence:
wavelength_emission: 0.532 # emission wavelength in micrometers
confocal_pinhole_diameter: null # confocal pinhole diameter (null = widefield)
apply_inverse:
reconstruction_algorithm: Tikhonov # 'Tikhonov' or 'TV' regularization
reconstruction_algorithm: Tikhonov # 'Tikhonov'/'TV' filters or 'RL'/'RLGC' iterative deconvolution
regularization_strength: 0.001 # strength of regularization
TV_rho_strength: 0.001 # ADMM rho parameter for TV regularization
TV_iterations: 1 # ADMM iterations for TV regularization
rl: null # Richardson-Lucy knobs; only valid with reconstruction_algorithm 'RL'/'RLGC', and filled with defaults if omitted there
373 changes: 373 additions & 0 deletions tests/models/test_backprojector.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions tests/models/test_isotropic_fluorescent_thick_3d.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,44 @@
import numpy as np
import pytest
import torch

from waveorder import util
from waveorder._pixel_size import YXPixelSize
from waveorder.models import isotropic_fluorescent_thick_3d


@pytest.mark.parametrize(
"yx_pixel_size, na, confocal_pinhole_diameter",
[
(0.1, 1.2, None),
(0.325, 0.8, None),
(0.65, 0.45, None),
(0.65, 1.2, None),
(1.3, 1.2, None),
(0.325, 0.8, 0.5), # confocal
],
)
def test_transfer_function_psf_nonnegative(yx_pixel_size, na, confocal_pinhole_diameter):
"""The incoherent PSF must be nonnegative.

Upsampling to Nyquist and then cropping the OTF in Fourier space rings the
PSF below zero (worst near sub-Nyquist sampling). This is unphysical and
breaks Richardson-Lucy, so ``calculate_transfer_function`` clips it away.
"""
otf = isotropic_fluorescent_thick_3d.calculate_transfer_function(
zyx_shape=(24, 64, 64),
yx_pixel_size=yx_pixel_size,
z_pixel_size=0.5,
wavelength_emission=0.515,
z_padding=0,
index_of_refraction_media=1.4,
numerical_aperture_detection=na,
confocal_pinhole_diameter=confocal_pinhole_diameter,
)
psf = torch.real(torch.fft.ifftn(otf, dim=(-3, -2, -1)))
assert psf.min() >= -1e-6 * psf.max()


def test_pinhole_aperture_otf_small_diameter():
"""Test that pinhole OTF is broader for smaller diameter."""
yx_shape = (128, 128)
Expand Down
Loading
Loading