本文整理汇总了Python中utilstest.UtilsTest类的典型用法代码示例。如果您正苦于以下问题:Python UtilsTest类的具体用法?Python UtilsTest怎么用?Python UtilsTest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UtilsTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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
示例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
示例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)
示例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
示例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])
示例8: setUp
def setUp(self):
"""
download images
"""
self.im_dir = os.path.dirname(UtilsTest.getimage("Cr8F8140k103.0026.bz2"))
self.tempdir = tempfile.mkdtemp()
示例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()
示例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])
示例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])
示例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)
示例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)
示例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)
示例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)