• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utilstest.UtilsTest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utilstest.UtilsTest的典型用法代码示例。如果您正苦于以下问题:Python UtilsTest类的具体用法?Python UtilsTest怎么用?Python UtilsTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: download_images

def download_images():
    """
    Download all test images and
    """
    root_dir = os.path.dirname(os.path.abspath(__file__))
    test_dir = os.path.join(root_dir, PROJECT, "test")
    sys.path.insert(0, test_dir)
    from utilstest import UtilsTest
    image_home = os.path.join(root_dir, "testimages")
    testimages = os.path.join(root_dir, "all_testimages.json")
    UtilsTest.image_home = image_home
    UtilsTest.testimages = testimages
    if os.path.exists(testimages):
        import json
        with open(testimages) as f:
            all_files = set(json.load(f))
    else:
        raise(RuntimeError("Please run 'python setup.py build test' to download all images"))
    for afile in all_files.copy():
        if afile.endswith(".bz2"):
            all_files.add(afile[:-4] + ".gz")
            all_files.add(afile[:-4])
        elif afile.endswith(".gz"):
            all_files.add(afile[:-3] + ".bz2")
            all_files.add(afile[:-3])
        else:
            all_files.add(afile + ".gz")
            all_files.add(afile + ".bz2")
    UtilsTest.download_images(all_files)
    return list(all_files)
开发者ID:marzlia,项目名称:fabio,代码行数:30,代码来源:setup.py


示例2: setUp

 def setUp(self):
     """Download files"""
     self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
     self.halfFrelon = UtilsTest.getimage(self.__class__.halfFrelon)
     self.splineFile = UtilsTest.getimage(self.__class__.splineFile)
     poniFile = UtilsTest.getimage(self.__class__.poniFile)
     with open(poniFile) as f:
         data = []
         for line in f:
             if line.startswith("SplineFile:"):
                 data.append("SplineFile: " + self.splineFile)
             else:
                 data.append(line.strip())
     self.poniFile = os.path.join(self.tmp_dir, os.path.basename(poniFile))
     with open(self.poniFile, "w") as f:
         f.write(os.linesep.join(data))
     self.fit2d = numpy.loadtxt(self.fit2dFile)
     self.ai = AzimuthalIntegrator()
     self.ai.load(self.poniFile)
     self.data = fabio.open(self.halfFrelon).data
     if not os.path.isdir(self.tmp_dir):
         os.makedirs(self.tmp_dir)
     for tmpfile in self.tmpfiles.values():
         if os.path.isfile(tmpfile):
             os.unlink(tmpfile)
开发者ID:tonnrueter,项目名称:pyFAI,代码行数:25,代码来源:testAzimuthalIntegrator.py


示例3: setUp

 def setUp(self):
     """Download files"""
     self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
     self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
     self.ai = pyFAI.load(self.poniFile)
     self.data = fabio.open(self.dataFile).data
     self.mask = self.data < 0
开发者ID:blackw1ng,项目名称:pyFAI,代码行数:7,代码来源:testMask.py


示例4: setUp

 def setUp(self):
     """Download files"""
     self.fit2dFile = UtilsTest.getimage(self.__class__.fit2d_cor)
     self.halfFrelon = UtilsTest.getimage(self.__class__.halfFrelon)
     self.splineFile = UtilsTest.getimage(self.__class__.splineFile)
     self.det = detectors.FReLoN(self.splineFile)
     self.dis = _distortion.Distortion(self.det)
     self.fit2d = fabio.open(self.fit2dFile).data
     self.raw = fabio.open(self.halfFrelon).data
开发者ID:GiannisA,项目名称:pyFAI,代码行数:9,代码来源:testDistortion.py


示例5: download_images

def download_images():
    """
    Download all test images and
    """
    test_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test")
    sys.path.insert(0, test_dir)
    from utilstest import UtilsTest
    UtilsTest.download_images()
    return list(UtilsTest.ALL_DOWNLOADED_FILES)
开发者ID:lukasHD,项目名称:pyFAI,代码行数:9,代码来源:setup.py


示例6: setUp

 def setUp(self):
     """Download files"""
     self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
     self.pilatusFile = UtilsTest.getimage(self.__class__.pilatusFile)
     self.tth_fit2d, self.I_fit2d = numpy.loadtxt(self.fit2dFile, unpack=True)
     self.ai = pyFAI.AzimuthalIntegrator(dist=1.994993e-01,
                                   poni1=2.143248e-01,
                                   poni2=2.133315e-01,
                                   rot1=0.007823,
                                   rot2=0.006716,
                                   rot3=0,
                                   pixel1=172e-6,
                                   pixel2=172e-6)
     self.data = fabio.open(self.pilatusFile).data
     self.data[self.data < 0] = 0 #discard negative pixels
开发者ID:mik854e,项目名称:pyFAI,代码行数:15,代码来源:testGeometry.py


示例7: setUp

 def setUp(self):
     """Download files"""
     self.fn = {}
     for i in ["i01f0001.kcd", "i01f0001.edf"]:
         self.fn[i] = UtilsTest.getimage(i + ".bz2")[:-4]
     for i in self.fn:
         assert os.path.exists(self.fn[i])
开发者ID:ddale,项目名称:fabio,代码行数:7,代码来源:testkcdimage.py


示例8: setUp

    def setUp(self):
        """
        download images
        """

        self.im_dir = os.path.dirname(UtilsTest.getimage("Cr8F8140k103.0026.bz2"))
        self.tempdir = tempfile.mkdtemp()
开发者ID:GiannisA,项目名称:fabio,代码行数:7,代码来源:testbrukerimage.py


示例9: setUp

 def setUp(self):
     self.fn = {}
     for i in ["b191_1_9_1.img", "b191_1_9_1_uncompressed.img"]:
         self.fn[i] = UtilsTest.getimage(i + ".bz2")[:-4]
     for i in self.fn:
         assert os.path.exists(self.fn[i])
     self.tempdir = tempfile.mkdtemp()
开发者ID:ddale,项目名称:fabio,代码行数:7,代码来源:testOXDimage.py


示例10: setUp

 def setUp(self):
     """Download files"""
     self.fn = {}
     for j in self.results.split("\n"):
         i = j.split()[0]
         self.fn[i] = UtilsTest.getimage(i + ".bz2")[:-4]
     for i in self.fn:
         assert os.path.exists(self.fn[i])
开发者ID:ddale,项目名称:fabio,代码行数:8,代码来源:testpnmimage.py


示例11: setUp

 def setUp(self):
     self.fn = {}
     for i in ["corkcont2_H_0089.mccd", "somedata_0001.mccd"]:
         self.fn[i] = UtilsTest.getimage(i + ".bz2")[:-4]
         self.fn[i + ".bz2"] = self.fn[i] + ".bz2"
         self.fn[i + ".gz"] = self.fn[i] + ".gz"
     for i in self.fn:
         assert os.path.exists(self.fn[i])
开发者ID:GiannisA,项目名称:fabio,代码行数:8,代码来源:testmccdimage.py


示例12: setUp

 def setUp(self):
     """Download files"""
     self.img = UtilsTest.getimage(self.__class__.calibFile)
     self.pp = PeakPicker(self.img, dSpacing=self.ds, wavelength=self.wavelength)
     dirname = os.path.dirname(os.path.abspath(__file__))
     self.tmpdir = os.path.join(dirname, "tmp")
     if not os.path.isdir(self.tmpdir):
         os.mkdir(self.tmpdir)
开发者ID:sameera2004,项目名称:pyFAI,代码行数:8,代码来源:testPeakPicking.py


示例13: setUp

 def setUp(self):
     """Download files"""
     self.img = UtilsTest.getimage(self.__class__.calibFile)
     self.pp = PeakPicker(self.img, dSpacing=self.ds, wavelength=self.wavelength)
     if not os.path.isdir(self.tmp_dir):
         os.makedirs(self.tmp_dir)
     if os.path.isfile(self.logfile):
         os.unlink(self.logfile)
     if os.path.isfile(self.nptfile):
         os.unlink(self.nptfile)
开发者ID:tonnrueter,项目名称:pyFAI,代码行数:10,代码来源:testPeakPicking.py


示例14: setUp

 def setUp(self):
     self.multiFrameFilename = UtilsTest.getimage("MultiFrame.edf.bz2")[:-4]
     self.Frame0Filename = UtilsTest.getimage("MultiFrame-Frame0.edf.bz2")[:-4]
     self.Frame1Filename = UtilsTest.getimage("MultiFrame-Frame1.edf.bz2")[:-4]
     self.ref = edfimage()
     self.frame0 = edfimage()
     self.frame1 = edfimage()
     try:
         self.ref.read(self.multiFrameFilename)
     except:
         raise RuntimeError("Cannot read image multiFrameFilename image %s" % self.multiFrameFilename)
     try:
         self.frame0.read(self.Frame0Filename)
     except:
         raise RuntimeError("Cannot read image Frame0File image %s" % self.Frame0File)
     try:
         self.frame1.read(self.Frame1Filename)
     except:
         raise RuntimeError("Cannot read image Frame1File image %s" % self.Frame1File)
开发者ID:GiannisA,项目名称:fabio,代码行数:19,代码来源:testedfimage.py


示例15: download_images

def download_images():
    """
    Download all test images and
    """
    test_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test")
    sys.path.insert(0, test_dir)
    from utilstest import UtilsTest
    for afile in UtilsTest.ALL_DOWNLOADED_FILES.copy():
        if afile.endswith(".bz2"):
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-4] + ".gz")
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-4])
        elif afile.endswith(".gz"):
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-3] + ".bz2")
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile[:-3])
        else:
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile + ".gz")
            UtilsTest.ALL_DOWNLOADED_FILES.add(afile + ".bz2")
    UtilsTest.download_images()
    return list(UtilsTest.ALL_DOWNLOADED_FILES)
开发者ID:payno,项目名称:fabio,代码行数:19,代码来源:setup.py


示例16: setUp

 def setUp(self):
     """
     Download files 
     Create a mask for tth<3.7 deg
     """
     self.dataFile = UtilsTest.getimage(self.__class__.dataFile)
     detector = pyFAI.detectors.Detector(pixel1=0.0001, pixel2=0.0001)
     self.ai = pyFAI.AzimuthalIntegrator(dist=0.1, poni1=0.03, poni2=0.03, detector=detector)
     self.data = fabio.open(self.dataFile).data
     self.tth, self.I = self.ai.integrate1d(self.data, 1000, unit="2th_deg")
     self.mask = self.ai.ttha < numpy.deg2rad(3.7)
开发者ID:GiannisA,项目名称:pyFAI,代码行数:11,代码来源:test_mask.py


示例17: setUp

 def setUp(self):
     """Download files"""
     self.fit2dFile = UtilsTest.getimage(self.__class__.fit2dFile)
     self.halfFrelon = UtilsTest.getimage(self.__class__.halfFrelon)
     self.splineFile = UtilsTest.getimage(self.__class__.splineFile)
     self.poniFile = UtilsTest.getimage(self.__class__.poniFile)
     with open(self.poniFile) as f:
         data = []
         for line in f:
             if line.startswith("SplineFile:"):
                 data.append("SplineFile: " + self.splineFile)
             else:
                 data.append(line.strip())
     with open(self.poniFile, "w") as f:
         f.write(os.linesep.join(data))
     self.fit2d = numpy.loadtxt(self.fit2dFile)
     self.ai = AzimuthalIntegrator()
     self.ai.load(self.poniFile)
     self.data = fabio.open(self.halfFrelon).data
     if not os.path.isdir("tmp"):
         os.mkdir("tmp")
开发者ID:barberie,项目名称:pyFAI,代码行数:21,代码来源:testAzimuthalIntegrator.py


示例18: test_read

    def test_read(self):
        """
        Test the reading of Mar345 images
        """
        for line in TESTIMAGES.split('\n'):
            vals = line.strip().split()
            name = vals[0]
            dim1, dim2 = [int(x) for x in vals[1:3]]
            mini, maxi, mean, stddev = [float(x) for x in vals[3:]]
            obj = mar345image()
            obj.read(UtilsTest.getimage(name))

            self.assertAlmostEqual(mini, obj.getmin(), 2, "getmin [%s,%s]" % (mini, obj.getmin()))
            self.assertAlmostEqual(maxi, obj.getmax(), 2, "getmax [%s,%s]" % (maxi, obj.getmax()))
            self.assertAlmostEqual(mean, obj.getmean(), 2, "getmean [%s,%s]" % (mean, obj.getmean()))
            self.assertAlmostEqual(stddev, obj.getstddev(), 2, "getstddev [%s,%s]" % (stddev, obj.getstddev()))
            self.assertEqual(dim1, obj.dim1, "dim1")
            self.assertEqual(dim2, obj.dim2, "dim2")
开发者ID:coquellen,项目名称:fabio,代码行数:18,代码来源:testmar345image.py


示例19: setUp

    def setUp(self):
        self.datasets = [{"img":UtilsTest.getimage("1883/Pilatus1M.edf"), "poni":UtilsTest.getimage("1893/Pilatus1M.poni"), "spline": None},
            {"img":UtilsTest.getimage("1882/halfccd.edf"), "poni":UtilsTest.getimage("1895/halfccd.poni"), "spline": UtilsTest.getimage("1461/halfccd.spline")},
            {"img":UtilsTest.getimage("1881/Frelon2k.edf"), "poni":UtilsTest.getimage("1896/Frelon2k.poni"), "spline": UtilsTest.getimage("1900/frelon.spline")},
            {"img":UtilsTest.getimage("1884/Pilatus6M.cbf"), "poni":UtilsTest.getimage("1897/Pilatus6M.poni"), "spline": None},
#            {"img":UtilsTest.getimage("1880/Fairchild.edf"), "poni":UtilsTest.getimage("1898/Fairchild.poni"), "spline": None},
            ]
        for ds in self.datasets:
            if ds["spline"] is not None:
                data = open(ds["poni"], "r").read()
#                spline = os.path.basename(ds["spline"])
                with open(ds["poni"]) as f:
                    data = []
                    for line in f:
                        if line.startswith("SplineFile:"):
                            data.append("SplineFile: " + ds["spline"])
                        else:
                            data.append(line.strip())
                with open(ds["poni"], "w") as f:
                    f.write(os.linesep.join(data))
开发者ID:blackw1ng,项目名称:pyFAI,代码行数:20,代码来源:testOpenCL.py


示例20: __init__

 def __init__(self, filename=None, devicetype=None, device=None, profile=False):
     if filename and os.path.exists(filename):
         self.filename = filename
     else:
         self.filename = UtilsTest.getimage("wikipedia/commons/9/94/Esrf_grenoble.jpg")
     self.image_rgb = scipy.misc.imread(self.filename)
     if self.image_rgb.ndim != 2:
         self.image_bw = 0.299 * self.image_rgb[:, :, 0] + 0.587 * self.image_rgb[:, :, 1] + 0.114 * self.image_rgb[:, :, 2]
     else: self.image_bw = self.image_rgb
     if feature:
         self._sift_cpp = feature.SiftAlignment()
     self._sift_ocl = sift.SiftPlan(template=self.image_rgb, device=device, devicetype=devicetype, profile=profile)
     self.kp_cpp = numpy.empty(0)
     self.kp_ocl = numpy.empty(0)
     self.fig = pylab.figure()
     self.sp1 = self.fig.add_subplot(1, 2, 1)
     self.im1 = self.sp1.imshow(self.image_rgb)
     self.sp1.set_title("OpenCL: %s keypoint" % self.kp_ocl.size)
     self.sp2 = self.fig.add_subplot(1, 2, 2)
     self.im2 = self.sp2.imshow(self.image_bw, cmap="gray")
     self.sp2.set_title("C++: %s keypoint" % self.kp_cpp.size)
     self.fig.show()
     self.timing_cpp = None
     self.timing_ocl = None
开发者ID:biotrump,项目名称:sift_pyocl,代码行数:24,代码来源:demo.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utime.sleep_ms函数代码示例发布时间:2022-05-26
下一篇:
Python utilstest.getLogger函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap