Skip to content

Commit

Permalink
refactor(SVDSpectrumEstimator, SVDFilter): replace array views with l…
Browse files Browse the repository at this point in the history
…ocal_array
  • Loading branch information
sjforeman committed Oct 24, 2022
1 parent afe31c2 commit 38f22d2
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions draco/analysis/svdfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,9 @@ def process(self, mmodes):
for mi, m in vis.enumerate(axis=0):
self.log.debug("Calculating SVD spectrum of m=%i", m)

vis_m = (
vis[mi].view(np.ndarray).transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
vis_m = vis.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
weight_m = (
weight[mi]
.view(np.ndarray)
.transpose((1, 0, 2))
.reshape(vis.shape[2], -1)
weight.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
mask_m = weight_m == 0.0

Expand Down Expand Up @@ -109,14 +104,9 @@ def process(self, mmodes):
# Do a quick first pass calculation of all the singular values to get the max on this rank.
for mi, m in vis.enumerate(axis=0):

vis_m = (
vis[mi].view(np.ndarray).transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
vis_m = vis.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
weight_m = (
weight[mi]
.view(np.ndarray)
.transpose((1, 0, 2))
.reshape(vis.shape[2], -1)
weight.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
mask_m = weight_m == 0.0

Expand All @@ -135,14 +125,9 @@ def process(self, mmodes):
# Loop over all m's and remove modes below the combined cut
for mi, m in vis.enumerate(axis=0):

vis_m = (
vis[mi].view(np.ndarray).transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
vis_m = vis.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
weight_m = (
weight[mi]
.view(np.ndarray)
.transpose((1, 0, 2))
.reshape(vis.shape[2], -1)
weight.local_array[mi].transpose((1, 0, 2)).reshape(vis.shape[2], -1)
)
mask_m = weight_m == 0.0

Expand Down

0 comments on commit 38f22d2

Please sign in to comment.