Skip to content

Commit

Permalink
Merge pull request #276 from skuschel/dev
Browse files Browse the repository at this point in the history
last merge should have merged into master instead of dev
  • Loading branch information
skuschel authored Jan 29, 2024
2 parents 1481f34 + 02b11e6 commit b4c758e
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ current master
--------------


**Highlights**

* Add support to read the `Smilei` PIC (https://smileipic.github.io/Smilei/) data format in both cartesian and azimuthal geometry. Postpic uses a build in azimuthal mode expansion very similar to the one used for fbpic.
* To read smilei data, postpic only relies on the hdf5 package and not smilei's happi module for data access. Paricle ID's (ParticleTracking as described by smilei) can be read directly from the hdf5. Happi requires to sort the IDs and write a new hdf5, which can be twice as big as the original dumps. Using postpic's access this step will be skipped and thus access is much faster (but by default with unordered particle IDs as in any other code).


**Incompatible adjustments to previous version**



**Other improvements and new features**


v0.5
----

Expand Down
1 change: 1 addition & 0 deletions pip-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pycodestyle
nose2
Cython>=0.18
numpy>=1.8
setuptools

# required for building the docs
recommonmark
4 changes: 4 additions & 0 deletions postpic/datareader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ def chooseCode(code):
from .vsimhdf5 import Hdf5reader, VSimReader
setdumpreadercls(Hdf5reader)
setsimreadercls(VSimReader)
elif code.lower() in ['smilei']:
from .smileih5 import SmileiReader, SmileiSeries
setdumpreadercls(SmileiReader)
setsimreadercls(SmileiSeries)
elif code.lower() in ['dummy']:
from .dummy import Dummyreader, Dummysim
setdumpreadercls(Dummyreader)
Expand Down
11 changes: 9 additions & 2 deletions postpic/datareader/openPMDh5.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,23 @@ class OpenPMDreader(Dumpreader_ifc):
Args:
h5file : String
A String containing the relative Path to the .h5 file.
Kwargs:
iteration: Integer
An integer indicating the iteration to be loaded. Default is None, leading
to the first iteration found in the h5file.
'''

def __init__(self, h5file, **kwargs):
def __init__(self, h5file, iteration=None, **kwargs):
super(OpenPMDreader, self).__init__(h5file, **kwargs)
import os.path
import h5py
if not os.path.isfile(h5file):
raise IOError('File "' + str(h5file) + '" doesnt exist.')
self._h5 = h5py.File(h5file, 'r')
self._iteration = int(list(self._h5['data'].keys())[0])
self._iteration = iteration
if self._iteration is None:
self._iteration = int(list(self._h5['data'].keys())[0])
self._data = self._h5['/data/{:d}/'.format(self._iteration)]
self.attrs = self._data.attrs

Expand Down
Loading

0 comments on commit b4c758e

Please sign in to comment.