1
0
Fork 0
mirror of https://github.com/gwm17/catima.git synced 2025-01-30 17:58:49 -05:00

added new function to python

This commit is contained in:
hrocho 2017-12-14 11:51:45 +01:00
parent 2cbf3c0c92
commit 582a7cbf83
2 changed files with 11 additions and 1 deletions

View File

@ -384,6 +384,16 @@ def dedx(Projectile projectile, Material material, energy = None, Config config
if(energy is None):
energy = projectile.T()
return catimac.dedx(projectile.cbase, energy, material.cbase, config.cbase)
def domega2dx(Projectile projectile, Material material, energy = None, Config config = default_config):
if(isinstance(energy,numpy.ndarray)):
res = numpy.empty(energy.size)
for i,e in enumerate(energy):
res[i] = catimac.domega2dx(projectile.cbase, e, material.cbase, config.cbase)
return res
if(energy is None):
energy = projectile.T()
return catimac.domega2dx(projectile.cbase, energy, material.cbase, config.cbase)
def energy_out(Projectile projectile, Material material, energy = None, Config config = default_config):
if(isinstance(energy,numpy.ndarray)):

View File

@ -66,6 +66,7 @@ cdef extern from "catima/config.h" namespace "catima":
cdef extern from "catima/catima.h" namespace "catima":
cdef double dedx(Projectile &p, double T, const Material &t,const Config &c)
cdef double domega2dx(Projectile &p, double T, const Material &mat, const Config &c)
cdef double range(Projectile &p, double T, const Material &t, const Config &c);
cdef double dedx_from_range(Projectile &p, double T, const Material &t, const Config &c);
cdef double energy_out(Projectile &p, double T, const Material &t, const Config &c);
@ -75,7 +76,6 @@ cdef extern from "catima/catima.h" namespace "catima":
cdef double range_straggling(Projectile &p, double T, const Material &t, const Config &c);
cdef double da2dx(Projectile &p, double T, const Material &t, const Config &c);
cdef double dedx_rms(Projectile &p, Target &t, const Config &c);
cdef double angular_variance(Projectile &p, double T, const Material &t, const Config& c);
cdef Result calculate(Projectile &p, const Material &t, const Config &c);