mirror of
https://github.com/gwm17/catima.git
synced 2024-11-22 18:28:51 -05:00
commit
1295926535
16
catima.pyx
16
catima.pyx
|
@ -310,6 +310,22 @@ cdef class Config:
|
||||||
return self.cbase.dedx_straggling
|
return self.cbase.dedx_straggling
|
||||||
else:
|
else:
|
||||||
self.cbase.dedx_straggling = val
|
self.cbase.dedx_straggling = val
|
||||||
|
def set(self,other):
|
||||||
|
if("z_effective" in other):
|
||||||
|
self.cbase.z_effective = other["z_effective"]
|
||||||
|
if("dedx" in other):
|
||||||
|
self.cbase.dedx = other["dedx"]
|
||||||
|
if("dedx_straggling" in other):
|
||||||
|
self.cbase.dedx_straggling = other["dedx_straggling"]
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
res = {}
|
||||||
|
res["z_effective"] = self.cbase.z_effective
|
||||||
|
res["dedx"] = self.cbase.dedx
|
||||||
|
res["dedx_straggling"] = self.cbase.dedx_straggling
|
||||||
|
res["skip"] = self.cbase.skip
|
||||||
|
return res
|
||||||
|
|
||||||
def print_info(self):
|
def print_info(self):
|
||||||
print("z_effective = %s"%z_eff_type(self.cbase.z_effective))
|
print("z_effective = %s"%z_eff_type(self.cbase.z_effective))
|
||||||
print("dedx_straggling = %s"%omega_type(self.cbase.dedx_straggling))
|
print("dedx_straggling = %s"%omega_type(self.cbase.dedx_straggling))
|
||||||
|
|
|
@ -75,7 +75,7 @@ class TestStructures(unittest.TestCase):
|
||||||
self.assertAlmostEqual(m2.molar_mass(),18,1)
|
self.assertAlmostEqual(m2.molar_mass(),18,1)
|
||||||
self.assertAlmostEqual(m2.density(),1.0,1)
|
self.assertAlmostEqual(m2.density(),1.0,1)
|
||||||
|
|
||||||
m3 = catima.get_material(301)
|
m3 = catima.get_material(3001)
|
||||||
self.assertEqual(m3.ncomponents(),0)
|
self.assertEqual(m3.ncomponents(),0)
|
||||||
self.assertAlmostEqual(m3.molar_mass(),0,1)
|
self.assertAlmostEqual(m3.molar_mass(),0,1)
|
||||||
self.assertAlmostEqual(m3.density(),0.0,1)
|
self.assertAlmostEqual(m3.density(),0.0,1)
|
||||||
|
@ -254,5 +254,15 @@ class TestStructures(unittest.TestCase):
|
||||||
#self.assertAlmostEqual(catima.da2de(p,water,et[100]),data[2][100],6)
|
#self.assertAlmostEqual(catima.da2de(p,water,et[100]),data[2][100],6)
|
||||||
#self.assertAlmostEqual(catima.da2de(p,water,et[400]),data[2][400],6)
|
#self.assertAlmostEqual(catima.da2de(p,water,et[400]),data[2][400],6)
|
||||||
|
|
||||||
|
def test_config(self):
|
||||||
|
c1 = catima.Config()
|
||||||
|
self.assertEqual(c1.z_effective(),catima.z_eff_type.pierce_blann);
|
||||||
|
|
||||||
|
d = {}
|
||||||
|
d["z_effective"] = catima.z_eff_type.atima14;
|
||||||
|
c1.set(d);
|
||||||
|
self.assertEqual(c1.z_effective(),catima.z_eff_type.atima14);
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user