Skip to content

Commit

Permalink
Merge pull request #864 from HERA-Team/fix-rephase
Browse files Browse the repository at this point in the history
Temporarily restore old array shape compatibility in HERAData for the sake of pspec
  • Loading branch information
steven-murray authored Jan 20, 2023
2 parents 541d065 + eff4762 commit f146720
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 22 deletions.
Binary file not shown.
70 changes: 48 additions & 22 deletions hera_cal/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,29 +619,55 @@ def _get_slice(self, data_array, key):
return {pol: self._get_slice(data_array, key + (pol,)) for pol in pols}
elif len(key) == 3: # asking for bl-pol
try:
return np.array(
data_array[
self._blt_slices[tuple(key[:2])], :,
self._polstr_indices.get(
key[2],
self._polnum_indices[
polstr2num(key[2], x_orientation=self.x_orientation)
]
)
]
)
if data_array.ndim == 4: # old shapes
return np.array(
data_array[
self._blt_slices[tuple(key[:2])], 0, :,
self._polstr_indices.get(
key[2],
self._polnum_indices[
polstr2num(key[2], x_orientation=self.x_orientation)
]
)
]
)
else:
return np.array(
data_array[
self._blt_slices[tuple(key[:2])], :,
self._polstr_indices.get(
key[2],
self._polnum_indices[
polstr2num(key[2], x_orientation=self.x_orientation)
]
)
]
)
except KeyError:
return np.conj(
data_array[
self._blt_slices[tuple(key[1::-1])], :,
self._polstr_indices.get(
conj_pol(key[2]),
self._polnum_indices[
polstr2num(conj_pol(key[2]), x_orientation=self.x_orientation)
]
)
]
)
if data_array.ndim == 4:
return np.conj(
data_array[
self._blt_slices[tuple(key[1::-1])], 0, :,
self._polstr_indices.get(
conj_pol(key[2]),
self._polnum_indices[
polstr2num(conj_pol(key[2]), x_orientation=self.x_orientation)
]
)
]
)
else:
return np.conj(
data_array[
self._blt_slices[tuple(key[1::-1])], :,
self._polstr_indices.get(
conj_pol(key[2]),
self._polnum_indices[
polstr2num(conj_pol(key[2]), x_orientation=self.x_orientation)
]
)
]
)
else:
raise KeyError('Unrecognized key type for slicing data.')

Expand Down

0 comments on commit f146720

Please sign in to comment.