本文整理汇总了Python中mcni.pyre_support.Instrument.Instrument类的典型用法代码示例。如果您正苦于以下问题:Python Instrument类的具体用法?Python Instrument怎么用?Python Instrument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Instrument类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _defaults
def _defaults(self):
base._defaults(self)
# serial mode
self.inventory.mode = 'worker'
from mcni.pyre_support.LauncherSerial import LauncherSerial
self.inventory.launcher = LauncherSerial()
self.inventory.sequence = ['source', 'verifier']
geometer = self.inventory.geometer
self.inventory.geometer.inventory.source = (0,0,0), (0,0,0)
self.inventory.geometer.inventory.verifier = (0,0,0), (0,0,0)
storage = self.inventory.source
#the path where neutrons were saved in the simulation
#of Instrument1
path = os.path.join(instrument1_outputpath, neutron_storage_path )
storage.inventory.path = path
return
示例2: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.overwrite_datafiles = True
self.inventory.sequence = ['source', 'monitor']
geometer = self.inventory.geometer
geometer.inventory.monitor = (0,0,1), (0,0,0)
source = self.inventory.source
# dimension of source
source.inventory.radius= 0.1
# distance from source to target
source.inventory.dist = 1. # should match monitor position
# target dimension
source.inventory.xw = 0.1
source.inventory.yh = 0.1
# energy distibution
# gaussian distibution
source.inventory.gauss = 1
source.inventory.E0 = source_E0
source.inventory.dE = source_dE
monitor = self.inventory.monitor
# dimension
monitor.inventory.xwidth = -0.1
monitor.inventory.yheight = 0.1
#
monitor.inventory.Emin = monitor_Emin
monitor.inventory.Emax = monitor_Emax
monitor.inventory.nchan = monitor_N
return
示例3: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.mode = "worker"
self.inventory.sequence = ["source", "verifier"]
geometer = self.inventory.geometer
self.inventory.geometer.inventory.verifier = (0, 0, 1), (0, 0, 90)
return
示例4: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = ['source', 'sample', 'monitor']
geometer = self.inventory.geometer
geometer.inventory.sample = (0,0,1), (0,0,0)
geometer.inventory.monitor = (0,0,1), (0,0,0)
return
示例5: main
def main(self):
base.main(self)
neutrons = {}
#get neutrons from other nodes
from mcni.neutron_storage import neutrons_from_npyarr as a2n, neutrons_as_npyarr as n2a, ndblsperneutron
from mcni.utils.mpi import rank as mpirank, send, receive, world
tag = 999
if mpirank != 0:
arr = n2a( self.inventory.recorder.neutrons )
print "Node %s: sending array of shape %s" % (mpirank, arr.shape,)
send(arr , 0, tag )
else:
for peer in range(1, world.size):
arr = receive( peer, tag )
arr.shape = -1, ndblsperneutron
neutrons[ peer ] = a2n( arr )
print "Node %s: received array of shape %s" % (mpirank, arr.shape)
continue
neutrons[ 0] = self.inventory.recorder.neutrons
#compare
if mpirank == 0:
for peer in range(1, world.size):
assert neutrons[0][0].state.velocity[2] != neutrons[peer][0].state.velocity[2]
continue
return
示例6: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.mode = 'worker'
from mcni.pyre_support.LauncherSerial import LauncherSerial
self.inventory.launcher = LauncherSerial()
self.inventory.sequence = ['source', 'verifier']
geometer = self.inventory.geometer
self.inventory.geometer.inventory.verifier = (0,0,1), (0,0,90)
return
示例7: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = ['source', 'monitor']
from mcstas2.pyre_support import componentfactory as factory
self.inventory.source = factory('sources', 'Source_simple')('source')
self.inventory.monitor = factory('monitors', 'E_monitor')('monitor')
# print self.inventory.source
geometer = self.inventory.geometer
geometer.inventory.monitor = (0,0,1), (0,0,0)
return
示例8: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.mode = 'worker'
from mcni.pyre_support.LauncherSerial import LauncherSerial
self.inventory.launcher = LauncherSerial()
self.inventory.sequence = ['source', 'counter']
geometer = self.inventory.geometer
self.inventory.geometer.inventory.source = (0,0,0), (0,0,0)
self.inventory.multiple_scattering = 1
self.inventory.buffer_size = ncount
self.inventory.ncount = ncount
self.inventory.overwrite_datafiles = True
return
示例9: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = [
'source', 'validator1', 'monitor', 'validator2']
self.inventory.outputdir = 'restore_neutrons_TestCase-out'
self.inventory.ncount = 5
self.inventory.buffer_size = 5
self.inventory.overwrite_datafiles = 1
geometer = self.inventory.geometer
geometer.inventory.monitor = (0,0,1), (0,0,0)
monitor = self.inventory.monitor
monitor.inventory.restore_neutron = 1
self.inventory.validator1 = Validator('validator1', 'validator')
self.inventory.validator2 = Validator('validator2', 'validator')
return
示例10: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = ['source', 'detector']
geometer = self.inventory.geometer
geometer.inventory.source = (0,0,mod2sample), (0,0,0)
geometer.inventory.detector = (0,0,mod2sample), (0,0,0)
source = self.inventory.source
source.inventory.Ei = Ei
source.inventory.E = E
source.inventory.Q = Q
source.inventory.L1 = mod2sample
detector = self.inventory.detector
detector.inventory.eventsdat = eventsdat
detector.inventory.instrumentxml = instrumentxml
detector.inventory.tofparams = str(tofparams)
return
示例11: _defaults
def _defaults(self):
base._defaults(self)
# serial mode
self.inventory.mode = 'worker'
from mcni.pyre_support.LauncherSerial import LauncherSerial
self.inventory.launcher = LauncherSerial()
self.inventory.sequence = ['source', 'storage']
geometer = self.inventory.geometer
self.inventory.geometer.inventory.source = (0,0,0), (0,0,0)
self.inventory.geometer.inventory.storage = (0,0,1), (0,0,0)
source = self.inventory.source
source.inventory.position = '0,0,0'
source.inventory.velocity = '1000,2000,3000'
storage = self.inventory.storage
storage.inventory.path = neutron_storage_path
return
示例12: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = [
'source',
'guide1',
'guide2',
'slit1',
'slit2',
'neutron_recorder',
]
geometer = self.inventory.geometer
geometer.inventory.source = (0,0,0), (0,0,0)
geometer.inventory.guide2 = (0,0,5), (0,0,0)
geometer.inventory.guide2 = (0,0,10), (0,0,0)
geometer.inventory.slit1 = (0,0,29.0), (0,0,0)
geometer.inventory.slit2 = (0,0,30.5), (0,0,0)
geometer.inventory.neutron_recorder = (0,0,30.6), (0,0,0)
return
示例13: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = [
'moderator',
'core_vessel_insert',
'shutter_guide',
'guide1',
't0_chopper',
'guide2',
'fermi_chopper',
'guide3', 'guide4', 'guide5',
'energy_monitor1', 'tof_monitor1',
'neutron_recorder',
]
geometer = self.inventory.geometer
geometer.inventory.moderator = (0,0,0), (0,0,0)
geometer.inventory.core_vessel_insert = (0,0,1.), (0,0,0)
geometer.inventory.shutter_guide = (0,0, 2.2679), (0,0,0)
geometer.inventory.guide1 = (0,0,4.179), (0,0,0)
geometer.inventory.t0_chopper = (0,0,9.000), (0,0,0)
geometer.inventory.guide2 = (0,0,9.482), (0,0,0)
geometer.inventory.fermi_chopper = (0,0,11.6), (0,0,0)
geometer.inventory.guide3 = (0,0,11.815), (0,0,0)
geometer.inventory.guide4 = (0,0,12.061), (0,0,0)
geometer.inventory.guide5 = (0,0,13.017), (0,0,0)
geometer.inventory.energy_monitor1 = (0,0,13.407), (0,0,0)
geometer.inventory.tof_monitor1 = (0,0,13.407), (0,0,0)
geometer.inventory.neutron_recorder = (0,0,13.45), (0,0,0)
return
示例14: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = ['source', 'sample', 'detector']
geometer = self.inventory.geometer
geometer.inventory.source = (0,0,0), (0,0,0)
geometer.inventory.sample = (0,0,mod2sample), (0,0,0)
geometer.inventory.detector = (0,0,mod2sample), (0,0,0)
source = self.inventory.source
source.inventory.position = 0,0,0
source.inventory.velocity = 0,0,vi
source.inventory.probability = 1
source.inventory.time = 0.0
sample = self.inventory.sample
sample.inventory.xml = 'Ni.xml'
detector = self.inventory.detector
detector.inventory.eventsdat = eventsdat
detector.inventory.instrumentxml = instrumentxml
detector.inventory.tofparams = str(tofparams)
return
示例15: _defaults
def _defaults(self):
base._defaults(self)
self.inventory.sequence = ['source', 'monitor']
geometer = self.inventory.geometer
geometer.inventory.source = (0,0,0), (0,0,0)
geometer.inventory.monitor = (0,0,10), (0,0,0)
source = self.inventory.source
source.inventory.dist = 10
source.inventory.xw = 0.1
source.inventory.yh = 0.1
source.inventory.radius = 0.02
source.inventory.E0 = 60
source.inventory.dE = 5
monitor = self.inventory.monitor
monitor.inventory.Emin = 10
monitor.inventory.Emax = 100
monitor.inventory.nchan = 20
monitor.inventory.xwidth = 0.1
monitor.inventory.yheight = 0.1
return