Skip to content

Commit

Permalink
smilei reader: add the possibility to process real fields (#287)
Browse files Browse the repository at this point in the history
Add the possibility to process real fields

The field of the laser envelope is real without imaginary part, therefore the structure of the hdf5 file is slightly different. With this small adjustment of getExpanded it is now possible to also process the real fields of Laser Envelope.
  • Loading branch information
OwenSlevert committed Aug 6, 2024
1 parent 9a3bec8 commit 315634f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions postpic/datareader/smileih5.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,14 @@ def _getExpanded(self, key, theta=0):

field_name = key+"_mode_"+str(mode)
field_array = np.array(self._data[field_name])
field_array_shape = field_array.shape
reshaped_array = field_array.reshape(field_array_shape[0], field_array_shape[1]//2, 2)
complex_array = reshaped_array[:, :, 0] + 1j * reshaped_array[:, :, 1]
# The Envelope Fields are real without imaginary part.
if key.startswith('Env_'):
complex_array = field_array
else:
field_array_shape = field_array.shape
reshaped_array = field_array.reshape(field_array_shape[0],
field_array_shape[1]//2, 2)
complex_array = reshaped_array[:, :, 0] + 1j * reshaped_array[:, :, 1]
array_list.append(complex_array)

# Modified array of shape (Nmodes, Nx, Nr)
Expand Down

0 comments on commit 315634f

Please sign in to comment.