Skip to content

Commit

Permalink
Merge pull request spacetelescope#2589 from pllim/fix-ann-reg-test
Browse files Browse the repository at this point in the history
TST: Fix ds9_annulus_01.reg test case
  • Loading branch information
pllim committed Dec 9, 2023
1 parent 96b691a commit 1a98ab7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion jdaviz/configs/imviz/tests/test_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from astropy import units as u
from astropy.coordinates import SkyCoord, Angle
from astropy.utils.data import get_pkg_data_filename
from numpy.testing import assert_allclose
from photutils.aperture import CircularAperture, SkyCircularAperture
from regions import (PixCoord, CircleSkyRegion, RectanglePixelRegion, CirclePixelRegion,
EllipsePixelRegion, PointSkyRegion, PolygonPixelRegion,
Expand Down Expand Up @@ -154,11 +155,16 @@ def test_regions_annulus_from_load_data(self):
self.imviz.load_data(regfile)
assert len(self.imviz.app.data_collection) == 2 # Make sure not loaded as data

# Test data is set up such that 1 pixel is 1 arcsec.
subset_radii = {"Subset 1": [0.5, 1], "Subset 2": [1, 3]}

subsets = self.imviz.get_interactive_regions()
subset_names = list(subsets.keys())
subset_names = sorted(subsets.keys())
assert subset_names == ['Subset 1', 'Subset 2']
for n in subset_names:
assert isinstance(subsets[n], CircleAnnulusPixelRegion)
assert_allclose(subsets[n].center.xy, 4.5, rtol=5e-6)
assert_allclose([subsets[n].inner_radius, subsets[n].outer_radius], subset_radii[n])

def test_photutils_pixel(self):
my_aper = CircularAperture((5, 5), r=2)
Expand Down

0 comments on commit 1a98ab7

Please sign in to comment.