From 50df9153b98f9ed9b73decfd8079b9fd8194714b Mon Sep 17 00:00:00 2001 From: Savannah Gramze Date: Mon, 7 Apr 2025 21:45:23 -0400 Subject: [PATCH 1/4] changed visual to have mpl kwargs --- astroquery/alma/utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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': From 815415affe377e5e28e4a71e8ab2e4560cd0ab25 Mon Sep 17 00:00:00 2001 From: Savannah Gramze Date: Mon, 7 Apr 2025 23:57:48 -0400 Subject: [PATCH 2/4] added test to make sure footprint_to_reg can make an artist --- astroquery/alma/tests/test_alma_utils.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/astroquery/alma/tests/test_alma_utils.py b/astroquery/alma/tests/test_alma_utils.py index b6757d601a..178936eff8 100644 --- a/astroquery/alma/tests/test_alma_utils.py +++ b/astroquery/alma/tests/test_alma_utils.py @@ -97,3 +97,18 @@ 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 = 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 \ No newline at end of file From baf7294ed64bd2878aff28bd088cfd515cb41fd6 Mon Sep 17 00:00:00 2001 From: Savannah Gramze Date: Tue, 8 Apr 2025 00:08:10 -0400 Subject: [PATCH 3/4] added changelog entry for changes to alma --- CHANGES.rst | 5 +++++ 1 file changed, 5 insertions(+) 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 ^^^^^^^ From 4c2caa2cd9f4010078d7b9fdb3be85df28051333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Tue, 8 Apr 2025 00:29:37 -0700 Subject: [PATCH 4/4] TST: fix namespace and pep8 in test --- astroquery/alma/tests/test_alma_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/astroquery/alma/tests/test_alma_utils.py b/astroquery/alma/tests/test_alma_utils.py index 178936eff8..7557f389b5 100644 --- a/astroquery/alma/tests/test_alma_utils.py +++ b/astroquery/alma/tests/test_alma_utils.py @@ -98,9 +98,10 @@ def test_footprint_to_reg_pointing(pointing_footprint_str=pointing_footprint_str 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 = footprint_to_reg(pointing_footprint_str) + reg_output = utils.footprint_to_reg(pointing_footprint_str) from astropy.wcs import WCS ww = WCS(naxis=2) @@ -111,4 +112,4 @@ def test_footprint_to_reg_plot(pointing_footprint_str=pointing_footprint_str): pix_region = reg_output[0].to_pixel(ww) artist = pix_region.as_artist() - assert artist is not None \ No newline at end of file + assert artist is not None