本文整理汇总了Python中pymontecarlo.options.options.Options.detectors['det2']方法的典型用法代码示例。如果您正苦于以下问题:Python Options.detectors['det2']方法的具体用法?Python Options.detectors['det2']怎么用?Python Options.detectors['det2']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymontecarlo.options.options.Options
的用法示例。
在下文中一共展示了Options.detectors['det2']方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det2'] [as 别名]
def setUpClass(cls):
super(TestResultsReader, cls).setUpClass()
ops1 = Options(name='test1')
ops1.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
ops1.detectors['det2'] = TimeDetector()
ops1.detectors['det3'] = ElectronFractionDetector()
results1 = {}
results1['det1'] = PhotonIntensityResult()
results1['det2'] = TimeResult()
results1['det3'] = ElectronFractionResult()
ops2 = Options(name='test2')
ops2.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
results2 = {}
results2['det1'] = PhotonIntensityResult()
cls.results = Results(Options(name='base'),
[(ops1, results1), (ops2, results2)])
cls.group = h5py.File('test.h5', 'a', driver='core', backing_store=False)
writer = ResultsWriter()
writer.convert(cls.results, cls.group)
writer.join()
示例2: setUp
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det2'] [as 别名]
def setUp(self):
unittest.TestCase.setUp(self)
ops1 = Options(name='test1')
ops1.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
ops1.detectors['det2'] = TimeDetector()
ops1.detectors['det3'] = ElectronFractionDetector()
results1 = {}
results1['det1'] = PhotonIntensityResult()
results1['det2'] = TimeResult()
results1['det3'] = ElectronFractionResult()
ops2 = Options(name='test2')
ops2.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
results2 = {}
results2['det1'] = PhotonIntensityResult()
self.obj = Results(Options(name='base'),
[(ops1, results1), (ops2, results2)])
示例3: __run
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det2'] [as 别名]
def __run():
from PySide.QtGui import QMainWindow, QApplication
from pymontecarlo.options.options import Options
from pymontecarlo.results.results import Results
from pymontecarlo.options.detector import \
PhotonIntensityDetector, PhotonDepthDetector
from pymontecarlo.results.result import \
PhotonKey, PhotonIntensityResult, PhotonDepthResult
from pyxray.transition import K_family
# Results
ops = Options(name='base')
ops.beam.energy_keV = [5.0, 10.0]
ops.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
ops.detectors['det2'] = PhotonDepthDetector((0, 1), (0, 1), 4)
ops1 = Options(name='test1')
ops1.beam.energy_keV = 5.0
ops1.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
ops1.detectors['det2'] = PhotonDepthDetector((0, 1), (0, 1), 4)
intensities = {}
intensities[PhotonKey(K_family(13), True, PhotonKey.T)] = (1.0, 0.1)
intensities[PhotonKey(K_family(14), True, PhotonKey.T)] = (10.0, 0.1)
result11 = PhotonIntensityResult(intensities)
distributions = {}
et = np.array([[1.0, 2.0, 3.0, 4.0],
[30.0, 35.0, 34.0, 31.0],
[0.31, 0.32, 0.33, 0.34]]).T
distributions[PhotonKey(K_family(13), True, PhotonKey.T)] = et
et = np.array([[1.0, 2.0, 3.0, 4.0],
[31.0, 36.0, 35.0, 32.0],
[0.31, 0.32, 0.33, 0.34]]).T
distributions[PhotonKey(K_family(14), True, PhotonKey.T)] = et
result12 = PhotonDepthResult(distributions)
ops2 = Options(name='test2')
ops2.beam.energy_keV = 10.0
ops2.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
ops2.detectors['det2'] = PhotonDepthDetector((0, 1), (0, 1), 4)
intensities = {}
intensities[PhotonKey(K_family(13), True, PhotonKey.T)] = (2.0, 0.2)
intensities[PhotonKey(K_family(14), True, PhotonKey.T)] = (3.0, 0.1)
result21 = PhotonIntensityResult(intensities)
distributions = {}
et = np.array([[1.0, 2.0, 3.0, 4.0],
[10.0, 15.0, 14.0, 11.0],
[0.11, 0.12, 0.13, 0.14]]).T
distributions[PhotonKey(K_family(13), True, PhotonKey.T)] = et
et = np.array([[1.0, 2.0, 3.0, 4.0],
[11.0, 16.0, 15.0, 12.0],
[0.11, 0.12, 0.13, 0.14]]).T
distributions[PhotonKey(K_family(14), True, PhotonKey.T)] = et
result22 = PhotonDepthResult(distributions)
list_results = [(ops1, {'det1': result11, 'det2': result12}),
(ops2, {'det1': result21, 'det2': result22})]
results = Results(ops, list_results)
app = QApplication(sys.argv)
window = QMainWindow()
widget = SummaryWidget(results)
window.setCentralWidget(widget)
window.show()
app.exec_()