Skip to content

Commit

Permalink
Back working
Browse files Browse the repository at this point in the history
  • Loading branch information
samaloney committed May 23, 2024
1 parent 337ed97 commit 5d94626
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions xrayvision/imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def image_to_vis(
pixel_size = validate_and_expand_kwarg(pixel_size, "pixel_size")
if not (apu.get_physical_type((1 / u).unit) == ANGLE and apu.get_physical_type((1 / v).unit) == ANGLE):
raise ValueError("u and v must be inverse angle (e.g. 1/deg or 1/arcsec")

Check warning on line 127 in xrayvision/imaging.py

View check run for this annotation

Codecov / codecov/patch

xrayvision/imaging.py#L127

Added line #L127 was not covered by tests
vis = dft_map(
image * apu.pix**2 * pixel_size[0] * pixel_size[1], u=u, v=v, phase_centre=phase_centre, pixel_size=pixel_size
)
vis = dft_map(image, u=u, v=v, phase_centre=phase_centre, pixel_size=pixel_size)
return Visibility(vis, u=u, v=v, offset=phase_centre)


Expand Down Expand Up @@ -166,7 +164,7 @@ def vis_to_image(
vis.vis, u=vis.u, v=vis.v, shape=shape, weights=weights, pixel_size=pixel_size, phase_centre=vis.phase_centre
)

return bp_arr / (pixel_size[0] * apu.pix * pixel_size[1] * apu.pix)
return bp_arr


@apu.quantity_input
Expand Down
2 changes: 1 addition & 1 deletion xrayvision/tests/test_imaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_vis_to_image_against_idft(uv):
)
vis = Visibility(obs_vis, u=u, v=v)
res = vis_to_image(vis, shape=[65, 65] * apu.pixel, pixel_size=2 * apu.arcsec / apu.pix, scheme="uniform")
assert np.allclose(bp_calc, res * 4 * apu.arcsec**2)
assert np.allclose(bp_calc, res)


def test_image_to_vis():
Expand Down
2 changes: 1 addition & 1 deletion xrayvision/tests/test_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_mem():
sub_uv = np.vstack([x.flatten(), y.flatten()]) / u.arcsec
# sub_uv = np.hstack([sub_uv, np.zeros((2, 1))]) / u.arcsec

vis = image_to_vis(data / u.arcsec**2, u=sub_uv[0, :], v=sub_uv[1, :], pixel_size=2 * u.arcsec / u.pix)
vis = image_to_vis(data, u=sub_uv[0, :], v=sub_uv[1, :], pixel_size=2 * u.arcsec / u.pix)
setattr(vis, "amplitude_error", np.sqrt(np.abs(vis.vis)))
setattr(vis, "label", [str(x) for x in np.sqrt(x**2 + y**2).flatten()])

Expand Down

0 comments on commit 5d94626

Please sign in to comment.