Skip to content

Commit

Permalink
Reapply "fix warnings from tensoring a tensor"
Browse files Browse the repository at this point in the history
This reverts commit 790df57.
  • Loading branch information
talonchandler committed Sep 10, 2024
1 parent 790df57 commit 6fa39fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/test_optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_generate_propagation_kernel():

def test_gen_Greens_function_z():
wavelength = 0.5
z_position_list = [0, 1, -1] # note fftfreq coords
z_position_list = torch.tensor([0, 1, -1]) # note fftfreq coords
radial_frequencies = util.generate_radial_frequencies((10, 10), 0.5)
pupil = optics.generate_pupil(radial_frequencies, 0.5, 0.5)

Expand Down
10 changes: 5 additions & 5 deletions waveorder/optics.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def generate_propagation_kernel(
wavelength : float
wavelength of the light in the immersion media
z_position_list : torch.tensor or list
z_position_list : torch.tensor
1D array of defocused z positions with the size of (Z)
Returns
Expand All @@ -414,7 +414,7 @@ def generate_propagation_kernel(
1j
* 2
* np.pi
* torch.tensor(z_position_list)[:, None, None]
* z_position_list[:, None, None]
* oblique_factor[None, :, :]
)

Expand All @@ -440,7 +440,7 @@ 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
1D array of defocused z position with the size of (Z,)
axially_even : bool
Expand All @@ -461,9 +461,9 @@ def generate_greens_function_z(
) ** (1 / 2) / wavelength_illumination

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

greens_function_z = (
-1j
Expand Down

0 comments on commit 6fa39fd

Please sign in to comment.