Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev to master #276

Merged
merged 15 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading