Skip to content

Commit

Permalink
correct phase recon regression, legacy recon assumes axially even gre…
Browse files Browse the repository at this point in the history
…en's function
  • Loading branch information
talonchandler committed Sep 9, 2024
1 parent 96d8b85 commit 005ea54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions waveorder/models/phase_thick_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def calculate_transfer_function(
det_pupil,
wavelength_illumination / index_of_refraction_media,
z_position_list,
axially_even=False,
)

(
Expand Down
23 changes: 14 additions & 9 deletions waveorder/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ def generate_propagation_kernel(


def generate_greens_function_z(
radial_frequencies, pupil_support, wavelength_illumination, z_position_list
radial_frequencies, pupil_support, wavelength_illumination, z_position_list,
axially_even=True,
):
"""
Expand All @@ -439,9 +440,14 @@ def generate_greens_function_z(
wavelength_illumination : float
wavelength of the light in the immersion media
z_position_list : torch.tensor or list
z_position_list : torch.tensor or list
1D array of defocused z position with the size of (Z,)
axially_even : bool
For backwards compatibility with legacy phase reconstruction.
Ideally the legacy phase reconstruction should be unified with
the new reconstructions, and this parameter should be removed.
Returns
-------
greens_function_z : torch.tensor
Expand All @@ -454,18 +460,17 @@ def generate_greens_function_z(
* pupil_support
) ** (1 / 2) / wavelength_illumination

if axially_even:
z_positions = torch.abs(torch.tensor(z_position_list)[:, None, None])
else:
z_positions = torch.tensor(z_position_list)[:, None, None]

greens_function_z = (
-1j
/ 4
/ np.pi
* pupil_support[None, :, :]
* torch.exp(
1j
* 2
* np.pi
* torch.abs(torch.tensor(z_position_list)[:, None, None])
* oblique_factor[None, :, :]
)
* torch.exp(1j * 2 * np.pi * z_positions * oblique_factor[None, :, :])
/ (oblique_factor[None, :, :] + 1e-15)
)

Expand Down

0 comments on commit 005ea54

Please sign in to comment.