本文整理汇总了Python中ShipGeoConfig.ConfigRegistry.loadpys方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigRegistry.loadpys方法的具体用法?Python ConfigRegistry.loadpys怎么用?Python ConfigRegistry.loadpys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShipGeoConfig.ConfigRegistry
的用法示例。
在下文中一共展示了ConfigRegistry.loadpys方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from ShipGeoConfig import ConfigRegistry [as 别名]
# 或者: from ShipGeoConfig.ConfigRegistry import loadpys [as 别名]
def setUp(self):
self.key = "basic"
config = """
import shipunit as u
from ShipGeoConfig import AttrDict, ConfigRegistry
with ConfigRegistry.register_config("basic") as c:
c.vetoStation = AttrDict(z=-2390.*u.cm)
c.TrackStation1 = AttrDict(z=1510.*u.cm)
c.TrackStation2 = AttrDict(z=1710.*u.cm)
c.TrackStation3 = AttrDict(z=2150.*u.cm)
c.TrackStation4 = AttrDict(z=2370.*u.cm)
c.z = c.TrackStation2.z + 0.5 * (c.TrackStation3.z - c.TrackStation2.z)
c.Bfield = AttrDict(z=c.z)
c.Bfield.max = 1.5*u.kilogauss # was 1.15 in EOI
# target absorber muon shield setup
c.decayVolume = AttrDict(z=0*u.cm)
c.decayVolume.length = 50*u.m
c.muShield = AttrDict(z=0*u.cm)
c.muShield.dZ1 = 2.5*u.m
c.muShield.dZ2 = 3.5*u.m
c.muShield.dZ3 = 3.0*u.m
c.muShield.dZ4 = 3.0*u.m
c.muShield.dZ5 = 2.5*u.m
c.muShield.dZ6 = 2.5*u.m
c.muShield.LE = 5*u.m
"""
ConfigRegistry.loadpys(config)
示例2: test_true
# 需要导入模块: from ShipGeoConfig import ConfigRegistry [as 别名]
# 或者: from ShipGeoConfig.ConfigRegistry import loadpys [as 别名]
def test_true(self):
c = ConfigRegistry.loadpys(self.config, MU_SHIELD_ENABLED=True)
self.assertTrue("muShield" in c)
assert len(ConfigRegistry.keys()) == 1, ConfigRegistry.keys()
assert self.key in ConfigRegistry.keys()
assert ConfigRegistry[self.key].Bfield.max == 1.5*u.kilogauss
assert ConfigRegistry[self.key].muShield.dZ1 == 2.5*u.m
示例3: test_false
# 需要导入模块: from ShipGeoConfig import ConfigRegistry [as 别名]
# 或者: from ShipGeoConfig.ConfigRegistry import loadpys [as 别名]
def test_false(self):
ConfigRegistry.loadpys(self.config, MU_SHIELD_ENABLED=False)
assert len(ConfigRegistry.keys()) == 1, ConfigRegistry.keys()
assert self.key in ConfigRegistry.keys()
assert ConfigRegistry[self.key].Bfield.max == 1.5*u.kilogauss
self.assertTrue("muShield" not in ConfigRegistry[self.key])