本文整理汇总了Python中pymontecarlo.options.options.Options.detectors['det1']方法的典型用法代码示例。如果您正苦于以下问题:Python Options.detectors['det1']方法的具体用法?Python Options.detectors['det1']怎么用?Python Options.detectors['det1']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymontecarlo.options.options.Options
的用法示例。
在下文中一共展示了Options.detectors['det1']方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpClass
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [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['det1'] [as 别名]
def setUp(self):
TestCase.setUp(self)
# Results 1
self.ops1 = Options(name='test1')
self.ops1.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
self.ops1.detectors['det2'] = TimeDetector()
self.ops1.detectors['det3'] = ElectronFractionDetector()
results1 = {}
results1['det1'] = PhotonIntensityResult()
results1['det2'] = TimeResult()
results1['det3'] = ElectronFractionResult()
# Results 2
ops2 = Options(name='test2')
ops2.detectors['det1'] = PhotonIntensityDetector((0, 1), (0, 1))
results2 = {}
results2['det1'] = PhotonIntensityResult()
# Base options
self.ops = Options(name='base')
# Sequence
list_results = [(self.ops1, results1), (ops2, results2)]
self.results = Results(self.ops, list_results)
示例3: testconvert_no_detector
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [as 别名]
def testconvert_no_detector(self):
# Base options
ops = Options(name="Test")
ops.detectors['det1'] = TimeDetector()
ops.limits.add(ShowersLimit(100))
# Convert
opss = self.converter.convert(ops)
# Test
self.assertEqual(0, len(opss))
示例4: testinteraction_forcing
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [as 别名]
def testinteraction_forcing(self):
ops = Options()
ops.beam.energy_eV = 30e3
intfor = InteractionForcing(ELECTRON, HARD_ELASTIC, -40)
ops.geometry.material = PenelopeMaterial.pure(29, interaction_forcings=[intfor])
ops.detectors['det1'] = TimeDetector()
ops.limits.add(TimeLimit(100))
opss = self.c.convert(ops)
self.e.export(opss[0], self.tmpdir)
示例5: setUp
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [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)])
示例6: testconvert2
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [as 别名]
def testconvert2(self):
# Base options
ops = Options("Test")
ops.beam.origin_m = (0.0, 0.0, 0.09)
det = PhotonIntensityDetector((radians(35), radians(45)),
(0, radians(360.0)))
ops.detectors['det1'] = det
# Convert
opss = self.converter.convert(ops)
self.assertEqual(0, len(opss)) # No showers limit
示例7: testconvert_pencilbeam
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [as 别名]
def testconvert_pencilbeam(self):
# Base options
ops = Options(name="Test")
ops.beam = PencilBeam(1234)
ops.detectors['det1'] = TimeDetector()
ops.limits.add(TimeLimit(100))
# Convert
with warnings.catch_warnings(record=True) as ws:
opss = self.converter.convert(ops)
# 7 warning:
# PencilBeam -> GaussianBeam
# Set default models (6)
self.assertEqual(1, len(opss))
self.assertEqual(7, len(ws))
# Test
self.assertAlmostEqual(1234, opss[0].beam.energy_eV, 4)
self.assertAlmostEqual(0.0, opss[0].beam.diameter_m, 4)
self.assertEqual(6, len(opss[0].models))
示例8: testconvert1
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [as 别名]
def testconvert1(self):
# Base options
ops = Options("Test")
ops.beam.origin_m = (0.0, 0.0, 0.09)
ops.limits.add(ShowersLimit(1234))
det = PhotonIntensityDetector((radians(35), radians(45)),
(0, radians(360.0)))
ops.detectors['det1'] = det
# Convert
opss = self.converter.convert(ops)
self.assertEqual(1, len(opss))
self.assertEqual(1, len(opss[0].detectors))
self.assertEqual(1, len(opss[0].limits))
limit = list(ops.limits.iterclass(ShowersLimit))[0]
self.assertEqual(1234, limit.showers)
self.assertEqual(6, len(opss[0].models))
示例9: __run
# 需要导入模块: from pymontecarlo.options.options import Options [as 别名]
# 或者: from pymontecarlo.options.options.Options import detectors['det1'] [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_()