Skip to content

Commit

Permalink
Gain interpolation shape correction
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLoh committed Oct 10, 2023
1 parent 596d1e5 commit ab1a681
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion nenupy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__copyright__ = "Copyright 2023, nenupy"
__credits__ = ["Alan Loh"]
__license__ = "MIT"
__version__ = "2.3.13"
__version__ = "2.3.14"
__maintainer__ = "Alan Loh"
__email__ = "alan.loh@obspm.fr"

Expand Down
5 changes: 3 additions & 2 deletions nenupy/astro/astro_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,9 @@ def hour_angle(self, fast_compute: bool = True) -> Longitude:
# ============================================================= #
# ----------------------- faraday_angle ----------------------- #
# ============================================================= #
@u.quantity_input
def faraday_angle(frequency: u.Quantity[u.MHz], rotation_measure: u.Quantity[u.rad/u.m**2], inverse: bool = False):
# @u.quantity_input
# def faraday_angle(frequency: u.Quantity[u.MHz], rotation_measure: u.Quantity[u.rad/u.m**2], inverse: bool = False):
def faraday_angle(frequency: u.Quantity, rotation_measure: u.Quantity, inverse: bool = False):
""" Computes the Faraday rotation angle.
:param frequency:
Expand Down
11 changes: 7 additions & 4 deletions nenupy/instru/nenufar.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ def __getitem__(self, sky: Sky) -> np.ndarray:
# Find the interpolated gain at the desired frequency
#gain = self.interpolated_gain(self.healpix_coords, freqs)
#gain = self.interpolated_gain((freqs, self.healpix_coords))
gain = self.interpolated_gain(freqs)
if gain.ndim == 1:
gain = gain.reshape((1, gain.size))
gain = self.interpolated_gain(freqs) # shape: (freq, pix_coord)
# if gain.ndim == 1:
# gain = gain.reshape((1, gain.size))

# Find the interpolated gain at the desired coordinates for each frequency
gain = np.array([
Expand All @@ -145,8 +145,11 @@ def __getitem__(self, sky: Sky) -> np.ndarray:
) for gain_i in gain
])

if gain.ndim == 2:
# The time dimension is not yet included
gain = gain.reshape((1,) + gain.shape)
# Return something shaped as (time, freq, coord)
return gain#np.moveaxis(gain, 0, 1)
return np.moveaxis(gain, 0, 1) # keep that!
#return gain.reshape((1,) + gain.shape) # use with RegularGridInterpolator


Expand Down

0 comments on commit ab1a681

Please sign in to comment.