From 60c1d796137e2c01bdfba43cd268d2c582f8a0be Mon Sep 17 00:00:00 2001 From: OwenSelevert <68349996+OwenSlevert@users.noreply.github.com> Date: Wed, 24 Jul 2024 10:17:09 +0200 Subject: [PATCH] Added 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. --- postpic/datareader/smileih5.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/postpic/datareader/smileih5.py b/postpic/datareader/smileih5.py index e0a4a7c..c3aef55 100644 --- a/postpic/datareader/smileih5.py +++ b/postpic/datareader/smileih5.py @@ -216,9 +216,13 @@ 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 fields for the LaserEnvelope are real, therefor the hdf5-file has a slightly different struture. + 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)