diff --git a/CHANGES.rst b/CHANGES.rst index 113b7793d8..a26fd53cc3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,6 +14,11 @@ API changes Service fixes and enhancements ------------------------------ +alma +^^^^ + +- Bug fix in ``footprint_to_reg`` that did not allow regions to be plotted. [#3285] + heasarc ^^^^^^^ diff --git a/astroquery/alma/tests/test_alma_utils.py b/astroquery/alma/tests/test_alma_utils.py index b6757d601a..7557f389b5 100644 --- a/astroquery/alma/tests/test_alma_utils.py +++ b/astroquery/alma/tests/test_alma_utils.py @@ -97,3 +97,19 @@ def test_footprint_to_reg_pointing(pointing_footprint_str=pointing_footprint_str assert actual_reg.center.ra == reg_output[0].center.ra assert actual_reg.center.dec == reg_output[0].center.dec assert actual_reg.radius == reg_output[0].radius + + +@pytest.mark.skipif(not HAS_REGIONS, reason="regions is required") +def test_footprint_to_reg_plot(pointing_footprint_str=pointing_footprint_str): + reg_output = utils.footprint_to_reg(pointing_footprint_str) + + from astropy.wcs import WCS + ww = WCS(naxis=2) + ww.wcs.crpix = [250.0, 250.0] + ww.wcs.cdelt = [-7.500000005754e-05, 7.500000005754e-05] + ww.wcs.ctype = ['RA---SIN', 'DEC--SIN'] + ww.wcs.crval = [reg_output[0].center.ra.value, reg_output[0].center.dec.value] + + pix_region = reg_output[0].to_pixel(ww) + artist = pix_region.as_artist() + assert artist is not None diff --git a/astroquery/alma/utils.py b/astroquery/alma/utils.py index a8a9a4c57e..994c22e81d 100644 --- a/astroquery/alma/utils.py +++ b/astroquery/alma/utils.py @@ -60,8 +60,7 @@ def footprint_to_reg(footprint): reglist = [] meta = {'source': 1, 'include': 1, 'fixed': 0, 'text': ''} - visual = {'color': 'green', 'dash': '0', 'dashlist': '8 3', - 'font': '"helvetica 10 normal roman"', 'width': '1'} + visual = {'color': 'green', 'linestyle': 'solid', 'linewidth': 1.0} entries = footprint.split() if entries[0] == 'Circle':