本文整理汇总了Python中glue.core.roi.RectangularROI.update_limits方法的典型用法代码示例。如果您正苦于以下问题:Python RectangularROI.update_limits方法的具体用法?Python RectangularROI.update_limits怎么用?Python RectangularROI.update_limits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glue.core.roi.RectangularROI
的用法示例。
在下文中一共展示了RectangularROI.update_limits方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_spectrum
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_spectrum(self):
roi = RectangularROI()
roi.update_limits(0, 0, 3, 3)
expected = self.x[:, :3, :3].mean(axis=1).mean(axis=1)
_, actual = Extractor.spectrum(self.data, self.data.id["x"], roi, (0, "x", "y"), 0)
np.testing.assert_array_almost_equal(expected, actual)
示例2: test_collapse
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_collapse(self, tmpdir):
roi = RectangularROI()
roi.update_limits(0, 2, 0, 2)
self.tool._update_profile()
self._save(tmpdir)
示例3: test_apply_roi
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_apply_roi(self):
data = self.add_data_and_attributes()
roi = RectangularROI()
roi.update_limits(*self.roi_limits)
x, y = self.roi_points
self.client.apply_roi(roi)
assert self.layer_data_correct(data.edit_subset, x, y)
示例4: test_spectrum
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_spectrum(self):
roi = RectangularROI()
roi.update_limits(0.5, 1.5, 2.5, 2.5)
expected = self.x[:, 1:3, 2:3].mean(axis=1).mean(axis=1)
_, actual = Extractor.spectrum(
self.data, self.data.id['x'], roi, (0, 'x', 'y'), 0)
np.testing.assert_array_almost_equal(expected, actual)
示例5: test_apply_roi_results
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_apply_roi_results(self, roi_limits, mask):
# Regression test for glue-viz/glue#718
data = self.add_data_and_attributes()
roi = RectangularROI()
roi.update_limits(*roi_limits)
x, y = self.roi_points
self.client.apply_roi(roi)
np.testing.assert_equal(data.edit_subset.to_mask(), mask)
示例6: test_apply_roi_adds_on_empty
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_apply_roi_adds_on_empty(self):
data = self.add_data_and_attributes()
data._subsets = []
data.edit_subset = None
roi = RectangularROI()
roi.update_limits(*self.roi_limits)
x, y = self.roi_points
self.client.apply_roi(roi)
assert data.edit_subset is not None
示例7: test_extract
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_extract(self):
roi = RectangularROI()
roi.update_limits(0, 0, 2, 3)
expected = self.data['x'][:, :2, :3, 1].mean(axis=1).mean(axis=1)
_, actual = Extractor.spectrum(self.data, self.data.id['x'],
roi, (0, 'x', 'y', 1), 0)
np.testing.assert_array_equal(expected, actual)
示例8: test_visibility_sticky
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_visibility_sticky(self):
data = self.add_data_and_attributes()
roi = RectangularROI()
roi.update_limits(*self.roi_limits)
assert self.client.is_visible(data.edit_subset)
self.client.apply_roi(roi)
self.client.set_visible(data.edit_subset, False)
assert not self.client.is_visible(data.edit_subset)
self.client.apply_roi(roi)
assert not self.client.is_visible(data.edit_subset)
示例9: test_apply_roi_doesnt_add_if_any_selection
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_apply_roi_doesnt_add_if_any_selection(self):
d1 = self.add_data_and_attributes()
d2 = self.add_data()
d1.edit_subset = None
d2.edit_subset = d2.new_subset()
ct = len(d1.subsets)
roi = RectangularROI()
roi.update_limits(*self.roi_limits)
x, y = self.roi_points
self.client.apply_roi(roi)
assert len(d1.subsets) == ct
示例10: test_apply_roi_applies_to_all_editable_subsets
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_apply_roi_applies_to_all_editable_subsets(self):
d1 = self.add_data_and_attributes()
d2 = self.add_data()
state1 = d1.edit_subset.subset_state
state2 = d2.edit_subset.subset_state
roi = RectangularROI()
roi.update_limits(*self.roi_limits)
x, y = self.roi_points
self.client.apply_roi(roi)
assert d1.edit_subset.subset_state is not state1
assert d1.edit_subset.subset_state is not state2
示例11: test_4d_single_channel
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_4d_single_channel():
x = np.random.random((1, 7, 5, 9))
d = Data(x=x)
slc = (0, 0, 'x', 'y')
zaxis = 1
expected = x[0, :, :, :].mean(axis=1).mean(axis=1)
roi = RectangularROI()
roi.update_limits(0, 0, 10, 10)
_, actual = Extractor.spectrum(d, d.id['x'], roi, slc, zaxis)
np.testing.assert_array_almost_equal(expected, actual)
示例12: test_collapse
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def test_collapse(self, tmpdir):
roi = RectangularROI()
roi.update_limits(0, 2, 0, 2)
self.tool._update_profile()
self._save(tmpdir)
# For some reason we need to close and dereference the image and tool
# here (and not in teardown_method) otherwise we are left with
# references to the image viewer.
self.image.close()
self.image = None
self.tool.close()
self.tool = None
示例13: build_spectrum
# 需要导入模块: from glue.core.roi import RectangularROI [as 别名]
# 或者: from glue.core.roi.RectangularROI import update_limits [as 别名]
def build_spectrum(self):
roi = RectangularROI()
roi.update_limits(0, 2, 0, 2)
self.tool._update_profile()