diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c8cc4112..e61d2777 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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). @@ -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). @@ -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: diff --git a/.github/workflows/testsuite.yaml b/.github/workflows/testsuite.yaml index 5b53ac8c..f32317bd 100644 --- a/.github/workflows/testsuite.yaml +++ b/.github/workflows/testsuite.yaml @@ -8,7 +8,7 @@ concurrency: jobs: tests: env: - ENV_NAME: pyuvsim_tests + ENV_NAME: ${{ matrix.env_name }} PYTHON: ${{ matrix.python-version }} OS: ${{ matrix.os }} name: Testing @@ -22,6 +22,14 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] python-version: [3.8, 3.9, "3.10", "3.11"] + env_name: [pyuvsim_tests_openmpi] + include: + - env_name: pyuvsim_tests_mpich + python-version: "3.11" + os: ubuntu-latest + - env_name: pyuvsim_tests_mpich + python-version: "3.11" + os: macos-latest steps: - uses: actions/checkout@main with: @@ -63,54 +71,46 @@ 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 - run: | - pip install --no-deps . - - name: Run Tests run: | - python -m pytest -n auto --cov=pyuvsim --cov-config=.coveragerc --cov-report xml:./coverage.xml --junitxml=test-reports/xunit.xml + python -m pytest -n auto --cov=pyuvsim --cov-config=.coveragerc --cov-report xml:./coverage.xml - 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: @@ -163,7 +163,7 @@ jobs: warning_test: env: - ENV_NAME: pyuvsim_tests + ENV_NAME: pyuvsim_tests_mpich PYTHON: 3.9 name: Warning Test runs-on: ubuntu-latest diff --git a/README.md b/README.md index c5f7d9fd..6d5e4f83 100644 --- a/README.md +++ b/README.md @@ -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. @@ -63,7 +63,7 @@ By default, `mpi` capabilities are not enabled -- many of the utilities provided in `pyuvsim` do not require it. To use the simulator within `pyuvsim`, you should install `pyuvsim` with `pip install pyuvsim[sim]`. Note that the `pyuvsim` simulator is intended to run on clusters running the linux operating -system, but we do test against Mac OSX as well. +system, but we test against Mac OSX as well. We test against both Open MPI and MPICH. There are a few more optional dependencies for `pyuvsim` which enable some features, such as `astropy_healpix` to use healpix based sky catalogs or healpix beams, diff --git a/ci/pyuvsim_tests.yaml b/ci/pyuvsim_tests_mpich.yaml similarity index 92% rename from ci/pyuvsim_tests.yaml rename to ci/pyuvsim_tests_mpich.yaml index dffed84a..c174a60d 100644 --- a/ci/pyuvsim_tests.yaml +++ b/ci/pyuvsim_tests_mpich.yaml @@ -1,4 +1,4 @@ -name: pyuvsim_tests +name: pyuvsim_tests_mpich channels: - conda-forge - defaults @@ -7,6 +7,7 @@ dependencies: - astropy-healpix>=0.6 - coverage - line_profiler + - mpich - mpi4py>=3.0.0 - numpy>=1.20 - pip diff --git a/ci/pyuvsim_tests_openmpi.yaml b/ci/pyuvsim_tests_openmpi.yaml new file mode 100644 index 00000000..f44753de --- /dev/null +++ b/ci/pyuvsim_tests_openmpi.yaml @@ -0,0 +1,26 @@ +name: pyuvsim_tests_openmpi +channels: + - conda-forge + - defaults +dependencies: + - astropy>=5.2 + - astropy-healpix>=0.6 + - coverage + - line_profiler + - mpi4py>=3.0.0 + - numpy>=1.20 + - openmpi + - pip + - psutil + - python-casacore>=3.3 + - pytest + - pytest-cov + - pytest-xdist + - pyuvdata>=2.2.10 + - pyyaml>=5.1 + - scipy>=1.3 + - setuptools_scm>=7.0.3 + - pip: + - pyradiosky>=0.2 + - lunarsky>=0.2.1 + - git+https://github.com/aelanman/analytic_diffuse diff --git a/docs/conf.py b/docs/conf.py index 3570f416..95133b8b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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. @@ -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 @@ -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 diff --git a/docs/developers.rst b/docs/developers.rst index f888e52b..6e19c5b2 100644 --- a/docs/developers.rst +++ b/docs/developers.rst @@ -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 `_. +For more details, see `reference_simulations/README.md `_. Benchmarking ------------ @@ -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 `_. +For more details, see `benchmarking/README.md `_. diff --git a/docs/parameter_files.rst b/docs/parameter_files.rst index 165a2485..0579c36b 100644 --- a/docs/parameter_files.rst +++ b/docs/parameter_files.rst @@ -255,7 +255,10 @@ Sources ^^^^^^^ Specify the path to a catalog file via ``catalog``. The path can be given as an absolute path or relative to the location of the obsparam. This catalog can be any - file type that is readable with ``pyradiosky``. + file type that is readable with ``pyradiosky``. pyradiosky's SkyModel + (`SkyModel `__) + supports a wide range of catalogs, including point sources and diffuse maps + and multiple spectral models. An example text catalog file: diff --git a/pyuvsim/branch_scheme.py b/pyuvsim/branch_scheme.py index a9f396af..3a73b5f3 100644 --- a/pyuvsim/branch_scheme.py +++ b/pyuvsim/branch_scheme.py @@ -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") diff --git a/pyuvsim/tests/test_simsetup.py b/pyuvsim/tests/test_simsetup.py index ad63cd41..ae81e678 100644 --- a/pyuvsim/tests/test_simsetup.py +++ b/pyuvsim/tests/test_simsetup.py @@ -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) @@ -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: @@ -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] @@ -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' @@ -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)