Skip to content

Commit

Permalink
Restore PIXEL_RANGE_THRESHOLD for tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Jan 24, 2024
1 parent 008d455 commit ae3d7cb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_pixel_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def test_update_values_pixel_ranges(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand Down Expand Up @@ -71,10 +73,14 @@ def _none_checker(_m1, _m2, start, stop, cov_mask):
# None value: narrow range, no overlap.
_none_checker(m1, m2, 200000, 200010, cov_mask)

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold

def test_update_values_pixel_ranges_empty(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand All @@ -86,10 +92,14 @@ def test_update_values_pixel_ranges_empty(self):

self.assertEqual(m1.n_valid, 0)

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold

def test_update_values_pixel_ranges_or(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand Down Expand Up @@ -128,10 +138,14 @@ def test_update_values_pixel_ranges_or(self):
testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels)
testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels])

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold

def test_update_values_pixel_ranges_and(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand Down Expand Up @@ -170,10 +184,14 @@ def test_update_values_pixel_ranges_and(self):
testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels)
testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels])

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold

def test_update_values_pixel_ranges_add(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand Down Expand Up @@ -206,10 +224,14 @@ def test_update_values_pixel_ranges_add(self):
testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels)
testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels])

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold

def test_set_bits_pix_pixel_ranges(self):
nside_coverage = 32
nside_map = 256

orig_threshold = healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD

# Monkey-patch PIXEL_RANGE_THRESHOLD for testing.
healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = 0

Expand All @@ -232,6 +254,8 @@ def test_set_bits_pix_pixel_ranges(self):
testing.assert_array_equal(m1.valid_pixels, m2.valid_pixels)
testing.assert_array_equal(m1[m1.valid_pixels], m2[m2.valid_pixels])

healsparse.healSparseMap.PIXEL_RANGE_THRESHOLD = orig_threshold


if __name__ == '__main__':
unittest.main()

0 comments on commit ae3d7cb

Please sign in to comment.