Skip to content

Commit

Permalink
Merge pull request #4 from cosmo-ethz/slicing_fix
Browse files Browse the repository at this point in the history
fixing float sclicing issue
  • Loading branch information
jakeret committed Mar 6, 2017
2 parents 407a715 + 47a919a commit ea31920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions seek/utils/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ def wd(n, m, sigma_n, sigma_m):
return np.exp(-n**2/(2*sigma_n**2) - m**2/(2*sigma_m**2))

Vp = np.zeros((V.shape[0]+N, V.shape[1]+M))
Vp[N/2:-N/2,M/2:-M/2] = V[:]
Vp[N//2:-N//2,M//2:-M//2] = V[:]

Wfp = np.zeros((V.shape[0]+N, V.shape[1]+M))
Wfp[N/2:-N/2,M/2:-M/2] = ~mask[:]
Wfp[N//2:-N//2,M//2:-M//2] = ~mask[:]
Vh = np.zeros((V.shape[0]+N, V.shape[1]+M))
Vh2 = np.zeros((V.shape[0]+N, V.shape[1]+M))

Expand All @@ -52,7 +52,7 @@ def wd(n, m, sigma_n, sigma_m):
kernel_1 = wd(0, m, sigma_n=sigma_n, sigma_m=sigma_m).T

Vh = _gaussian_filter(Vp, V.shape[0], V.shape[1], Wfp, mask, Vh, Vh2, kernel_0, kernel_1, M, N)
Vh = Vh[N/2:-N/2,M/2:-M/2]
Vh = Vh[N//2:-N//2,M//2:-M//2]
Vh[mask] = V[mask]
return Vh

Expand Down
6 changes: 3 additions & 3 deletions test/test_mask_artefacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ def test_mask_artefacts(self):
plugin = mask_artefacts.Plugin(ctx)
plugin.mask_artefacts()

assert np.all(ctx.tod_vx.mask[:, :1000/24*9] == False)
assert np.all(ctx.tod_vx.mask[:, 1000/24*9:1000/24*10] == True)
assert np.all(ctx.tod_vx.mask[:, 1000/24*10+1:] == False)
assert np.all(ctx.tod_vx.mask[:, :int(1000/24*9)] == False)
assert np.all(ctx.tod_vx.mask[:, int(1000/24*9):int(1000/24*10)] == True)
assert np.all(ctx.tod_vx.mask[:, int(1000/24*10+1):] == False)

0 comments on commit ea31920

Please sign in to comment.