Skip to content

Commit

Permalink
Allows for beam simulation while having maximum one dimension larger …
Browse files Browse the repository at this point in the history
…than 1 element
  • Loading branch information
AlanLoh committed Jan 22, 2024
1 parent e399c7c commit 22f0a97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 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.6.1"
__version__ = "2.6.2"
__maintainer__ = "Alan Loh"
__email__ = "[email protected]"

Expand Down
7 changes: 6 additions & 1 deletion nenupy/instru/nenufar.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,11 @@ def __getitem__(self, sky: Sky) -> np.ndarray:
) for gain_i in gain
])

if gain.ndim == 2:
if gain.ndim == 1:
# If only one or less dimension is larger than 1 element, get_interp_val returns a 1D array
# It's then esay to just reshape like the original array since a single dimension is affected at best
gain = gain.reshape(sky.value.shape)
elif gain.ndim == 2:
# The time dimension is not yet included
gain = gain.reshape((1,) + gain.shape)
# Return something shaped as (time, freq, coord)
Expand Down Expand Up @@ -915,6 +919,7 @@ def _antenna_gain(self, sky: Sky, pointing: Pointing):
),
dtype=np.float64
)
log.debug(f"Antenna gain shape: {gain.shape}.")
for i, pol in enumerate(sky.polarization):
if not isinstance(pol, Polarization):
log.warning(
Expand Down

0 comments on commit 22f0a97

Please sign in to comment.