Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More test coverage and other cleanup #450

Merged
merged 9 commits into from
Feb 29, 2024
10 changes: 5 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Bug fix checklist:
- [ ] All new and existing tests pass.
- [ ] I have checked that I reproduce the reference simulations or if there are differences they are explained below (if appropriate). If there are changes that are correct, I will update the reference simulation files after this PR is merged.
- [ ] I have checked (e.g., using the benchmarking tools) that this change does not significantly increase typical runtimes. If it does, I have included a justification in the comments on this PR.
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/master/CHANGELOG.md).
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/main/CHANGELOG.md).

New feature checklist:
- [ ] I have added or updated the docstrings associated with my feature using the [numpy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html).
Expand All @@ -40,7 +40,7 @@ New feature checklist:
- [ ] All new and existing tests pass.
- [ ] I have checked that I reproduce the reference simulations or if there are differences they are explained below (if appropriate). If there are changes that are correct, I will update the reference simulation files after this PR is merged.
- [ ] I have checked (e.g., using the benchmarking tools) that this change does not significantly increase typical runtimes. If it does, I have included a justification in the comments on this PR.
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/master/CHANGELOG.md).
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/main/CHANGELOG.md).

Breaking change checklist:
- [ ] I have updated the docstrings associated with my change using the [numpy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html).
Expand All @@ -50,19 +50,19 @@ Breaking change checklist:
- [ ] All new and existing tests pass.
- [ ] I have checked that I reproduce the reference simulations or if there are differences they are explained below (if appropriate). If there are changes that are correct, I will update the reference simulation files after this PR is merged.
- [ ] I have checked (e.g., using the benchmarking tools) that this change does not significantly increase typical runtimes. If it does, I have included a justification in the comments on this PR.
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/master/CHANGELOG.md).
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/main/CHANGELOG.md).

Reference simulation update or replacement:
- [ ] If this is a new reference simulation or if the settings files have changed, I have added all the relevant files to the reference_simulations folder.
- [ ] If this is a new reference simulation I have fully documented it in a memo in docs and updated any other docs as appropriate.
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/master/CHANGELOG.md).
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/main/CHANGELOG.md).

Documentation change checklist:
- [ ] Any updated docstrings use the [numpy docstring format](https://numpydoc.readthedocs.io/en/latest/format.html).
- [ ] If this is a significant change to the readme or other docs, I have checked that they are rendered properly on ReadTheDocs. (you may need help to get this branch to build on RTD, just ask!)

Version change checklist:
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/master/CHANGELOG.md) to put all the unreleased changes under the new version (leaving the unreleased section empty).
- [ ] I have updated the [CHANGELOG](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/blob/main/CHANGELOG.md) to put all the unreleased changes under the new version (leaving the unreleased section empty).
- [ ] I have run the appropriate tests for this level of version change (described in the readme under versioning).

Build or continuous integration change checklist:
Expand Down
45 changes: 21 additions & 24 deletions .github/workflows/testsuite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,54 +63,51 @@ jobs:
env_vars: OS,PYTHON
fail_ci_if_error: true

# Use pip for diversity
# do this on min_deps because it's hard to get mpi4py to install from pip
min_deps:
env:
ENV_NAME: min_deps
PYTHON: 3.9
PYTHON: "3.10"
name: Min Deps Testing
defaults:
run:
# Adding -l {0} helps ensure conda can be found properly.
shell: bash -l {0}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
fetch-depth: 1
- name: Setup Minimamba
uses: conda-incubator/setup-miniconda@v2
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: ${{ env.PYTHON }}
environment-file: ci/${{ env.ENV_NAME }}.yaml
activate-environment: ${{ env.ENV_NAME }}

- name: Conda Info
# need to install the testing packages but not the other optional ones
- name: Install
run: |
conda info -a
conda list
pip install coverage pytest pytest-cov pytest-xdist
pip install -e .

- name: Environment Info
run: |
pip list
PYVER=`python -c "import sys; print('{:d}.{:d}'.format(sys.version_info.major, sys.version_info.minor))"`
if [[ $PYVER != ${{ env.PYTHON }} ]]; then
exit 1;
fi

- name: Install
- name: Run Tests
run: |
pip install --no-deps .
python -m pytest -n auto --cov=pyuvsim --cov-config=.coveragerc --cov-report xml:./coverage.xml

- name: Run Tests
- name: check coverage report
run: |
python -m pytest -n auto --cov=pyuvsim --cov-config=.coveragerc --cov-report xml:./coverage.xml --junitxml=test-reports/xunit.xml
ls
cat coverage.xml
bhazelton marked this conversation as resolved.
Show resolved Hide resolved

- uses: codecov/codecov-action@v3
if: success()
with:
token: ${{secrets.CODECOV_TOKEN}} #required
file: ./coverage.xml #optional
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.xml #optional

min_versions:
env:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# pyuvsim

![](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/workflows/Tests/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/RadioAstronomySoftwareGroup/pyuvsim/branch/master/graph/badge.svg)](https://codecov.io/gh/RadioAstronomySoftwareGroup/pyuvsim)
![](https://github.com/RadioAstronomySoftwareGroup/pyuvsim/workflows/Tests/badge.svg?branch=main)
[![codecov](https://codecov.io/gh/RadioAstronomySoftwareGroup/pyuvsim/branch/main/graph/badge.svg)](https://codecov.io/gh/RadioAstronomySoftwareGroup/pyuvsim)

pyuvsim is a comprehensive simulation package for radio interferometers in python.

Expand Down
9 changes: 3 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
"sphinx.ext.intersphinx",
"sphinx_rtd_theme",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -79,12 +80,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
# html_theme = 'alabaster
html_theme = "default"
html_theme_options = {
"rightsidebar": "false",
"relbarbgcolor": "black"
}
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -166,6 +162,7 @@
napoleon_custom_sections = [("Attributes", "params_style")]
autodoc_typehints = 'signature'


def build_custom_docs(app):
sys.path.append(os.getcwd())
import make_index
Expand Down
4 changes: 2 additions & 2 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ More information on checking the reference simulations can be found in the READM

We will periodically issue a new set of reference simulations as ``pyuvsim`` gains more capabilities.

For more details, see `reference_simulations/README.md <https://github.com/RadioAstronomySoftwareGroup/pyuvsim/tree/master/reference_simulations>`_.
For more details, see `reference_simulations/README.md <https://github.com/RadioAstronomySoftwareGroup/pyuvsim/tree/main/reference_simulations>`_.

Benchmarking
------------
Expand All @@ -37,4 +37,4 @@ The README file in the ``benchmarking`` directory gives more details on how to d

Note that the benchmarking scripts are designed only for SLURM systems.

For more details, see `benchmarking/README.md <https://github.com/RadioAstronomySoftwareGroup/pyuvsim/tree/master/benchmarking>`_.
For more details, see `benchmarking/README.md <https://github.com/RadioAstronomySoftwareGroup/pyuvsim/tree/main/benchmarking>`_.
2 changes: 1 addition & 1 deletion pyuvsim/branch_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def branch_scheme(version): # pragma: nocover
if version.exact or version.node is None:
return version.format_choice("", "+d{time:{time_format}}", time_format="%Y%m%d")
else:
if version.branch == "master":
if version.branch == "main":
return version.format_choice("+{node}", "+{node}.dirty")
else:
return version.format_choice("+{node}.{branch}", "+{node}.{branch}.dirty")
25 changes: 19 additions & 6 deletions pyuvsim/tests/test_simsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,15 @@ def test_mock_diffuse_maps(modname, modkwargs, hera_loc, apollo_loc, location):
@pytest.mark.filterwarnings("ignore:The lst_array is not self-consistent")
@pytest.mark.filterwarnings("ignore:Telescope Triangle is not in known_telescopes.")
@pytest.mark.parametrize(
("horizon_buffer", "pass_time", "pass_uv", "return_catname"),
[(True, True, False, None), (False, False, True, False), (True, True, True, False)]
("horizon_buffer", "pass_time", "pass_array_loc", "pass_uv", "return_catname"),
[
(True, True, True, False, None),
(False, False, False, True, False),
(True, True, True, True, False)
]
)
def test_initialize_catalog_from_params(
horizon_buffer, pass_time, pass_uv, return_catname, hera_loc
horizon_buffer, pass_time, pass_array_loc, pass_uv, return_catname, hera_loc
):
# Pass in parameter dictionary as dict
uv_in = UVData.from_file(triangle_uvfits_file)
Expand All @@ -285,6 +289,11 @@ def test_initialize_catalog_from_params(
if horizon_buffer:
source_dict["horizon_buffer"] = 0.04364

if pass_array_loc:
source_dict["array_location"] = ",".join(
[str(coord) for coord in uv_in.telescope_location_lat_lon_alt_degrees]
)

warn_type = []
warn_str = []
if pass_time:
Expand All @@ -297,8 +306,9 @@ def test_initialize_catalog_from_params(
uv_use = uv_in
else:
uv_use = None
warn_type += [UserWarning]
warn_str += ["No array_location specified. Defaulting to the HERA site."]
if not pass_array_loc:
warn_type += [UserWarning]
warn_str += ["No array_location specified. Defaulting to the HERA site."]

if return_catname is None:
warn_type += [DeprecationWarning]
Expand Down Expand Up @@ -424,7 +434,8 @@ def test_gleam_catalog(filetype, flux_cut):


@pytest.mark.parametrize("use_filetype", [True, False])
def test_skyh5_catalog(use_filetype, tmp_path):
@pytest.mark.parametrize("yaml_filetype", [True, False])
def test_skyh5_catalog(use_filetype, yaml_filetype, tmp_path):
filetype = None
gleam_filename = os.path.join(
SIM_DATA_PATH, 'gleam_50srcs.vot'
Expand All @@ -447,6 +458,8 @@ def test_skyh5_catalog(use_filetype, tmp_path):
param_dict = yaml.safe_load(yf)

param_dict['sources']['catalog'] = skyh5_file
if yaml_filetype:
param_dict['sources']['filetype'] = "skyh5"
with open(param_filename, 'w') as yfile:
yaml.dump(param_dict, yfile, default_flow_style=False)

Expand Down
Loading