Skip to content

Commit

Permalink
Merge pull request #79 from mhvk/remap-time-complex
Browse files Browse the repository at this point in the history
ENH: ensure remap_time can deal with complex data
  • Loading branch information
mhvk authored Sep 1, 2024
2 parents 32c9556 + f437370 commit 208f0ed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion screens/remap.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def remap_time(ds, t_map, new_t):
# Ensure the lower bound is always below the upper bound.
bounds_l, bounds_u = np.minimum(bounds_l, bounds_u), np.maximum(bounds_l, bounds_u)
# Create output and weight arrays.
out = np.zeros((len(new_t),)+ds.shape[1:])
out = np.zeros_like(ds, shape=(len(new_t),)+ds.shape[1:])
weight = np.zeros((len(new_t),)+ds.shape[1:])
# As well as a fake frequency pixel axis (needed for the case that t_map
# depends on the frequency axis as well).
Expand Down
7 changes: 7 additions & 0 deletions screens/tests/test_remap.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,10 @@ def test_remap_nut(self):
expected = self.scint(self.new_pos, self.scale[0])
expected = np.broadcast_to(expected[:, np.newaxis], out.shape)
assert_allclose(out, expected, atol=0.015)


class TestRemapTimeComplex(TestRemapTime):
@staticmethod
def scint(pos, scale=3.):
"""Super simple interference pattern."""
return np.exp(1j*(pos*scale*u.cy).to_value(u.rad))

0 comments on commit 208f0ed

Please sign in to comment.