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


Python DataBlock.b方法代码示例

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


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

示例1: test_wrong_version_2

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
    def test_wrong_version_2(self):
        ia = DimSweep("a", 1, unit="")
        d1 = DataBlock()
        d1.b = hfarray([2], dims=(ia,))
        d2 = DataBlock()
        d2.b = hfarray([3], dims=(ia,))
        fname = testpath / "testdata/hdf5/v02/savetest/res_1.hdf5"

        with hdf5context(fname, mode="w") as fil:
            save_hdf5_v01(d1, fil)
            self.assertRaises(Exception, append_hdf5, d2, fil)
#            append_hdf5(d2, fil)
        fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:15,代码来源:test_hdf5_v02.py

示例2: test_cant_append

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_cant_append(self):
     i1 = DimSweep("a", 1, unit="s", outputformat="")
     i2 = DimSweep("INDEX", 2, unit="s")
     iexpand = DimRep("INDEX", 1, unit="s", outputformat="")
     d1 = DataBlock()
     d1.b = hfarray([2], dims=(i1,), outputformat="")
     d1.c = hfarray(3)
     d2 = DataBlock()
     d2.b = hfarray([3], dims=(i1,))
     fname = testpath / "testdata/hdf5/v02/savetest/res_1.hdf5"
     with hdf5context(fname, mode="w") as fil:
         savefun(d1, fil, expandable=True, expanddim=iexpand)
         self.assertRaises(ValueError, append_hdf5, d2, fil)
     fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:16,代码来源:test_hdf5_v02.py

示例3: test_8

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_8(self):
     d = DataBlock()
     d.b = hfarray([2], dims=(DimSweep("a", 1),))
     fname = testpath / "testdata/hdf5/v02/savetest/res_8.hdf5"
     with h5py.File(fname, mode="w") as fil:
         self.savefun[0](d, fil)
     fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:9,代码来源:test_hdf5_v02.py

示例4: test_1

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_1(self):
     i1 = DimSweep("a", 1, unit="s", outputformat="")
     i2 = DimSweep("INDEX", 2)
     d1 = DataBlock()
     d1.b = hfarray([2], dims=(i1,), outputformat="")
     d2 = DataBlock()
     d2.b = hfarray([3], dims=(i1,))
     fname = testpath / "testdata/hdf5/v02/savetest/res_1.hdf5"
     with hdf5context(fname, mode="w") as fil:
         savefun(d1, fil, expandable=True)
         append_hdf5(d2, fil)
     d = readfun(fname)
     self.assertAllclose(hfarray([[2, 3]], dims=(i1, i2)), d.b)
     self.assertEqual(d.ivardata["a"].unit, "s")
     self.assertEqual(d.ivardata["a"].outputformat, "%d")
     self.assertEqual(d.b.outputformat, "%d")
     fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:19,代码来源:test_hdf5_v02.py

示例5: test_2

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
    def test_2(self):
        d = DataBlock()
        d.comments = Comments(["Hej=10"])
#        import pdb;pdb.set_trace()
        d.b = hfarray([2], dims=(DimSweep("a", 1),))
        fname = testpath / "testdata/hdf5/v02/savetest/res_2.hdf5"
        self.savefun[0](d, fname)
        fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:10,代码来源:test_hdf5_v02.py

示例6: test_normalize_names_3

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_normalize_names_3(self):
     db = DataBlock()
     db.b = hfarray(1)
     db["a1/a2 raw"] = hfarray(1)
     db["a12"] = hfarray(2)
     res = common.normalize_names(db)
     self.assertTrue("a1/a2 raw" in res.vardata)
     self.assertTrue("a12" in res.vardata)
开发者ID:arsenovic,项目名称:hftools,代码行数:10,代码来源:test_common.py

示例7: test_10

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_10(self):
     d = DataBlock()
     d.blockname = "Foo"
     d.b = hfarray([2], dims=(DimSweep("a", 1), ), unit="V")
     fname = testpath / "testdata/hdf5/v01/savetest/res_10.hdf5"
     self.savefun[0](d, fname)
     d2 = readfun(fname)
     self.assertEqual(d2.blockname, "Foo")
     fname.unlink()
开发者ID:arsenovic,项目名称:hftools,代码行数:11,代码来源:test_hdf5_v01.py

示例8: test_9

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_9(self):
     d = DataBlock()
     d.comments = Comments(["Hej=10"])
     d.b = hfarray([2], dims=(DimSweep("a", 1), ), unit="V")
     fname = testpath / "testdata/hdf5/v01/savetest/res_9.hdf5"
     self.savefun[0](d, fname)
     d2 = readfun(fname)
     self.assertEqual(d2.b.unit, "V")
     fname.unlink()
开发者ID:arsenovic,项目名称:hftools,代码行数:11,代码来源:test_hdf5_v01.py

示例9: test_10

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
    def test_10(self):
        d = DataBlock()
        d.comments = Comments(["Hej=10"])
#        import pdb;pdb.set_trace()
        d.b = hfarray([2], dims=(DimSweep("a", 1), ), unit="V")
        d.b.outputformat = ""
        fname = testpath / "testdata/hdf5/v02/savetest/res_10.hdf5"
        self.savefun[0](d, fname)
        d2 = readfun(fname)
        self.assertEqual(d2.b.outputformat, "%d")

        fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:14,代码来源:test_hdf5_v02.py

示例10: test_1

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_1(self):
     d = DataBlock()
     d.b = hfarray([2], dims=(DimSweep("a", 1),))
     f1 = testpath / "testdata/sp-data/savetest/res_1.txt"
     f2 = testpath / "testdata/sp-data/savetest/facit_1.txt"
     hftools.file_formats.spdata.save_spdata(d, f1)
     with open(f1) as resfil:
         with open(f2) as facitfil:
             for idx, (rad1, rad2) in enumerate(zip(resfil, facitfil)):
                 msg = "\nFailed on line %d\n  result: %r\n  facit: %r"
                 args = (idx + 1, rad1, rad2)
                 self.assertEqual(rad1, rad2, msg=msg % args)
开发者ID:arsenovic,项目名称:hftools,代码行数:14,代码来源:test_spdata.py

示例11: test_11

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
    def test_11(self):
        ia = DimSweep("a", 1)
        d = DataBlock()
        d.comments = Comments(["Hej=10"])
#        import pdb;pdb.set_trace()
        d.b = hfarray([u"kalle"], dims=(ia, ), unit="V")
        d.c = hfarray(u"kalle")
        fname = testpath / "testdata/hdf5/v02/savetest/res_11.hdf5"
        self.savefun[0](d, fname)
        d2 = readfun(fname)
        self.assertEqual(d2.b[0], u"kalle")
        self.assertEqual(d2.c, u"kalle")
        fname.unlink()
开发者ID:extrakteon,项目名称:hftools-1,代码行数:15,代码来源:test_hdf5_v02.py

示例12: test_normalize_names_error

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_normalize_names_error(self):
     db = DataBlock()
     db.b = hfarray(1)
     db["Mean(A)"] = hfarray(1)
     db["A"] = hfarray(2)
     self.assertRaises(ValueError, common.normalize_names, db)
开发者ID:arsenovic,项目名称:hftools,代码行数:8,代码来源:test_common.py

示例13: test_normalize_names_2

# 需要导入模块: from hftools.dataset import DataBlock [as 别名]
# 或者: from hftools.dataset.DataBlock import b [as 别名]
 def test_normalize_names_2(self):
     db = DataBlock()
     db.b = hfarray(1)
     db["Mean(A)"] = hfarray(1)
     res = common.normalize_names(db)
     self.assertTrue("A" in res.vardata)
开发者ID:arsenovic,项目名称:hftools,代码行数:8,代码来源:test_common.py


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