本文整理汇总了Python中hftools.dataset.DataBlock.filter方法的典型用法代码示例。如果您正苦于以下问题:Python DataBlock.filter方法的具体用法?Python DataBlock.filter怎么用?Python DataBlock.filter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hftools.dataset.DataBlock
的用法示例。
在下文中一共展示了DataBlock.filter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_intersection_1
# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import filter [as 别名]
def test_intersection_1(self):
d = DataBlock()
fi = DimSweep("Freq[Hz]", [10, 20, 30, 40, 50])
gi = DimSweep("g", 4)
dims = (fi, gi)
d["a"] = hfarray([[1, 2, 3, 4]] * 5, dims=dims,
outputformat="%.5f", unit="V")
x = DimSweep("Freq", [20, 40])
reset_hftools_warnings()
self.assertHFToolsWarning(d.filter, hfarray(x))
with warnings.catch_warnings() as log:
warnings.resetwarnings()
warnings.simplefilter("ignore", HFToolsWarning)
d.filter(hfarray(x))
reset_hftools_warnings()
示例2: test_1
# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import filter [as 别名]
def test_1(self):
d = DataBlock()
fi = DimSweep("Freq[Hz]", 3)
gi = DimSweep("g", 4)
dims = (fi,)
d["a"] = hfarray([1, 2, 3], dims=dims,
outputformat="%.5f", unit="V")
d["b"] = hfarray([10, 20, 30], dims=dims,
outputformat="%.7f", unit="A")
d["c"] = hfarray([10, 20, 30, 40], dims=(gi,),
outputformat="%.7f", unit="A")
w = d.filter(d["Freq[Hz]"] <= 1)
self.assertEqual(id(d.comments), id(w.comments))
self.assertEqual(w["Freq[Hz]"].dims, (DimSweep("Freq[Hz]", 2),))
self.assertEqual(w.a.dims, (DimSweep("Freq[Hz]", 2),))
self.assertEqual(w.b.dims, (DimSweep("Freq[Hz]", 2),))
self.assertEqual(w.c.dims, (DimSweep("g", 4),))
self.assertAllclose(w["Freq[Hz]"], [0, 1])
self.assertAllclose(w.a, [1, 2])
self.assertAllclose(w.b, [10, 20])
self.assertAllclose(w.c, [10, 20, 30, 40])
self.assertEqual(w.a.unit, "V")
self.assertEqual(w.b.unit, "A")
self.assertEqual(w.c.unit, "A")
示例3: test_intersection_2
# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import filter [as 别名]
def test_intersection_2(self):
d = DataBlock()
fi = DimSweep("Freq[Hz]", [10, 20, 30, 40, 50])
gi = DimSweep("g", 4)
dims = (fi, gi)
d["a"] = hfarray([[1, 2, 3, 4]] * 5, dims=dims,
outputformat="%.5f", unit="V")
x = DimSweep("Freq[Hz]", [20, 40])
dres = d.filter(hfarray(x))
self.assertAllclose(dres["Freq[Hz]"], [20, 40])