本文整理汇总了Python中glue.core.data.Data.update_id方法的典型用法代码示例。如果您正苦于以下问题:Python Data.update_id方法的具体用法?Python Data.update_id怎么用?Python Data.update_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类glue.core.data.Data
的用法示例。
在下文中一共展示了Data.update_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestHistogramClient
# 需要导入模块: from glue.core.data import Data [as 别名]
# 或者: from glue.core.data.Data import update_id [as 别名]
#.........这里部分代码省略.........
self.client.set_component(self.data.components[1])
self.client.xlimits = 7, 8
self.client.set_component(self.data.components[0])
assert self.client.xlimits == (5, 6)
self.client.set_component(self.data.components[1])
assert self.client.xlimits == (7, 8)
def test_default_xlimits(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.id['x'])
assert self.client.xlimits == (0, 20)
self.client.set_component(self.data.id['y'])
assert self.client.xlimits == (-7, -1)
def test_xlimit_single_set(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.id['x'])
self.client.xlimits = (None, 5)
assert self.client.xlimits == (0, 5)
self.client.xlimits = (3, None)
assert self.client.xlimits == (3, 5)
def test_xlimit_reverse_set(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.id['x'])
self.client.xlimits = 5, 3
assert self.client.xlimits == (3, 5)
def test_xlog_axes_labels(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.id['x'])
self.client.xlog = True
assert self.client.axes.get_xlabel() == 'Log x'
self.client.xlog = False
assert self.client.axes.get_xlabel() == 'x'
self.client.ylog = True
assert self.client.axes.get_ylabel() == 'N'
self.client.ylog = False
assert self.client.axes.get_ylabel() == 'N'
def test_xlog_snaps_limits(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.id['x'])
self.client.axes.set_xlim((-1, 1))
self.client.xlog = True
assert self.client.axes.get_xlim() != (-1, 1)
def test_artist_clear_resets_arrays(self):
self.client.add_layer(self.data)
self.client.set_component(self.data.components[0])
for a in self.client._artists[self.data]:
assert a.get_data()[0].size > 0
a.clear()
assert a.get_data()[0].size == 0
def test_component_replaced(self):
# regression test for 508
self.client.register_to_hub(self.collect.hub)
self.client.add_layer(self.data)
self.client.component = self.data.components[0]
test = ComponentID('test')
self.data.update_id(self.client.component, test)
assert self.client.component is test
def test_update_when_limits_unchanged(self):
# Regression test for glue-viz/glue#1010 - this bug caused histograms
# to not be recomputed if the attribute changed but the limits and
# number of bins did not.
self.client.add_layer(self.data)
self.client.set_component(self.data.id['y'])
self.client.xlimits = -20, 20
self.client.nbins = 12
y1 = self.client._artists[0]._y
self.client.set_component(self.data.id['x'])
self.client.xlimits = -20, 20
self.client.nbins = 12
y2 = self.client._artists[0]._y
assert not np.allclose(y1, y2)
self.client.set_component(self.data.id['y'])
y3 = self.client._artists[0]._y
np.testing.assert_allclose(y1, y3)