Skip to content

Commit

Permalink
fix: typo in any check
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-murray authored and bhazelton committed Jul 23, 2024
1 parent 2c598ea commit 6148ba9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
5 changes: 3 additions & 2 deletions docs/uvcal_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@ linear polarizations ``XX`` and ``YY``, the stokes ``I`` sky emission can be map
convention). This choice is generally encoded in the sky model to which the visibilities
are calibrated. Different tools and simulators make different choices, generally following
a standard choice for the field. For example, tasks in ``CASA`` (e.g., ``tclean``) and
``MIRIAD``, along with ``WSClean``, all assume the ``avg`` convention. In ``pyuvdata``
either of these choices are OK, but the
``MIRIAD``, along with ``WSClean``, all assume the ``avg`` convention. FHD and the HERA
analysis stack use the ``sum`` convention. In ``pyuvdata`` either of these choices are
OK, but the
choice should be recorded as the ``pol_convention`` parameter in both ``UVCal`` and
``UVData`` objects. Since the ``pol_convention`` has always (at least implicitly) been
chosen for calibration solutions, we suggest *always* specifying this parameter on the
Expand Down
14 changes: 3 additions & 11 deletions src/pyuvdata/utils/uvcalibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ def _get_pol_conventions(
warnings.warn(
message=(
"pol_convention is not specified on the UVCal object, and "
"uvc_pol_convention was not specified. This is deprecated, and will"
" be an error in pyuvdata 3.2, since it is impossible to properly "
"infer. For now, we are tentatively assuming "
"uvc_pol_convention was not specified. Tentatively assuming "
"that the UVCal and UVData objects (implicitly) have the same "
"convention."
),
category=DeprecationWarning,
stacklevel=2,
)
uvc_pol_convention = uvd_pol_convention or uvdata.pol_convention
Expand All @@ -46,13 +43,10 @@ def _get_pol_conventions(
warnings.warn(
message=(
"pol_convention is not specified on the UVData object, and "
"uvd_pol_convention was not specified. This is deprecated, and will"
" be an error in pyuvdata 3.2, since it is impossible to know how "
"to properly un-calibrate. For now, we are tentatively assuming "
"uvd_pol_convention was not specified. Tentatively assuming "
"that the UVCal and UVData objects (implicitly) have the same "
"convention."
),
category=DeprecationWarning,
stacklevel=2,
)
uvd_pol_convention = uvc_pol_convention
Expand All @@ -78,9 +72,7 @@ def _get_pol_conventions(
message=(
"Neither uvd_pol_convention nor uvc_pol_convention are specified, "
"so the resulting UVData object will have ambiguous convention. "
"This is deprecated and will be an error in pyuvdata v3.2."
),
category=DeprecationWarning,
stacklevel=2,
)
if uvd_pol_convention not in ["sum", "avg", None]:
Expand Down Expand Up @@ -229,7 +221,7 @@ def uvcalibrate(
"calibrations"
)

if np.any(uvdata.polarization_array) > 0:
if np.any(uvdata.polarization_array > 0):
raise NotImplementedError(
"It is currently not possible to calibrate or de-calibrate data with "
"stokes polarizations, since it is impossible to define UVCal objects with "
Expand Down
9 changes: 4 additions & 5 deletions tests/utils/test_uvcalibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class TestGetPolConventions:
def tets_nothing_specified(self):
with check_warnings(
DeprecationWarning,
UserWarning,
match=[
"pol_convention is not specified on the UVCal object",
"Neither uvd_pol_convention not uvc_pol_convention are specified",
Expand Down Expand Up @@ -60,8 +60,7 @@ def test_uvc_uvcal_different(self):

def test_uvd_nor_uvdata_set(self):
with pytest.warns(
DeprecationWarning,
match="pol_convention is not specified on the UVData object",
UserWarning, match="pol_convention is not specified on the UVData object"
):
uvc, uvd = _get_pol_conventions(
uvdata=SimpleNamespace(pol_convention=None),
Expand Down Expand Up @@ -261,7 +260,7 @@ def test_uvcalibrate(uvcalibrate_data, flip_gain_conj, gain_convention, time_ran
"gain_scale is not set, so there is no way to know",
"gain_scale should be set if pol_convention is set",
]
undo_warn_type = [DeprecationWarning, UserWarning, UserWarning]
undo_warn_type = [UserWarning, UserWarning, UserWarning]
else:
cal_warn_msg = ""
cal_warn_type = None
Expand Down Expand Up @@ -860,7 +859,7 @@ def test_uvdata_pol_array_in_stokes(uvcalibrate_data):
NotImplementedError,
match=(
"It is currently not possible to calibrate or de-calibrate data with "
"stokes polarizations",
"stokes polarizations"
),
):
uvcalibrate(uvd, uvc)

0 comments on commit 6148ba9

Please sign in to comment.