Skip to content

Commit

Permalink
Merge pull request #226 from HERA-Team/pypi-release
Browse files Browse the repository at this point in the history
maint: remove all git repo deps
  • Loading branch information
steven-murray committed Jun 9, 2022
2 parents 563727e + 75af6f8 commit aa53575
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 38 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ Changelog
dev-version
===========

v2.3.4 [2022.06.08]
===================

Added
-----
- ``NotImplementedError`` raised when trying to simulate noise using an interpolated
sky temperature and phase-wrapped LSTs.
- More comparison tests of pyuvsim wrapper.

Fixed
-----
- Inferred integration time in ``ThermalNoise`` when phase-wrapped LSTs are used.
- Added **kwargs to ``PolyBeam.interp`` method to match UVBeam.
- Added ``**kwargs`` to ``PolyBeam.interp`` method to match UVBeam.
- healvis wrapper properly sets cross-pol visibilities to zero.

Changed
-------
Expand Down
8 changes: 4 additions & 4 deletions ci/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ dependencies:
- git
- pip:
- cached-property
- pyuvsim[sim]>=1.2,<1.4
- pyuvsim[sim]>=1.2
- vis_cpu>=0.2.2
- deprecation
- pyradiosky
- git+https://github.com/HERA-Team/uvtools.git
- uvtools
- git+https://github.com/rasg-affiliates/healvis
- git+https://github.com/HERA-Team/hera_cal.git
- git+https://github.com/HERA-Team/baseline_dependent_averaging.git
- hera-calibration
- bda
2 changes: 2 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
autosectionlabel_prefix_document = True
autosummary_generate = True

autodoc_mock_imports = ["healvis"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand Down
4 changes: 2 additions & 2 deletions hera_sim/adjustment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
HERA_CAL = True
except (ModuleNotFoundError, FileNotFoundError) as err: # pragma: no cover
if err is ModuleNotFoundError:
missing = "hera_cal"
missing = "hera-calibration"
else:
missing = "git"
warn(f"{missing} is not installed. Rephasing tool unavailable.")
Expand Down Expand Up @@ -669,7 +669,7 @@ def rephase_to_reference(
"""
if not HERA_CAL: # pragma: no cover
raise NotImplementedError(
"You must have ``hera_cal`` installed to use this function."
"You must have ``hera-calibration`` installed to use this function."
)

# Convert target to a HERAData object.
Expand Down
34 changes: 23 additions & 11 deletions hera_sim/tests/test_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from hera_sim import io
from hera_sim.visibilities import (
VisCPU,
HealVis,
VisibilitySimulation,
ModelData,
UVSim,
Expand All @@ -25,7 +24,14 @@
import copy
from pathlib import Path

SIMULATORS = (HealVis, VisCPU, UVSim)
SIMULATORS = (VisCPU, UVSim)

try:
from hera_sim.visibilities import HealVis

SIMULATORS = SIMULATORS + (HealVis,)
except ImportError:
pass

if HAVE_GPU:

Expand Down Expand Up @@ -111,6 +117,7 @@ def sky_modelJD(uvdataJD):


def test_healvis_beam(uvdata, sky_model):
pytest.importorskip("healvis")
sim = VisibilitySimulation(
simulator=HealVis(),
data_model=ModelData(
Expand All @@ -126,6 +133,7 @@ def test_healvis_beam(uvdata, sky_model):

def test_healvis_beam_obsparams(tmpdir):
# Now try creating with an obsparam file
pytest.importorskip("healvis")
direc = tmpdir.mkdir("test_healvis_beam")

with open(direc.join("catalog.txt"), "w") as fl:
Expand Down Expand Up @@ -210,6 +218,7 @@ def uvdata2():
array_layout={0: (0, 0, 0), 1: (1, 1, 0)},
start_time=2456658.5,
conjugation="ant1<ant2",
polarization_array=["xx", "yy", "xy", "yx"],
)


Expand Down Expand Up @@ -468,6 +477,7 @@ def align_src_to_healpix(ra, dec, nside=2**4):
return ra, dec


@pytest.mark.parametrize("simulator", SIMULATORS[1:])
@pytest.mark.parametrize(
"sky_model, beam_model",
[
Expand All @@ -478,22 +488,22 @@ def align_src_to_healpix(ra, dec, nside=2**4):
(half_sky_model, [AnalyticBeam("airy", diameter=1.75)]),
],
)
def test_comparison(uvdata2, sky_model, beam_model):
cpu = VisCPU()
healvis = HealVis()

def test_comparison(simulator, uvdata2, sky_model, beam_model):
model_data = ModelData(
uvdata=uvdata2, sky_model=sky_model(uvdata2), beams=beam_model
)

viscpu = VisibilitySimulation(data_model=model_data, simulator=cpu).simulate()
v0 = VisibilitySimulation(
data_model=model_data, simulator=SIMULATORS[0](), n_side=2**4
).simulate()

healvis = VisibilitySimulation(
data_model=model_data, simulator=healvis, n_side=2**4
v1 = VisibilitySimulation(
data_model=model_data, simulator=simulator(), n_side=2**4
).simulate()

assert viscpu.shape == healvis.shape
np.testing.assert_allclose(viscpu, healvis, rtol=0.05)
assert v0.shape == v1.shape

np.testing.assert_allclose(v0, v1, rtol=0.05)


def test_vis_cpu_pol_gpu(uvdata_linear):
Expand Down Expand Up @@ -662,13 +672,15 @@ def test_str_uvdata(uvdata, sky_model, tmp_path):


def test_bad_healvis_skymodel(sky_model):
pytest.importorskip("healvis")
hv = HealVis()
sky_model.stokes *= units.sr # something stupid
with pytest.raises(ValueError, match="not compatible with healvis"):
hv.get_sky_model(sky_model)


def test_mK_healvis_skymodel(sky_model):
pytest.importorskip("healvis")
hv = HealVis()
sky_model.stokes = sky_model.stokes.value * units.mK
sky_model.nside = 2**3
Expand Down
20 changes: 17 additions & 3 deletions hera_sim/visibilities/healvis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ def __init__(self, fov=180, nprocesses=1, sky_ref_chan=0):
if not HAVE_HEALVIS:
raise ImportError("to use the healvis wrapper, you must install healvis!")

warnings.warn(
(
"The healvis package is deprecated. Please use pyuvsim instead. "
"The healvis wrapper will be removed from hera_sim in version 4",
),
category=DeprecationWarning,
)

self.fov = fov
self._nprocs = nprocesses
self._sky_ref_chan = sky_ref_chan
Expand Down Expand Up @@ -155,9 +163,15 @@ def simulate(self, data_model: ModelData):

# Simulate the visibilities for each polarization.
for pol in data_model.uvdata.get_pols():
visibility, _, baselines = obs.make_visibilities(
sky, Nprocs=self._nprocs, beam_pol=pol
) # Shape (Nblts, Nskies, Nfreqs)
if pol in ["xx", "yy"]:
visibility, _, baselines = obs.make_visibilities(
sky, Nprocs=self._nprocs, beam_pol=pol
) # Shape (Nblts, Nskies, Nfreqs)
else:
# healvis doesn't support polarization
visibility = np.zeros(
(data_model.uvdata.Nblts, 1, data_model.uvdata.Nfreqs)
)

# AnalyticBeams do not use polarization at all in healvis, and are
# equivalent to "pI" polarization. To match our definition of linear pols
Expand Down
31 changes: 14 additions & 17 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,32 +54,31 @@ exclude =

[options.extras_require]
bda =
bda @ git+https://github.com/HERA-Team/baseline_dependent_averaging
bda
gpu =
hera_gpu @ git+https://github.com/hera-team/hera_gpu
pycuda
scikit-cuda
cal =
hera_cal @ git+https://github.com/hera-team/hera_cal
hera-calibration
docs =
sphinx>=1.8
nbsphinx
ipython
sphinx_autorun
numpydoc>=0.8
nbsphinx
vis_cpu>=0.4.1<1.0
healvis @ git+https://github.com/RASG-Affiliates/healvis
vis_cpu>=0.4.1
pyradiosky>=0.1.2
tests =
coverage>=4.5.1
pytest>=3.5.1
pytest-cov>=2.5.1
pre-commit
matplotlib>=3.4.2
uvtools @ git+https://github.com/HERA-Team/uvtools.git
hera_cal @ git+https://github.com/hera-team/hera_cal
healvis @ git+https://github.com/rasg-affiliates/healvis
bda @ git+https://github.com/HERA-Team/baseline_dependent_averaging.git
vis_cpu>=0.4.1<1.0
uvtools
hera-calibration
bda
vis_cpu>=0.4.1
dev =
sphinx>=1.8
numpydoc>=0.8.0
Expand All @@ -89,14 +88,12 @@ dev =
pytest>=3.5.1
pytest-cov>=2.5.1
pre-commit
uvtools @ git+https://github.com/HERA-Team/uvtools.git
healvis @ git+https://github.com/rasg-affiliates/healvis
hera_cal @ git+https://github.com/hera-team/hera_cal
bda @ git+https://github.com/HERA-Team/baseline_dependent_averaging.git
vis_cpu>=0.4.1<1.0
uvtools
hera-calibration
bda
vis_cpu>=0.4.1
vis =
vis_cpu>=0.4.1<1.0
healvis @ git+https://github.com/RASG-Affiliates/healvis
vis_cpu>=0.4.1
pyradiosky>=0.1.2
mpi4py

Expand Down

0 comments on commit aa53575

Please sign in to comment.