diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pywarpx/PGroup.py | 6 | ||||
-rwxr-xr-x | Python/pywarpx/_libwarpx.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Python/pywarpx/PGroup.py b/Python/pywarpx/PGroup.py index 92f6b4484..bb8ad11e2 100644 --- a/Python/pywarpx/PGroup.py +++ b/Python/pywarpx/PGroup.py @@ -55,6 +55,10 @@ class PGroup(object): def addspecies(self): pass + def getnpid(self): + # --- The -3 is because the comps include the velocites + return _labwarpx.warpx_nComps() - 3 + npid = property(getnpid) def getnps(self): return np.array([len(self.xp)], dtype='l') @@ -104,7 +108,7 @@ class PGroup(object): uxp = self.getuxp(js) uyp = self.getuyp(js) uzp = self.getuzp(js) - return sqrt(1. - (uxp**2 + uyp**2 + uzp**2)/warpxC.c**2) + return np.sqrt(1. - (uxp**2 + uyp**2 + uzp**2)/_libwarpx.clight**2) gaminv = property(getgaminv) def getex(self, js=0): diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py index 07caa6763..183fe315e 100755 --- a/Python/pywarpx/_libwarpx.py +++ b/Python/pywarpx/_libwarpx.py @@ -6,6 +6,9 @@ from ctypes.util import find_library import numpy as np from numpy.ctypeslib import ndpointer +# --- Is there a better way of handling constants? +clight = 2.99792458e+8 # m/s + def get_package_root(): ''' Get the path to the installation location (where libwarpx.so would be installed). |