Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/tests.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some version compatibility issues in the tests following the changes... :/

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.11", "3.12", "3.13"]
fail-fast: false

steps:
Expand All @@ -25,18 +25,22 @@ jobs:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v3
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Install
run: |
pip install .[dev]
run: uv sync --all-extras --dev

- name: Run Tests
run: |
export MPLBACKEND=agg
pytest --cov=hera_pspec --cov-config="./.coveragerc" \
uv run pytest --cov=hera_pspec --cov-config="./.coveragerc" \
--cov-report xml:"./coverage.xml" --junitxml="./test-reports/xunit.xml"

- name: Upload coverage to Codecov
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/warnings-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run Warnings Tests

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]

jobs:
tests:
name: Tests
env:
OS: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
fail-fast: false

steps:
- uses: actions/checkout@main
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version-file: pyproject.toml

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Install
run: uv sync --all-extras --dev

- name: Run Tests
run: |
export MPLBACKEND=agg
uv run pytest -Werror
31 changes: 9 additions & 22 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,17 @@ build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_create_environment:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
create_environment:
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
install:
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs

python:
install:
- method: pip
path: .
extra_requirements:
- docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
15 changes: 8 additions & 7 deletions hera_pspec/pspecdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2727,7 +2727,7 @@ def validate_pol(self, dsets, pol_pair):
assert isinstance(pol_pair, tuple), err_msg

# take x_orientation from first dset
x_orientation = self.dsets[0].telescope.x_orientation
x_orientation = self.dsets[0].telescope.get_x_orientation_from_feeds()

# convert elements to integers if fed as strings
if isinstance(pol_pair[0], str):
Expand Down Expand Up @@ -3114,14 +3114,15 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
# convert all polarizations to integers if fed as strings
_pols = []
for p in pols:
x_orientation = self.dsets[0].telescope.get_x_orientation_from_feeds()
if isinstance(p, str):
# Convert string to pol-integer pair
p = (uvutils.polstr2num(p, x_orientation=self.dsets[0].telescope.x_orientation),
uvutils.polstr2num(p, x_orientation=self.dsets[0].telescope.x_orientation))
p = (uvutils.polstr2num(p, x_orientation=x_orientation),
uvutils.polstr2num(p, x_orientation=x_orientation))
if isinstance(p[0], str):
p = (uvutils.polstr2num(p[0], x_orientation=self.dsets[0].telescope.x_orientation), p[1])
p = (uvutils.polstr2num(p[0], x_orientation=x_orientation), p[1])
if isinstance(p[1], str):
p = (p[0], uvutils.polstr2num(p[1], x_orientation=self.dsets[0].telescope.x_orientation))
p = (p[0], uvutils.polstr2num(p[1], x_orientation=x_orientation))
_pols.append(p)
pols = _pols

Expand Down Expand Up @@ -3592,7 +3593,7 @@ def pspec(self, bls1, bls2, dsets, pols, n_dlys=None,
if exact_windows:
# compute and store exact window functions
uvp.get_exact_window_functions(ftbeam=ftbeam, verbose=verbose,
x_orientation=self.dsets[0].telescope.x_orientation,
x_orientation=self.dsets[0].telescope.get_x_orientation_from_feeds(),
inplace=True)
else:
uvp.window_function_array = window_function_array
Expand Down Expand Up @@ -3694,7 +3695,7 @@ def rephase_to_dset(self, dset_index=0, inplace=True):
indices = dset.antpair2ind(k[:2], ordered=False)

# get index in polarization_array for this polarization
polind = pol_list.index(uvutils.polstr2num(k[-1], x_orientation=self.dsets[0].telescope.x_orientation))
polind = pol_list.index(uvutils.polstr2num(k[-1], x_orientation=self.dsets[0].telescope.get_x_orientation_from_feeds()))

# insert into dset
dset.data_array[indices, :, polind] = data[k]
Expand Down
4 changes: 2 additions & 2 deletions hera_pspec/pstokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def construct_pstokes(dset1, dset2, pstokes='pI', run_check=True, antenna_nums=N

# convert pstokes to integer if fed as a string
if isinstance(pstokes, str):
pstokes = pyuvdata.utils.polstr2num(pstokes, x_orientation=dset1.telescope.x_orientation)
pstokes = pyuvdata.utils.polstr2num(pstokes, x_orientation=dset1.telescope.get_x_orientation_from_feeds())

# check if dset1 and dset2 habe the same spectral window
spw1 = uvd1.spw_array
Expand Down Expand Up @@ -445,7 +445,7 @@ def filter_dset_on_stokes_pol(dsets, pstokes):

# convert pstokes to integer if a string
if isinstance(pstokes, str):
pstokes = pyuvdata.utils.polstr2num(pstokes, x_orientation=dsets[0].telescope.x_orientation)
pstokes = pyuvdata.utils.polstr2num(pstokes, x_orientation=dsets[0].telescope.get_x_orientation_from_feeds())
assert pstokes in [1, 2, 3, 4], \
"pstokes must be fed as a pseudo-Stokes parameter"

Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies = [
"numpy>=2.0",
"scipy",
"matplotlib>=3.0",
"pyuvdata>=3.2",
"pyuvdata>=3.2.5",
"astropy>=6.0",
"pyyaml",
"h5py",
Expand All @@ -43,14 +43,15 @@ dependencies = [
"typing-extensions>=4.5.0",
]
dynamic = ['version']
requires-python = ">=3.11"

[project.urls]
Documentation = "https://hera-pspec.readthedocs.io/en/latest/"
Repository = "https://github.com/HERA-Team/hera_pspec"
Changelog = "https://github.com/HERA-Team/hera_pspec/releases"
Issues = "https://github.com/HERA-Team/hera_pspec/issues"

[project.optional-dependencies]
[dependency-groups]
docs = [
"sphinx>=5.3.0",
"sphinx_rtd_theme>=1.1.1",
Expand All @@ -59,7 +60,6 @@ docs = [
"ipython",
"sphinx_autorun",
"numpydoc>=0.8",
"nbsphinx",
"mock==1.0.1",
]
tests = [
Expand All @@ -69,8 +69,8 @@ tests = [
"pytest-cases",
]
dev = [
"hera_pspec[doc,tests]",
"hera_pspec[tests]",
{include-group = "docs"},
{include-group = "tests"},
]

[project.scripts]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_uvpspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1121,4 +1121,4 @@ def test_add_approximate_cov():
uvp2 = uvp.add_approximate_covariance(inplace=False)
assert hasattr(uvp, 'cov_array_real')
assert np.allclose(np.diagonal(uvp.cov_array_real[0], axis1=1, axis2=2), 1.0)
assert np.allclose(np.diagonal(uvp2.cov_array_real[0], axis1=1, axis2=2), 4.0)
assert np.allclose(np.diagonal(uvp2.cov_array_real[0], axis1=1, axis2=2), 4.0)
Loading
Loading