Skip to content

Commit

Permalink
Added a test of subset selection with unit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog committed Jan 26, 2023
1 parent b2a310a commit 8d9c315
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions glue/viewers/profile/qt/tests/test_data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,15 @@ def test_unit_conversion():
assert viewer.state.y_min == 1.
assert viewer.state.y_max == 3.

roi = XRangeROI(1.4e9, 2.1e9)
viewer.apply_roi(roi)

assert len(d1.subsets) == 1
assert_equal(d1.subsets[0].to_mask(), [0, 1, 0])

assert len(d2.subsets) == 1
assert_equal(d2.subsets[0].to_mask(), [0, 1, 0])

viewer.state.x_display_unit = 'GHz'
viewer.state.y_display_unit = 'mJy'

Expand All @@ -391,3 +400,12 @@ def test_unit_conversion():
assert viewer.state.x_max == 3.
assert viewer.state.y_min == 1000.
assert viewer.state.y_max == 3000.

roi = XRangeROI(0.5, 1.2)
viewer.apply_roi(roi)

assert len(d1.subsets) == 1
assert_equal(d1.subsets[0].to_mask(), [1, 0, 0])

assert len(d2.subsets) == 1
assert_equal(d2.subsets[0].to_mask(), [0, 0, 1])

0 comments on commit 8d9c315

Please sign in to comment.