diff --git a/lasy/laser.py b/lasy/laser.py index fe166676..64587849 100644 --- a/lasy/laser.py +++ b/lasy/laser.py @@ -139,7 +139,7 @@ def normalize(self, value, kind="energy"): else: raise ValueError(f'kind "{kind}" not recognized') - def propagate(self, distance, nr_boundary=None, backend="NP"): + def propagate(self, distance, nr_boundary=None, backend="NP", show_progress=True): """ Propagate the laser pulse by the distance specified. @@ -154,6 +154,8 @@ def propagate(self, distance, nr_boundary=None, backend="NP"): Only used for ``'rt'``. backend : string (optional) Backend used by axiprop (see axiprop documentation). + show_progress : bool (optional) + Whether to show a progress bar when performing the computation """ time_axis_indx = -1 @@ -211,7 +213,7 @@ def propagate(self, distance, nr_boundary=None, backend="NP"): for i_m in range(self.grid.azimuthal_modes.size): transform_data = np.transpose(field_fft[i_m]).copy() self.prop[i_m].step( - transform_data, distance, overwrite=True, show_progress=True + transform_data, distance, overwrite=True, show_progress=show_progress ) field_fft[i_m, :, :] = np.transpose(transform_data).copy() else: @@ -229,7 +231,7 @@ def propagate(self, distance, nr_boundary=None, backend="NP"): ) # Propagate the spectral image transform_data = np.transpose(field_fft).copy() - self.prop.step(transform_data, distance, overwrite=True, show_progress=True) + self.prop.step(transform_data, distance, overwrite=True, show_progress=show_progress) field_fft[:, :, :] = np.transpose(transform_data).copy() # Choose the time translation assuming propagation at v=c diff --git a/lasy/utils/phase_retrieval.py b/lasy/utils/phase_retrieval.py index 3339b51c..603283c6 100644 --- a/lasy/utils/phase_retrieval.py +++ b/lasy/utils/phase_retrieval.py @@ -65,11 +65,11 @@ def gerchberg_saxton_algo( i = 0 while breakout(cond): laser1.grid.field = amp1 * np.exp(1j * phase1) - laser1.propagate(dz) + laser1.propagate(dz, show_progress=False) phase2 = np.angle(laser1.grid.field) laser2.grid.field = amp2 * np.exp(1j * phase2) - laser2.propagate(-dz) + laser2.propagate(-dz, show_progress=False) phase1 = np.angle(laser2.grid.field) amp1_calc = np.abs(laser2.grid.field)