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


Python DataBlock.guess_units方法代码示例

本文整理汇总了Python中hftools.dataset.DataBlock.guess_units方法的典型用法代码示例。如果您正苦于以下问题:Python DataBlock.guess_units方法的具体用法?Python DataBlock.guess_units怎么用?Python DataBlock.guess_units使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hftools.dataset.DataBlock的用法示例。


在下文中一共展示了DataBlock.guess_units方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_5

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
    def test_5(self):
        d = DataBlock()
        d.comments = Comments(["Vgs=13", "Ig=14", "Datetime=2011-10-11 20:11:02",
                               "Vds=-13", "Calibration=SOLT"])
        fi = DimSweep("Freq", 3)
        gi = DimSweep("g", 4)
        d["Vds"] = hfarray([1, 2, 3], dims=(fi,))
        d["Id"] = hfarray([1, 2, 3, 4], dims=(gi,))
        d.comments.property["Ig"].unit = "mA"
        d.guess_units()
        d.values_from_property()

        self.assertEqual(d.Vds.unit, "V")
        self.assertAllclose(d.Vds, [1, 2, 3])
        self.assertEqual(d.Id.unit, "A")
        self.assertAllclose(d.Id, [1, 2, 3, 4])
        self.assertEqual(d.Freq.unit, "Hz")
        self.assertEqual(d.comments.property["Vgs"].unit, "V")
        self.assertEqual(d.comments.property["Ig"].unit, "mA")

        self.assertEqual(d.Ig, 14)
        self.assertEqual(d.Vgs, 13)
        self.assertEqual(d.Ig.unit, "mA")
        self.assertEqual(d.Vgs.unit, "V")
        self.assertTrue("Datetime" in d.allvarnames)
开发者ID:arsenovic,项目名称:hftools,代码行数:27,代码来源:test_data_block.py

示例2: test_4

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
    def test_4(self):
        d = DataBlock()
        fi = DimSweep("Freq", 3)
        gi = DimSweep("g", 4)
        d["Vds"] = hfarray([1, 2, 3], dims=(fi,))
        d["Id"] = hfarray([1, 2, 3, 4], dims=(gi,))
        d.guess_units(["Freq", "Vds", "Ig"])

        self.assertEqual(d.Vds.unit, "V")
        self.assertAllclose(d.Vds, [1, 2, 3])
        self.assertEqual(d.Id.unit, None)
        self.assertAllclose(d.Id, [1, 2, 3, 4])
        self.assertEqual(d.Freq.unit, "Hz")
开发者ID:arsenovic,项目名称:hftools,代码行数:15,代码来源:test_data_block.py

示例3: test_2

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
    def test_2(self):
        d = DataBlock()
        fi = DimSweep("Freq", 3, unit="m")
        gi = DimSweep("g", 4)
        d["Vds"] = hfarray([1, 2, 3], dims=(fi,), unit="A")
        d["Id"] = hfarray([1, 2, 3, 4], dims=(gi,), unit="V")
        d.guess_units()

        self.assertEqual(d.Vds.unit, "A")
        self.assertAllclose(d.Vds, [1, 2, 3])
        self.assertEqual(d.Id.unit, "V")
        self.assertAllclose(d.Id, [1, 2, 3, 4])
        self.assertEqual(d.Freq.unit, "m")
开发者ID:arsenovic,项目名称:hftools,代码行数:15,代码来源:test_data_block.py

示例4: test_1

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
    def test_1(self):
        d = DataBlock()
        fi = DimSweep("Freq", 3)
        gi = DimSweep("g", 4)
        d["Vds"] = hfarray([1, 2, 3], dims=(fi,))
        d["Id"] = hfarray([1, 2, 3, 4], dims=(gi,))
        d.guess_units()
        d.values_from_property()

        self.assertEqual(d.Vds.unit, "V")
        self.assertAllclose(d.Vds, [1, 2, 3])
        self.assertEqual(d.Id.unit, "A")
        self.assertAllclose(d.Id, [1, 2, 3, 4])
        self.assertEqual(d.Freq.unit, "Hz")
开发者ID:arsenovic,项目名称:hftools,代码行数:16,代码来源:test_data_block.py

示例5: Test_DataBlock

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
class Test_DataBlock(TestCase):
    def setUp(self):
        self.a = DataBlock()

    def test_report(self):
        self.a.report()

    def test_str(self):
        self.assertEqual(self.a.report(), str(self.a))

    def test_guess_1(self):
        self.assertIsNone(self.a.guess_units(False))
开发者ID:arsenovic,项目名称:hftools,代码行数:14,代码来源:test_data_block.py

示例6: Test_yield_dim_consistent_datablocks

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import guess_units [as 别名]
        out = dset.convert_matrices_to_elements(self.db, formatelement)
        self.assertTrue("V" in out)
        self.assertTrue("S11" in out)
        self.assertTrue("S12" in out)
        self.assertTrue("S21" in out)
        self.assertTrue("S22" in out)
        self.assertTrue("Y" in out)


class Test_yield_dim_consistent_datablocks(TestCase):
    def setUp(self):
        self.db = db = DataBlock()
        Sdims = (DimRep("freq", [1, 2]) ,DimRep("r", [1]), DimMatrix_i("i", 2), DimMatrix_j("j", 2))
        db.S = hfarray(np.array([[11, 12], [21, 22]])[np.newaxis, np.newaxis, :, :] * np.array([[10], [20]])[..., np.newaxis, np.newaxis], dims=Sdims)
        db.V = hfarray([1.23], Sdims[1:2])
        db.Y = hfarray([1.23], (DimRep("k", [1]),))

    def test1(self):
        res = list(dset.yield_dim_consistent_datablocks(dset.convert_matrices_to_elements(self.db)))
        self.assertTrue(len(res) == 2)


if __name__ == '__main__':
        d = DataBlock()
        d.comments = Comments(["Vgs=10", "Ig=10"])
        fi = DimSweep("Freq[GHz]", 3)
        gi = DimSweep("g", 4)
        d["Vds"] = hfarray([1, 2, 3], dims=(fi,))
        d["Id"] = hfarray([1, 2, 3, 4], dims=(gi,))
        d.guess_units()
开发者ID:arsenovic,项目名称:hftools,代码行数:32,代码来源:test_data_block.py


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