Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose + np.copy() + (fancy indexing and/or ndarray.copy()) causes major slowdowns #322

Merged
merged 1 commit into from
Mar 6, 2023
Merged
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
15 changes: 2 additions & 13 deletions recOrder/compute/reconstructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,21 +321,10 @@ def reconstruct_qlipp_birefringence(stokes, recon):
volume of shape (C, Z, Y, X) or (C, Y, X) containing reconstructed birefringence data.
"""

if stokes.ndim == 4:
stokes = np.transpose(stokes, (0, 2, 3, 1))
elif stokes.ndim == 3:
pass
else:
if stokes.ndim != 4 and stokes.ndim != 3:
raise ValueError(f"Incompatible stokes dimension: {stokes.shape}")

birefringence = recon.Polarization_recon(np.copy(stokes))

# Return the transposed birefringence array with channel first
return (
np.transpose(birefringence, (-4, -1, -3, -2))
if len(birefringence.shape) == 4
else birefringence
)
return recon.Polarization_recon(stokes)


def reconstruct_phase2D(
Expand Down