Skip to content
Snippets Groups Projects
Commit d4b5a253 authored by Julian Rüstig's avatar Julian Rüstig
Browse files

multi: separate out the calculation of center (xy)

parent e9a774fc
No related branches found
No related tags found
1 merge request!50Draft: Mosaic imaging
Pipeline #230201 failed
...@@ -121,7 +121,6 @@ def build_response( ...@@ -121,7 +121,6 @@ def build_response(
If true w-gridding will be applied If true w-gridding will be applied
epsilon: float epsilon: float
The desired accuracy of sky2vis. The desired accuracy of sky2vis.
""" """
domain = sky_beamer.target[field_name] domain = sky_beamer.target[field_name]
... ...
......
...@@ -71,6 +71,27 @@ class SkyBeamer(ift.LinearOperator): ...@@ -71,6 +71,27 @@ class SkyBeamer(ift.LinearOperator):
return ift.makeField(self._tgt(mode), res) return ift.makeField(self._tgt(mode), res)
def calculate_phase_offset_to_image_center(
sky_center: SkyCoord,
phase_center: SkyCoord,
):
'''Calculate the relative shift of the phase center to the sky center
(reconstruction center) in radians.
Parameters
----------
sky_center: astropy.SkyCoord
The world coordinate of the sky center.
phase_center: astropy.SkyCoord
The world coordinate of the phase center of the observation.
'''
r = sky_center.separation(phase_center)
phi = sky_center.position_angle(phase_center)
center_y = r.to(u.rad).value * np.cos(phi.to(u.rad).value)
center_x = r.to(u.rad).value * np.sin(phi.to(u.rad).value)
return center_x, center_y
def build_sky_beamer( def build_sky_beamer(
sky_domain: ift.DomainTuple, sky_domain: ift.DomainTuple,
sky_center: SkyCoord, sky_center: SkyCoord,
...@@ -121,14 +142,13 @@ def build_sky_beamer( ...@@ -121,14 +142,13 @@ def build_sky_beamer(
): ):
direction = oo.direction_from_key(direction_key) direction = oo.direction_from_key(direction_key)
o_phase_center = SkyCoord(direction.phase_center[0]*u.rad, o_phase_center = SkyCoord(direction.phase_center[0]*u.rad,
direction.phase_center[1]*u.rad, direction.phase_center[1]*u.rad,
frame=sky_center.frame) frame=sky_center.frame)
r = sky_center.separation(o_phase_center)
phi = sky_center.position_angle(o_phase_center) center_x, center_y = calculate_phase_offset_to_image_center(
center_y = r.to(u.rad).value * np.cos(phi.to(u.rad).value) sky_center, o_phase_center
center_x = r.to(u.rad).value * np.sin(phi.to(u.rad).value) )
x = sky_coords.separation(o_phase_center) x = sky_coords.separation(o_phase_center)
x = x.to(u.rad).value x = x.to(u.rad).value
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment