Skip to content

Changed visual to have mpl kwargs for Alma #3285

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

Merged
merged 4 commits into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
^^^^^^^

Expand Down
16 changes: 16 additions & 0 deletions astroquery/alma/tests/test_alma_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions astroquery/alma/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down
Loading