Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed Aug 22, 2024
1 parent d2c49c7 commit bb22559
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/pyuvdata/uvbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the 2-clause BSD License

"""Init file for UVBeam."""

from .analytic_beam import AiryBeam, GaussianBeam, ShortDipoleBeam, UniformBeam # noqa
from .beam_interface import BeamInterface # noqa
from .uvbeam import * # noqa
7 changes: 3 additions & 4 deletions src/pyuvdata/uvbeam/analytic_beam.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2022 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

"""Analytic beam class definitions."""

from __future__ import annotations

from abc import ABC, abstractmethod
Expand Down Expand Up @@ -113,8 +113,7 @@ def __iter__(self) -> str:
for a in dir(self)
if not a.startswith("_") and not callable(getattr(self, a))
]
for a in attribute_list:
yield a
yield from attribute_list

def __eq__(self, other: Any, silent: bool = False) -> bool:
"""Equality method."""
Expand Down Expand Up @@ -834,7 +833,7 @@ def _power_eval(

if self.Npols > self.Nfeeds:
# cross pols are included
data_array[0, 2] = -np.sin(za_fgrid) ** 2 * np.sin(2.0 * az_fgrid) / 2.0
data_array[0, 2] = -(np.sin(za_fgrid) ** 2) * np.sin(2.0 * az_fgrid) / 2.0
data_array[0, 3] = data_array[0, 2]

return data_array
Expand Down
2 changes: 1 addition & 1 deletion src/pyuvdata/uvbeam/beam_interface.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2022 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

"""Definition for BeamInterface object."""

from __future__ import annotations

import copy
Expand Down
5 changes: 2 additions & 3 deletions tests/uvbeam/test_analytic_beam.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2024 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License

Expand Down Expand Up @@ -202,8 +201,8 @@ def test_short_dipole_beam(az_za_deg_grid):

expected_data[0, 0] = 1 - np.sin(za_vals) ** 2 * np.cos(az_vals) ** 2
expected_data[0, 1] = 1 - np.sin(za_vals) ** 2 * np.sin(az_vals) ** 2
expected_data[0, 2] = -np.sin(za_vals) ** 2 * np.sin(2.0 * az_vals) / 2.0
expected_data[0, 3] = -np.sin(za_vals) ** 2 * np.sin(2.0 * az_vals) / 2.0
expected_data[0, 2] = -(np.sin(za_vals) ** 2) * np.sin(2.0 * az_vals) / 2.0
expected_data[0, 3] = -(np.sin(za_vals) ** 2) * np.sin(2.0 * az_vals) / 2.0

np.testing.assert_allclose(power_vals, expected_data)

Expand Down
6 changes: 1 addition & 5 deletions tests/uvbeam/test_beam_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- mode: python; coding: utf-8 -*-
# Copyright (c) 2024 Radio Astronomy Software Group
# Licensed under the 2-clause BSD License
import copy
Expand Down Expand Up @@ -93,10 +92,7 @@ def test_beam_interface(
nfreqs = 20
freq_array = np.linspace(100e6, 150e6, nfreqs)

if "include_cross_pols" in kwargs.keys():
include_cross_pols = kwargs["include_cross_pols"]
else:
include_cross_pols = True
include_cross_pols = kwargs.get("include_cross_pols", True)

analytic = beam_obj(**kwargs)

Expand Down

0 comments on commit bb22559

Please sign in to comment.