Skip to content

Commit

Permalink
add length-1 case in to combine_uvpspec in response to @adeliegorce '…
Browse files Browse the repository at this point in the history
…s review
  • Loading branch information
jsdillon committed Oct 28, 2024
1 parent b88b548 commit 4712b4e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hera_pspec/tests/test_uvpspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,10 @@ def test_combine_uvpspec(self):
beam=beam)
uvp1 = self._add_optionals(uvp1)

# test single UVPSpec
out = uvpspec.combine_uvpspec([uvp1], verbose=False)
assert id(out) == id(uvp1)

# test concat across pol
uvp2 = copy.deepcopy(uvp1)
uvp2.polpair_array[0] = 1414
Expand Down
4 changes: 4 additions & 0 deletions hera_pspec/uvpspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,6 +2351,10 @@ def combine_uvpspec(uvps, merge_history=True, verbose=True):
u : UVPSpec object
A UVPSpec object with the data of all the inputs combined.
"""
# Check if only one UVPSpec object is given
if (len(uvps) == 1) and issubclass(type(uvps[0]), UVPSpec):
return uvps[0]

# Perform type checks and get concatenation axis
(uvps, concat_ax, new_spws, new_blpts, new_polpairs,
static_meta) = get_uvp_overlap(uvps, just_meta=False, verbose=verbose)
Expand Down

0 comments on commit 4712b4e

Please sign in to comment.