aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx/PGroup.py
diff options
context:
space:
mode:
authorGravatar David Grote <grote1@llnl.gov> 2020-03-17 16:39:51 -0700
committerGravatar GitHub <noreply@github.com> 2020-03-17 16:39:51 -0700
commit85d2f945f41382c8ebfe6696d8093b47b46d8ea1 (patch)
treea2cb8ff29ad2644e9e7cb2b791c7e08841b5a97c /Python/pywarpx/PGroup.py
parent1a670a115eb3e7396ce922496319b943281c34a0 (diff)
downloadWarpX-85d2f945f41382c8ebfe6696d8093b47b46d8ea1.tar.gz
WarpX-85d2f945f41382c8ebfe6696d8093b47b46d8ea1.tar.zst
WarpX-85d2f945f41382c8ebfe6696d8093b47b46d8ea1.zip
Small fixes to Python to better handle particle weights (#807)
Diffstat (limited to 'Python/pywarpx/PGroup.py')
-rw-r--r--Python/pywarpx/PGroup.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/pywarpx/PGroup.py b/Python/pywarpx/PGroup.py
index ae9e6800a..7383c88ef 100644
--- a/Python/pywarpx/PGroup.py
+++ b/Python/pywarpx/PGroup.py
@@ -28,7 +28,7 @@ class PGroup(object):
self.sm = np.zeros(self.ns) # Species mass [kg]
self.sq = np.zeros(self.ns) # Species charge [C]
- self.sw = np.zeros(self.ns) # Species weight, (real particles per simulation particles)
+ self.sw = np.ones(self.ns) # Species weight, (real particles per simulation particles)
self.sid = np.arange(self.ns, dtype=int) # Global species index for each species
self.ndts = np.ones(self.ns, dtype=int) # Stride for time step advance for each species
@@ -110,11 +110,12 @@ class PGroup(object):
return _libwarpx.get_particle_uz(self.ispecie, self.level)[self.igroup]
uzp = property(getuzp)
- def getpid(self):
- id = _libwarpx.get_particle_id(self.ispecie, self.level)[self.igroup]
- pid = np.array([id]).T
- return pid
- pid = property(getpid)
+ def getw(self):
+ return _libwarpx.get_particle_weight(self.ispecie, self.level)[self.igroup]
+
+ def getpid(self, id):
+ pid = _libwarpx.get_particle_arrays(self.ispecie, id, self.level)[self.igroup]
+ return np.array([pid]).T
def getgaminv(self):
uxp = self.getuxp()