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

ENH: ensure remap_time can deal with complex data #79

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
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
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))