From de61dc32e49b248e624c90d66ff89301d8d43cfa Mon Sep 17 00:00:00 2001 From: Josh Dillon Date: Wed, 25 Sep 2024 11:23:56 -0700 Subject: [PATCH] Use the same factor of 4 for "sum" and "avg" pol_convention This follows from @JianrongTan's work, as documented in #406 --- hera_pspec/pstokes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hera_pspec/pstokes.py b/hera_pspec/pstokes.py index fd3d33b9..8a0d33fd 100644 --- a/hera_pspec/pstokes.py +++ b/hera_pspec/pstokes.py @@ -188,7 +188,7 @@ def _combine_pol_arrays( nsamples_list : any length 2 iterable of numpy arrays Iterable of nsamples arrays to be combined to form their pseudo-Stokes equivalent. - nsamples are combined to preserve proper variance, see hera_pspec issue #391. + nsamples are combined to preserve proper variance, see hera_pspec issue #391 and #406 If only one is given, it is duplicated. Default is None. @@ -264,9 +264,9 @@ def _combine_pol_arrays( # constructing nsamples if nsamples_list is not None: - combined_nsamples = (nsamples_list[0]**-1 + nsamples_list[1]**-1)**-1 - if pol_convention == 'avg': - combined_nsamples *= 4. + combined_nsamples = 4 * (nsamples_list[0]**-1 + nsamples_list[1]**-1)**-1 + # for an explanation of the factor of 4, and why it doesn't depend on pol_convention, + # see https://github.com/HERA-Team/hera_pspec/issues/406 else: combined_nsamples = None