From 28fa1ed4df4bcae7ac7bc87049d3e37dcbd86bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Chapoton?= Date: Fri, 12 Apr 2024 14:09:32 +0200 Subject: [PATCH] fix a bunch of typos (found by codespell) --- .../tutorials/1_Introduction-to-the-API.ipynb | 8 ++++---- .../tutorials/5_Laser-plasma_tools.ipynb | 2 +- openpmd_viewer/addons/pic/lpa_diagnostics.py | 20 +++++++++---------- .../data_reader/data_reader.py | 5 +++-- openpmd_viewer/openpmd_timeseries/main.py | 6 +++--- .../openpmd_timeseries/particle_tracker.py | 5 +++-- openpmd_viewer/openpmd_timeseries/plotter.py | 6 +++--- .../openpmd_timeseries/utilities.py | 2 +- 8 files changed, 28 insertions(+), 26 deletions(-) diff --git a/docs/source/tutorials/1_Introduction-to-the-API.ipynb b/docs/source/tutorials/1_Introduction-to-the-API.ipynb index 2c5c2068..58ccb743 100644 --- a/docs/source/tutorials/1_Introduction-to-the-API.ipynb +++ b/docs/source/tutorials/1_Introduction-to-the-API.ipynb @@ -150,7 +150,7 @@ "- A 2D array containing the values of the requested field.\n", "- An object containing metainformation about the extent of the grid (e.g `info_rho.z` and `info_rho.x` respectively return an array of the z and x positions).\n", "\n", - "These two objects can then be used in a Python environnement to perform numerical analysis." + "These two objects can then be used in a Python environment to perform numerical analysis." ] }, { @@ -208,7 +208,7 @@ "source": [ "### Additional documentation\n", "\n", - "Additional documentation on `get_field` can be obtained by reading its docstring. This can be done for instance by executing the following command in an IPython environnement." + "Additional documentation on `get_field` can be obtained by reading its docstring. This can be done for instance by executing the following command in an IPython environment." ] }, { @@ -351,7 +351,7 @@ "source": [ "### Missing or inconsistent arguments\n", "\n", - "As for the fieds, if an argument is missing or inconsistent, an exception will be raised and an helper message will be printed." + "As for the fields, if an argument is missing or inconsistent, an exception will be raised and an helper message will be printed." ] }, { @@ -361,7 +361,7 @@ "source": [ "### Additional documentation\n", "\n", - "As for the `get_field` method, the documentation on `get_particle` can be obtained by reading its docstring. This can be done for instance by executing the following command in an IPython environnement." + "As for the `get_field` method, the documentation on `get_particle` can be obtained by reading its docstring. This can be done for instance by executing the following command in an IPython environment." ] }, { diff --git a/docs/source/tutorials/5_Laser-plasma_tools.ipynb b/docs/source/tutorials/5_Laser-plasma_tools.ipynb index 502d8024..549350bb 100644 --- a/docs/source/tutorials/5_Laser-plasma_tools.ipynb +++ b/docs/source/tutorials/5_Laser-plasma_tools.ipynb @@ -355,7 +355,7 @@ "metadata": {}, "source": [ "#### Laser $a_0$\n", - "A method to calculate the laser strenght a0 as given by $$a0 = E_{max} e / (m_e c \\omega)$$" + "A method to calculate the laser strength a0 as given by $$a0 = E_{max} e / (m_e c \\omega)$$" ] }, { diff --git a/openpmd_viewer/addons/pic/lpa_diagnostics.py b/openpmd_viewer/addons/pic/lpa_diagnostics.py index 3a09cfb9..991abb47 100644 --- a/openpmd_viewer/addons/pic/lpa_diagnostics.py +++ b/openpmd_viewer/addons/pic/lpa_diagnostics.py @@ -227,7 +227,7 @@ def get_sigma_gamma_slice(self, dz, t=None, iteration=None, species=None, plot : bool, optional Whether to plot the requested quantity - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's `plot` method Returns @@ -270,7 +270,7 @@ def get_sigma_gamma_slice(self, dz, t=None, iteration=None, species=None, def get_charge( self, t=None, iteration=None, species=None, select=None ): """ - Calculate the charge of the selcted particles. + Calculate the charge of the selected particles. Parameters ---------- @@ -411,7 +411,7 @@ def get_emittance(self, t=None, iteration=None, species=None, raise ValueError('Argument `kind` not recognized.') if description not in ['projected', 'slice-averaged', 'all-slices']: raise ValueError('Argument `description` not recognized.') - # Wheter to compute slice emittance + # Whether to compute slice emittance do_slice_emittance = ( description in ['slice-averaged', 'all-slices'] ) if do_slice_emittance and not nslices > 0: @@ -496,11 +496,11 @@ def get_current( self, t=None, iteration=None, species=None, select=None, plot : bool, optional Whether to plot the requested quantity - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's `plot` method Returns ------- - A tuple of arrays containig + A tuple of arrays containing - The current in each bin in Ampere - A FieldMetaInformation object (see object's docstring for more details) @@ -511,7 +511,7 @@ def get_current( self, t=None, iteration=None, species=None, select=None, var_list=['z', 'uz', 'uy', 'ux', 'w', 'charge'], t=t, iteration=iteration, species=species, select=select ) - # Length to be seperated in bins + # Length to be separated in bins if w.size > 0: min_z = np.min(z) @@ -520,7 +520,7 @@ def get_current( self, t=None, iteration=None, species=None, select=None, gamma = np.sqrt(1 + ux ** 2 + uy ** 2 + uz ** 2) # Calculate particle velocities vz = uz / gamma * const.c - # Length to be seperated in bins + # Length to be separated in bins len_z = np.max(z) - np.min(z) vzq_sum, _ = np.histogram(z, bins=bins, weights=(vz * w * q)) # Calculate the current in each bin @@ -611,7 +611,7 @@ def get_laser_envelope( self, t=None, iteration=None, pol=None, along the 1st axis (first list) and 2nd axis (second list) Default: plots the full extent of the simulation box - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's `plot`(1D) or `imshow` (2D) method @@ -757,7 +757,7 @@ def get_spectrum( self, t=None, iteration=None, pol=None, plot: bool, optional Whether to plot the data - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's `plot` method Returns @@ -1016,7 +1016,7 @@ def get_spectrogram( self, t=None, iteration=None, pol=None, plot: bool, optional Whether to plot the spectrogram - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's `imshow` method Returns diff --git a/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py b/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py index dd1c2c4b..1db130b3 100644 --- a/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py +++ b/openpmd_viewer/openpmd_timeseries/data_reader/data_reader.py @@ -59,7 +59,7 @@ def __init__(self, backend): def list_iterations(self, path_to_dir): """ Return a list of the iterations that correspond to the files - in this directory. (The correspondance between iterations and + in this directory. (The correspondence between iterations and files is stored internally.) Parameter @@ -107,7 +107,8 @@ def list_iterations(self, path_to_dir): file_path = path_to_dir series_name = file_path else: - # match last occurance of integers and replace with %T wildcards + # match last occurrence of integers and replace + # with %T wildcards # examples: data00000100.h5 diag4_00000500.h5 io12.0.bp # te42st.1234.yolo.json scan7_run14_data123.h5 file_path = re.sub(r'(\d+)(\.(?!\d).+$)', r'%T\2', first_file_name) diff --git a/openpmd_viewer/openpmd_timeseries/main.py b/openpmd_viewer/openpmd_timeseries/main.py index 55e2077a..ed8a7e50 100644 --- a/openpmd_viewer/openpmd_timeseries/main.py +++ b/openpmd_viewer/openpmd_timeseries/main.py @@ -200,7 +200,7 @@ def get_particle(self, var_list=None, species=None, t=None, iteration=None, particles affects neighboring bins. `cic` (which is the default) leads to smoother results than `ngp`. - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's hist or hist2d. @@ -425,7 +425,7 @@ def get_field(self, field=None, coord=None, t=None, iteration=None, along the 1st axis (first list) and 2nd axis (second list) Default: plots the full extent of the simulation box - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's imshow. Returns @@ -555,7 +555,7 @@ def iterate( self, called_method, *args, **kwargs ): Arguments that would normally be passed to `called_method` for a single iteration. Do not pass the argument `t` or `iteration`. """ - # Add the iteration key in the keyword aguments + # Add the iteration key in the keyword arguments kwargs['iteration'] = self.iterations[0] # Check the shape of results diff --git a/openpmd_viewer/openpmd_timeseries/particle_tracker.py b/openpmd_viewer/openpmd_timeseries/particle_tracker.py index 86e275a9..6539cfdb 100644 --- a/openpmd_viewer/openpmd_timeseries/particle_tracker.py +++ b/openpmd_viewer/openpmd_timeseries/particle_tracker.py @@ -87,7 +87,8 @@ def __init__(self, ts, species=None, t=None, In this case, a NaN is returned at the index of this particle. When `preserve_particle_index=False`, no NaN is returned (the returned array is simply smaller when particles are absent) but - then it is not garanteed that a given particle keeps the same index + then it is not guaranteed that a given particle keeps the same + index """ # Extract or load the particle id and sort them @@ -220,7 +221,7 @@ def get_extraction_indices( self, pid ): sorted_pid = pid[ original_indices ] # Extract only the indices for which sorted_pid is one of pid - # in self.sselected_pid (i.e. which correpond to one + # in self.sselected_pid (i.e. which correspond to one # of the original particles) selected_indices = np.empty( self.N_selected, dtype=np.int64 ) N_extracted = extract_indices( diff --git a/openpmd_viewer/openpmd_timeseries/plotter.py b/openpmd_viewer/openpmd_timeseries/plotter.py index 85851727..ef09bec0 100644 --- a/openpmd_viewer/openpmd_timeseries/plotter.py +++ b/openpmd_viewer/openpmd_timeseries/plotter.py @@ -145,7 +145,7 @@ def hist1d(self, q1, w, quantity1, species, current_i, nbins, hist_range, particles affects neighboring bins. `cic` (which is the default) leads to smoother results than `ngp`. - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's bar function """ # Check if matplotlib is available @@ -222,7 +222,7 @@ def hist2d(self, q1, q2, w, quantity1, quantity2, species, current_i, particles affects neighboring bins. `cic` (which is the default) leads to smoother results than `ngp`. - **kw : dict, otional + **kw : dict, optional Additional options to be passed to matplotlib's imshow function """ # Check if matplotlib is available @@ -411,7 +411,7 @@ def print_cic_unavailable(): def check_matplotlib(): """Raise error messages or warnings when potential issues when - potenial issues with matplotlib are detected.""" + potential issues with matplotlib are detected.""" if not matplotlib_installed: raise RuntimeError( "Failed to import the openPMD-viewer plotter.\n" diff --git a/openpmd_viewer/openpmd_timeseries/utilities.py b/openpmd_viewer/openpmd_timeseries/utilities.py index 18f51e4c..b9339088 100644 --- a/openpmd_viewer/openpmd_timeseries/utilities.py +++ b/openpmd_viewer/openpmd_timeseries/utilities.py @@ -336,7 +336,7 @@ def construct_3d_from_circ( F3d, Fcirc, x_array, y_array, modes, else: raise Exception(order_error_msg) - # Loop over all modes and recontruct data + # Loop over all modes and reconstruct data if r == 0: expItheta = 1. + 0.j else: