Skip to content

Commit 665e3e4

Browse files
authored
Merge pull request #127 from RemiLehe/from_file_distribution
Add new class to load particles from an openPMD file
2 parents 37bb651 + feb9f59 commit 665e3e4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Docs/source/standard/distribution.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ Particle distributions
1616
.. autoclass:: picmistandard.PICMI_AnalyticFluxDistribution
1717

1818
.. autoclass:: picmistandard.PICMI_ParticleListDistribution
19+
20+
.. autoclass:: picmistandard.PICMI_FromFileDistribution

PICMI_Python/particles.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,16 @@ def __init__(self, x=0., y=0., z=0., ux=0., uy=0., uz=0., weight=0.,
601601
self.handle_init(kw)
602602

603603

604+
class PICMI_FromFileDistribution(_ClassWithInit):
605+
"""
606+
Load particles from an openPMD file.
607+
608+
The openPMD file must contain the attributes `position`, `momentum`, `weighting`.
609+
"""
610+
def __init__(self, file_path, **kw):
611+
self.file_path = file_path
612+
self.handle_init(kw)
613+
604614
# ------------------
605615
# Numeric Objects
606616
# ------------------

0 commit comments

Comments
 (0)