Skip to content

Commit

Permalink
move analytic_beam.py and beam_interface.py to top level
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazelton committed Sep 19, 2024
1 parent ae29819 commit 2717f3a
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 51 deletions.
11 changes: 3 additions & 8 deletions src/pyuvdata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,11 @@ def branch_scheme(version): # pragma: nocover
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")

from .analytic_beam import AiryBeam, GaussianBeam, ShortDipoleBeam, UniformBeam # noqa
from .beam_interface import BeamInterface # noqa
from .telescopes import Telescope # noqa
from .telescopes import get_telescope # noqa # NB: get_telescopes is deprecated
from .uvbeam import ( # noqa
AiryBeam,
BeamInterface,
GaussianBeam,
ShortDipoleBeam,
UniformBeam,
UVBeam,
)
from .uvbeam import UVBeam # noqa
from .uvcal import UVCal # noqa
from .uvdata import FastUVH5Meta # noqa
from .uvdata import UVData # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from astropy.constants import c as speed_of_light
from scipy.special import j1

from .. import utils
from ..docstrings import combine_docstrings
from .uvbeam import UVBeam, _convert_feeds_to_pols
from . import utils
from .docstrings import combine_docstrings
from .uvbeam.uvbeam import UVBeam, _convert_feeds_to_pols

__all__ = ["AnalyticBeam", "AiryBeam", "GaussianBeam", "ShortDipoleBeam", "UniformBeam"]

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pyuvdata/data/test_analytic_beam.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import numpy.typing as npt

from ..uvbeam.analytic_beam import AnalyticBeam
from ..analytic_beam import AnalyticBeam


@dataclass(kw_only=True)
Expand Down
2 changes: 0 additions & 2 deletions src/pyuvdata/uvbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

"""Init file for UVBeam."""

from .analytic_beam import AiryBeam, GaussianBeam, ShortDipoleBeam, UniformBeam # noqa
from .beam_interface import BeamInterface # noqa
from .uvbeam import * # noqa
37 changes: 37 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import os

import numpy as np
import pytest
from astropy.coordinates import EarthLocation
from astropy.time import Time
Expand Down Expand Up @@ -123,3 +124,39 @@ def uvcalibrate_uvdata_oldfiles(uvcalibrate_uvdata_oldfiles_main):
uvd = uvcalibrate_uvdata_oldfiles_main.copy()

yield uvd


@pytest.fixture()
def az_za_coords():
az_array = np.deg2rad(np.linspace(0, 350, 36))
za_array = np.deg2rad(np.linspace(0, 90, 10))

return az_array, za_array


@pytest.fixture()
def az_za_deg_grid(az_za_coords):
az_array, za_array = az_za_coords
freqs = np.linspace(100, 200, 11) * 1e8

az_vals, za_vals = np.meshgrid(az_array, za_array)

return az_vals.flatten(), za_vals.flatten(), freqs


@pytest.fixture()
def xy_grid():
nfreqs = 20
freqs = np.linspace(100e6, 130e6, nfreqs)

xy_half_n = 250
zmax = np.radians(90) # Degrees
arr = np.arange(-xy_half_n, xy_half_n)
x_arr, y_arr = np.meshgrid(arr, arr)
x_arr = x_arr.flatten()
y_arr = y_arr.flatten()
radius = np.sqrt(x_arr**2 + y_arr**2) / float(xy_half_n)
za_array = radius * zmax
az_array = np.arctan2(y_arr, x_arr)

return az_array, za_array, freqs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from scipy.special import j1

from pyuvdata import AiryBeam, GaussianBeam, ShortDipoleBeam, UniformBeam, UVBeam
from pyuvdata.uvbeam.analytic_beam import AnalyticBeam
from pyuvdata.analytic_beam import AnalyticBeam


def test_airy_beam_values(az_za_deg_grid):
Expand Down
File renamed without changes.
36 changes: 0 additions & 36 deletions tests/uvbeam/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,39 +336,3 @@ def phased_array_beam_1freq(phased_array_beam_2freq):

yield beam
del beam


@pytest.fixture()
def az_za_coords():
az_array = np.deg2rad(np.linspace(0, 350, 36))
za_array = np.deg2rad(np.linspace(0, 90, 10))

return az_array, za_array


@pytest.fixture()
def az_za_deg_grid(az_za_coords):
az_array, za_array = az_za_coords
freqs = np.linspace(100, 200, 11) * 1e8

az_vals, za_vals = np.meshgrid(az_array, za_array)

return az_vals.flatten(), za_vals.flatten(), freqs


@pytest.fixture()
def xy_grid():
nfreqs = 20
freqs = np.linspace(100e6, 130e6, nfreqs)

xy_half_n = 250
zmax = np.radians(90) # Degrees
arr = np.arange(-xy_half_n, xy_half_n)
x_arr, y_arr = np.meshgrid(arr, arr)
x_arr = x_arr.flatten()
y_arr = y_arr.flatten()
radius = np.sqrt(x_arr**2 + y_arr**2) / float(xy_half_n)
za_array = radius * zmax
az_array = np.arctan2(y_arr, x_arr)

return az_array, za_array, freqs

0 comments on commit 2717f3a

Please sign in to comment.