当前位置: 首页>>代码示例>>Python>>正文


Python DataBlock.filter方法代码示例

本文整理汇总了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()
开发者ID:arsenovic,项目名称:hftools,代码行数:17,代码来源:test_data_block.py

示例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")
开发者ID:arsenovic,项目名称:hftools,代码行数:28,代码来源:test_data_block.py

示例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])
开发者ID:arsenovic,项目名称:hftools,代码行数:12,代码来源:test_data_block.py


注:本文中的hftools.dataset.DataBlock.filter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。