Skip to content

Commit 22f0a97

Browse files
committed
Allows for beam simulation while having maximum one dimension larger than 1 element
1 parent e399c7c commit 22f0a97

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

nenupy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
__copyright__ = "Copyright 2023, nenupy"
66
__credits__ = ["Alan Loh"]
77
__license__ = "MIT"
8-
__version__ = "2.6.1"
8+
__version__ = "2.6.2"
99
__maintainer__ = "Alan Loh"
1010
__email__ = "alan.loh@obspm.fr"
1111

nenupy/instru/nenufar.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,11 @@ def __getitem__(self, sky: Sky) -> np.ndarray:
145145
) for gain_i in gain
146146
])
147147

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

0 commit comments

Comments
 (0)