本文整理汇总了Python中pyFAI.azimuthalIntegrator.AzimuthalIntegrator.set_darkfiles方法的典型用法代码示例。如果您正苦于以下问题:Python AzimuthalIntegrator.set_darkfiles方法的具体用法?Python AzimuthalIntegrator.set_darkfiles怎么用?Python AzimuthalIntegrator.set_darkfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyFAI.azimuthalIntegrator.AzimuthalIntegrator
的用法示例。
在下文中一共展示了AzimuthalIntegrator.set_darkfiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_setter
# 需要导入模块: from pyFAI.azimuthalIntegrator import AzimuthalIntegrator [as 别名]
# 或者: from pyFAI.azimuthalIntegrator.AzimuthalIntegrator import set_darkfiles [as 别名]
class test_setter(unittest.TestCase):
tmp_dir = os.environ.get("PYFAI_TEMPDIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp"))
def setUp(self):
self.ai = AzimuthalIntegrator()
shape = (10, 15)
self.rnd1 = numpy.random.random(shape).astype(numpy.float32)
self.rnd2 = numpy.random.random(shape).astype(numpy.float32)
if not os.path.isdir(self.tmp_dir):
os.mkdir(self.tmp_dir)
fd, self.edf1 = tempfile.mkstemp(".edf", "testAI1", self.tmp_dir)
os.close(fd)
fd, self.edf2 = tempfile.mkstemp(".edf", "testAI2", self.tmp_dir)
os.close(fd)
fabio.edfimage.edfimage(data=self.rnd1).write(self.edf1)
fabio.edfimage.edfimage(data=self.rnd2).write(self.edf2)
def tearDown(self):
if os.path.exists(self.edf1):
os.unlink(self.edf1)
if os.path.exists(self.edf2):
os.unlink(self.edf2)
def test_flat(self):
self.ai.set_flatfiles((self.edf1,self.edf2), method="mean")
self.assert_(self.ai.flatfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "flatfiles string is OK")
self.assert_(abs(self.ai.flatfield-0.5*(self.rnd1+self.rnd2)).max() == 0, "Flat array is OK")
def test_dark(self):
self.ai.set_darkfiles((self.edf1, self.edf2), method="mean")
self.assert_(self.ai.darkfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "darkfiles string is OK")
self.assert_(abs(self.ai.darkcurrent-0.5*(self.rnd1+self.rnd2)).max() == 0, "Dark array is OK")
示例2: TestSetter
# 需要导入模块: from pyFAI.azimuthalIntegrator import AzimuthalIntegrator [as 别名]
# 或者: from pyFAI.azimuthalIntegrator.AzimuthalIntegrator import set_darkfiles [as 别名]
class TestSetter(unittest.TestCase):
def setUp(self):
self.ai = AzimuthalIntegrator()
shape = (10, 15)
self.rnd1 = numpy.random.random(shape).astype(numpy.float32)
self.rnd2 = numpy.random.random(shape).astype(numpy.float32)
if not os.path.isdir(tmp_dir):
os.mkdir(tmp_dir)
fd, self.edf1 = tempfile.mkstemp(".edf", "testAI1", tmp_dir)
os.close(fd)
fd, self.edf2 = tempfile.mkstemp(".edf", "testAI2", tmp_dir)
os.close(fd)
fabio.edfimage.edfimage(data=self.rnd1).write(self.edf1)
fabio.edfimage.edfimage(data=self.rnd2).write(self.edf2)
def tearDown(self):
recursive_delete(tmp_dir)
def test_flat(self):
self.ai.set_flatfiles((self.edf1, self.edf2), method="mean")
self.assert_(self.ai.flatfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "flatfiles string is OK")
self.assert_(abs(self.ai.flatfield - 0.5 * (self.rnd1 + self.rnd2)).max() == 0, "Flat array is OK")
def test_dark(self):
self.ai.set_darkfiles((self.edf1, self.edf2), method="mean")
self.assert_(self.ai.darkfiles == "%s(%s,%s)" % ("mean", self.edf1, self.edf2), "darkfiles string is OK")
self.assert_(abs(self.ai.darkcurrent - 0.5 * (self.rnd1 + self.rnd2)).max() == 0, "Dark array is OK")