aboutsummaryrefslogtreecommitdiff
path: root/Example/Larmor/plot_particle_path.py
diff options
context:
space:
mode:
authorGravatar atmyers <atmyers2@gmail.com> 2017-06-01 17:35:14 -0700
committerGravatar atmyers <atmyers2@gmail.com> 2017-06-01 17:35:14 -0700
commit6d3abb22ead3a33ac6f77c4a7a9b9a53a6834d5e (patch)
treebd6e44b0d72b1441ace0fcfcb3860ac349420f73 /Example/Larmor/plot_particle_path.py
parent7211169494a60b9d9c20863cf32f4a81b8fa67be (diff)
downloadWarpX-6d3abb22ead3a33ac6f77c4a7a9b9a53a6834d5e.tar.gz
WarpX-6d3abb22ead3a33ac6f77c4a7a9b9a53a6834d5e.tar.zst
WarpX-6d3abb22ead3a33ac6f77c4a7a9b9a53a6834d5e.zip
docstrings.
Diffstat (limited to 'Example/Larmor/plot_particle_path.py')
-rw-r--r--Example/Larmor/plot_particle_path.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/Example/Larmor/plot_particle_path.py b/Example/Larmor/plot_particle_path.py
index 2dece53c2..c925e1728 100644
--- a/Example/Larmor/plot_particle_path.py
+++ b/Example/Larmor/plot_particle_path.py
@@ -1,6 +1,20 @@
import numpy as np
class AMReXParticleHeader(object):
+ '''
+
+ This class is designed to parse and store the information
+ contained in an AMReX particle header file.
+
+ Usage:
+
+ header = AMReXParticleHeader("plt00000/particle0/Header")
+ print(header.num_particles)
+ print(header.version_string)
+
+ etc...
+
+ '''
def __init__(self, header_filename):
@@ -53,6 +67,21 @@ class AMReXParticleHeader(object):
def read_particle_data(fn, ptype="particle0"):
+ '''
+
+ This function returns the particle data stored in a particular
+ plot file and particle type. It returns two numpy arrays, the
+ first containing the particle integer data, and the second the
+ particle real data. For example, if a dataset has 3000 particles,
+ which have two integer and five real components, this function will
+ return two numpy arrays, one with the shape (3000, 2) and the other
+ with the shape (3000, 5).
+
+ Usage:
+
+ idata, rdata = read_particle_data("plt00000", "particle0")
+
+ '''
base_fn = fn + "/" + ptype
header = AMReXParticleHeader(base_fn + "/Header")