1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2024-11-22 18:28:51 -05:00

python module

This commit is contained in:
hrocho 2018-01-22 00:37:22 +01:00
parent 49b96aaa20
commit 9d1d920f50
2 changed files with 27 additions and 1 deletions

View File

@ -310,6 +310,22 @@ cdef class Config:
return self.cbase.dedx_straggling
else:
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):
print("z_effective = %s"%z_eff_type(self.cbase.z_effective))
print("dedx_straggling = %s"%omega_type(self.cbase.dedx_straggling))

View File

@ -75,7 +75,7 @@ class TestStructures(unittest.TestCase):
self.assertAlmostEqual(m2.molar_mass(),18,1)
self.assertAlmostEqual(m2.density(),1.0,1)
m3 = catima.get_material(301)
m3 = catima.get_material(3001)
self.assertEqual(m3.ncomponents(),0)
self.assertAlmostEqual(m3.molar_mass(),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[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__":
unittest.main()