diff --git a/.cspell/custom-dictionary.txt b/.cspell/custom-dictionary.txt new file mode 100644 index 00000000..bf0e50d9 --- /dev/null +++ b/.cspell/custom-dictionary.txt @@ -0,0 +1,405 @@ +# Custom Dictionary Words +allclose +ALLUSERSPROFILE +appauthor +appname +arange +archiver +argmin +arot +ARPES +arraysum +ascale +astype +atleast +automodule +autoselect +axhline +axind +AXISNAME +axmax +axmin +axvline +beamline +Beamlines +beamtime +bestmark +bfill +binsearch +binsize +binwidth +blas +bvec +caldir +calib +calibdict +cdeform +cdeformfield +cdisp +centroidnn +chessy +clim +cmap +coeffs +coldist +colgrid +COLLECTIONCOLUMN +colname +colsize +COMPES +coordmat +coordtype +countrate +cryo +cstart +cstep +csvfile +custom-dictionary +cval +cvdist +dask +datacheck +dataconverter +dataformat +dataframe +dataframes +datastreams +datestring +ddir +delaxes +Desy +dfield +dfops +dfpart +dfpid +dictionarized +dictmerge +dropna +dset +dsets +dtype +ecalibdict +electronanalyser +endstation +energycal +energycalfolder +ENERGYDISPERSION +ENOSPC +equiscale +Eref +evpoly +exfel +Extr +faddr +Faradayweg +fastdtw +featranges +ffill +figsize +figsz +filenotfound +fixedvertex +flatidx +fluence +fontsize +ftype +fwhm +genindex +getgid +gpfs +griddata +gridplot +groupnames +halfbinsize +HEXTOF +histdd +histkwds +histogramdd +histtype +histvals +homography +hypervolume +iloc +IMAGEJ +imgj +imkwds +imread +imshow +imwrite +incrementation +inequivalent +interp +ipykernel +ipympl +ipynb +ipython +ipywidgets +isel +itemsize +joblib +jpars +jupyterlab +kmodem +KTOF +kwds +leastsq +legkwds +levelname +linalg +linekwds +linesegkwds +linewidth +literalinclude +lmfit +lmkcenter +lsqr +lstsq +macrobunch +macrobunches +Maklar +mapkwds +markersize +maxdepth +maxs +maxsplit +mbar +mcvdist +mdist +meshgrid +microbunch +microbunches +mirrorutil +mnpos +modindex +monochromatized +monochromator +moveaxis +mpes +msmarker +multidetector +Multiindex +multiindexed +mvvdist +mxpos +mycopy +myfantasymethod +myfantasyscale +mymakedirs +nanos +nans +narray +natsort +natsorted +nbagg +nbin +nbins +ncol +ncols +ndarray +ndarrays +ndim +ndimage +ndims +nesteddict +nestedentry +newaxis +newcenters +newranges +NFDI +nocomp +nogil +nopython +noreorder +normspec +npartitions +npid +nranges +nrow +nrows +nspec +ntasks +ntraces +numba +numpy +nvals +nxdl +ontop +OPCPA +openmp +OPTICALDELAY +otherax +Pandoc +pathcorr +pbar +pcent +pcolormesh +pcshare +peakdetect +peaksearch +Pfront +pfunc +pipx +pkmaxs +pkwindow +platformdirs +pmean +pointops +pointset +polyorder +posx +prefs +printfuncs +psutil +ptargs +pval +pyarrow +pyenv +pynxtools +pyproject +pytest +quantile +randn +rcond +rdeform +rdet +rdisp +refid +Rettig +rotsym +rowdist +rowgrid +rstart +rstep +rtol +rvbin +rvbins +rvname +rvranges +rvrg +savgol +scalings +scandir +scatt +scatterkwds +scicat +SDIAG +sdir +segs +sfile +Sixten +specnorm +splinewarp +stackax +stackaxis +stepsize +subdir +subdirs +subfolders +symscores +targcenter +termorder +textshift +textsize +threadpool +threadpoolctl +tifffile +TIMINGINFO +Tmain +Tmat +tmpdirname +toctree +tofseg +tqdm +traceseg +trseg +Tsec +txtsize +TZCYXS +tzoffset +ubid +UDLD +unbinned +uncategorised +undoc +varnames +venv +verts +vmax +voxels +VTOF +vvdist +warptype +wespe +xarr +xarray +xaxis +xcirc +xdata +xind +Xinstrument +xlabel +Xmpes +XPES +xpos +xratio +xrng +xscale +xtrans +Xuser +xval +ycirc +ydata +yincrease +ylabel +ypos +yratio +yscale +ytrans +Zenodo +zraw +typehints +sphinxext +nbsphinx +autoclass +bysource +rtype +nbformat +pygments +nbconvert +codemirror +kernelspec +isinstance +pyplot +matplotlib +pathlib +autoreload +getmtime +utime +zfill +expanduser +datafile +autosummary +errorbar +fdir +fprocessing +datafolder +parallelly +histdict +shutil +isdir +linspace +mypy +pyupgrade +nbstripout +timeit +pullrequest +tibdex +packetcoders +easimon +dpkg +zain +sohail +pypi +pypa +cobertura +coverallsapp diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e3eb2938..bd8a09fd 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -34,7 +34,7 @@ jobs: - name: Install project dependencies run: poetry install - # Run benchmakrs + # Run benchmarks - name: Run benchmarks on python 3.8 run: | poetry run pytest --full-trace --show-capture=no -sv benchmarks/benchmark_*.py diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index e750911c..ed686550 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -22,11 +22,11 @@ jobs: python-version: 3.8 poetry-version: 1.2.2 - # Linting steps, excute all linters even if one fails + # Linting steps, execute all linters even if one fails - name: ruff run: poetry run ruff sed tests - - name: ruff formating + - name: ruff formatting if: ${{ always() }} run: poetry run ruff format --check sed tests @@ -34,3 +34,10 @@ jobs: if: ${{ always() }} run: poetry run mypy sed tests + - name: spellcheck + if: ${{ always() }} + uses: streetsidesoftware/cspell-action@v6 + with: + check_dot_files: false + incremental_files_only: false + config: './cspell.json' diff --git a/.github/workflows/update_dependencies.yml b/.github/workflows/update_dependencies.yml index 78b60002..3735d2e6 100644 --- a/.github/workflows/update_dependencies.yml +++ b/.github/workflows/update_dependencies.yml @@ -1,4 +1,4 @@ -name: Update depencies in poetry lockfile +name: Update dependencies in poetry lockfile on: schedule: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7f535dab..e94afa05 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,3 +42,7 @@ repos: rev: 0.6.0 hooks: - id: nbstripout +- repo: https://github.com/streetsidesoftware/cspell-cli + rev: v6.31.1 + hooks: + - id: cspell diff --git a/benchmarks/Binning Benchmarks.ipynb b/benchmarks/Binning Benchmarks.ipynb index c54873e8..45e85ccb 100644 --- a/benchmarks/Binning Benchmarks.ipynb +++ b/benchmarks/Binning Benchmarks.ipynb @@ -10,7 +10,7 @@ "source": [ "# Binning demonstration on locally generated fake data\n", "In this example, we generate a table with random data simulating a single event dataset.\n", - "We showcase the binning method, first on a simple single table using the bin_partition method and then in the distributed mehthod bin_dataframe, using daks dataframes.\n", + "We showcase the binning method, first on a simple single table using the bin_partition method and then in the distributed method bin_dataframe, using daks dataframes.\n", "The first method is never really called directly, as it is simply the function called by the bin_dataframe on each partition of the dask dataframe." ] }, @@ -200,7 +200,7 @@ "metadata": {}, "outputs": [], "source": [ - "data_path = '../../' # Put in Path to a storage of at least 20 Gbyte free space.\n", + "data_path = '../../' # Put in Path to a storage of at least 20 GByte free space.\n", "if not os.path.exists(data_path + \"/WSe2.zip\"):\n", " os.system(f\"curl --output {data_path}/WSe2.zip https://zenodo.org/record/6369728/files/WSe2.zip\")\n", "if not os.path.isdir(data_path + \"/Scan049_1\") or not os.path.isdir(data_path + \"energycal_2019_01_08/\"):\n", diff --git a/benchmarks/mpes_sed_benchmarks.ipynb b/benchmarks/mpes_sed_benchmarks.ipynb index 605ad175..2b657dae 100644 --- a/benchmarks/mpes_sed_benchmarks.ipynb +++ b/benchmarks/mpes_sed_benchmarks.ipynb @@ -48,7 +48,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataPath = '../../' # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataPath = '../../' # Put in Path to a storage of at least 20 GByte free space.\n", "if not os.path.exists(dataPath + \"/WSe2.zip\"):\n", " os.system(f\"curl --output {dataPath}/WSe2.zip https://zenodo.org/record/6369728/files/WSe2.zip\")\n", "if not os.path.isdir(dataPath + \"/Scan049_1\") or not os.path.isdir(dataPath + \"energycal_2019_01_08/\"):\n", @@ -106,7 +106,7 @@ "metadata": {}, "source": [ "## compute distributed binning on the partitioned dask dataframe\n", - "We generated 100 dataframe partiions from the 100 files in the dataset, which we will bin parallelly with the dataframe binning function into a 3D grid" + "We generated 100 dataframe partitions from the 100 files in the dataset, which we will bin parallelly with the dataframe binning function into a 3D grid" ] }, { diff --git a/cspell.json b/cspell.json new file mode 100644 index 00000000..5826d5ab --- /dev/null +++ b/cspell.json @@ -0,0 +1,22 @@ +{ + "version": "0.2", + "ignorePaths": [ + "./tests/data/*", + "*.toml", + "Makefile", + "*.bat" + ], + "dictionaryDefinitions": [ + { + "name": "custom-dictionary", + "path": "./.cspell/custom-dictionary.txt", + "addWords": true + } + ], + "dictionaries": [ "custom-dictionary" + ], + "words": [], + "ignoreWords": [], + "import": [], + "language": "en-GB, en-US" +} diff --git a/docs/misc/contributing.rst b/docs/misc/contributing.rst index 21d1c484..ab12e517 100644 --- a/docs/misc/contributing.rst +++ b/docs/misc/contributing.rst @@ -73,7 +73,7 @@ Development Workflow 3. **Write Tests:** If your contribution introduces new features or fixes a bug, add tests to cover your changes. -4. **Run Tests:** To ensure no funtionality is broken, run the tests: +4. **Run Tests:** To ensure no functionality is broken, run the tests: .. code-block:: bash diff --git a/docs/misc/maintain.rst b/docs/misc/maintain.rst index 6e887502..486f426a 100644 --- a/docs/misc/maintain.rst +++ b/docs/misc/maintain.rst @@ -140,7 +140,7 @@ To create a release, follow these steps: c. **If you don't see update on PyPI:** - Visit the GitHub Actions page and monitor the Release workflow (https://github.com/OpenCOMPES/sed/actions/workflows/release.yml). - - Check if errors occured. + - Check if errors occurred. **Understanding the Release Workflow** diff --git a/docs/sed/config.rst b/docs/sed/config.rst index c5457fe0..c5eac7a2 100644 --- a/docs/sed/config.rst +++ b/docs/sed/config.rst @@ -1,11 +1,11 @@ Config =================================================== -The config module contains a mechanis to collect configuration parameters from various sources and configuration files, and to combine them in a hierachical manner into a single, consistent configuration dictionary. +The config module contains a mechanics to collect configuration parameters from various sources and configuration files, and to combine them in a hierarchical manner into a single, consistent configuration dictionary. It will load an (optional) provided config file, or alternatively use a passed python dictionary as initial config dictionary, and subsequently look for the following additional config files to load: * ``folder_config``: A config file of name :file:`sed_config.yaml` in the current working directory. This is mostly intended to pass calibration parameters of the workflow between different notebook instances. -* ``user_config``: A config file provided by the user, stored as :file:`.sed/config.yaml` in the current user's home directly. This is intended to give a user the option for individual configuration modifications of system settings. -* ``system_config``: A config file provided by the system administrator, stored as :file:`/etc/sed/config.yaml` on Linux-based systems, and :file:`%ALLUSERPROFILE%/sed/config.yaml` on Windows. This should provide all necessary default parameters for using the sed processor with a given setup. For an example for an mpes setup, see :ref:`example_config` +* ``user_config``: A config file provided by the user, stored as :file:`.config/sed/config.yaml` in the current user's home directly. This is intended to give a user the option for individual configuration modifications of system settings. +* ``system_config``: A config file provided by the system administrator, stored as :file:`/etc/sed/config.yaml` on Linux-based systems, and :file:`%ALLUSERSPROFILE%/sed/config.yaml` on Windows. This should provide all necessary default parameters for using the sed processor with a given setup. For an example for an mpes setup, see :ref:`example_config` * ``default_config``: The default configuration shipped with the package. Typically, all parameters here should be overwritten by any of the other configuration files. The config mechanism returns the combined dictionary, and reports the loaded configuration files. In order to disable or overwrite any of the configuration files, they can be also given as optional parameters (path to a file, or python dictionary). diff --git a/docs/sed/dataset.rst b/docs/sed/dataset.rst index 6a8c57f8..05bd94c0 100644 --- a/docs/sed/dataset.rst +++ b/docs/sed/dataset.rst @@ -64,7 +64,7 @@ Setting the “use_existing” keyword to False allows to download the data in a Interrupting extraction has similar behavior to download and just continues from where it stopped. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -Or if user deletes the extracted documents, it reextracts from zip file +Or if user deletes the extracted documents, it re-extracts from zip file ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' .. code:: python diff --git a/sed/binning/binning.py b/sed/binning/binning.py index 0f5a1824..28daeb80 100644 --- a/sed/binning/binning.py +++ b/sed/binning/binning.py @@ -52,7 +52,7 @@ def bin_partition( - an integer describing the number of bins for all dimensions. This requires "ranges" to be defined as well. - A sequence containing one entry of the following types for each - dimenstion: + dimension: - an integer describing the number of bins. This requires "ranges" to be defined as well. @@ -83,14 +83,14 @@ def bin_partition( jittering. To specify the jitter amplitude or method (normal or uniform noise) a dictionary can be passed. This should look like jitter={'axis':{'amplitude':0.5,'mode':'uniform'}}. - This example also shows the default behaviour, in case None is + This example also shows the default behavior, in case None is passed in the dictionary, or jitter is a list of strings. Warning: this is not the most performing approach. Applying jitter on the dataframe before calling the binning is much faster. Defaults to None. return_edges (bool, optional): If True, returns a list of D arrays describing the bin edges for each dimension, similar to the - behaviour of ``np.histogramdd``. Defaults to False. + behavior of ``np.histogramdd``. Defaults to False. skip_test (bool, optional): Turns off input check and data transformation. Defaults to False as it is intended for internal use only. Warning: setting this True might make error tracking difficult. @@ -134,7 +134,7 @@ def bin_partition( else: bins = cast(List[int], bins) # shift ranges by half a bin size to align the bin centers to the given ranges, - # as the histogram functions interprete the ranges as limits for the edges. + # as the histogram functions interpret the ranges as limits for the edges. for i, nbins in enumerate(bins): halfbinsize = (ranges[i][1] - ranges[i][0]) / (nbins) / 2 ranges[i] = ( @@ -234,7 +234,7 @@ def bin_dataframe( - an integer describing the number of bins for all dimensions. This requires "ranges" to be defined as well. - A sequence containing one entry of the following types for each - dimenstion: + dimension: - an integer describing the number of bins. This requires "ranges" to be defined as well. @@ -273,7 +273,7 @@ def bin_dataframe( jittering. To specify the jitter amplitude or method (normal or uniform noise) a dictionary can be passed. This should look like jitter={'axis':{'amplitude':0.5,'mode':'uniform'}}. - This example also shows the default behaviour, in case None is + This example also shows the default behavior, in case None is passed in the dictionary, or jitter is a list of strings. Warning: this is not the most performing approach. applying jitter on the dataframe before calling the binning is much faster. @@ -479,7 +479,7 @@ def normalization_histogram_from_timed_dataframe( bin_centers: np.ndarray, time_unit: float, ) -> xr.DataArray: - """Get a normalization histogram from a timed datafram. + """Get a normalization histogram from a timed dataframe. Args: df (dask.dataframe.DataFrame): a dask.DataFrame on which to perform the diff --git a/sed/binning/numba_bin.py b/sed/binning/numba_bin.py index 28530c12..d62986d4 100644 --- a/sed/binning/numba_bin.py +++ b/sed/binning/numba_bin.py @@ -24,7 +24,7 @@ def _hist_from_bin_range( bit integers. Args: - sample (np.ndarray): The data to be histogrammed with shape N,D. + sample (np.ndarray): The data to be histogram'd with shape N,D. bins (Sequence[int]): The number of bins for each dimension D. ranges (np.ndarray): A sequence of length D, each an optional (lower, upper) tuple giving the outer bin edges to be used if the edges are @@ -49,7 +49,7 @@ def _hist_from_bin_range( for i in range(ndims): delta[i] = 1 / ((ranges[i, 1] - ranges[i, 0]) / bins[i]) - strides[i] = hist.strides[i] // hist.itemsize # pylint: disable=E1136 + strides[i] = hist.strides[i] // hist.itemsize for t in range(sample.shape[0]): is_inside = True @@ -157,7 +157,7 @@ def numba_histogramdd( bins: Union[int, Sequence[int], Sequence[np.ndarray], np.ndarray], ranges: Sequence = None, ) -> Tuple[np.ndarray, List[np.ndarray]]: - """Multidimensional histogramming function, powered by Numba. + """Multidimensional histogram function, powered by Numba. Behaves in total much like numpy.histogramdd. Returns uint32 arrays. This was chosen because it has a significant performance improvement over @@ -167,7 +167,7 @@ def numba_histogramdd( sizes. Args: - sample (np.ndarray): The data to be histogrammed with shape N,D + sample (np.ndarray): The data to be histogram'd with shape N,D bins (Union[int, Sequence[int], Sequence[np.ndarray], np.ndarray]): The number of bins for each dimension D, or a sequence of bin edges on which to calculate the histogram. diff --git a/sed/binning/utils.py b/sed/binning/utils.py index d791c8b8..a106e2c7 100644 --- a/sed/binning/utils.py +++ b/sed/binning/utils.py @@ -39,7 +39,7 @@ def simplify_binning_arguments( - an integer describing the number of bins for all dimensions. This requires "ranges" to be defined as well. - A sequence containing one entry of the following types for each - dimenstion: + dimension: - an integer describing the number of bins. This requires "ranges" to be defined as well. @@ -123,7 +123,7 @@ def simplify_binning_arguments( f"Ranges must be a sequence, not {type(ranges)}.", ) - # otherwise, all bins should by np.ndarrays here + # otherwise, all bins should be of type np.ndarray here elif all(isinstance(x, np.ndarray) for x in bins): bins = cast(List[np.ndarray], list(bins)) else: diff --git a/sed/calibrator/delay.py b/sed/calibrator/delay.py index 55fabd06..c983c6ba 100644 --- a/sed/calibrator/delay.py +++ b/sed/calibrator/delay.py @@ -103,7 +103,7 @@ def append_delay_axis( Returns: Union[pd.DataFrame, dask.dataframe.DataFrame]: dataframe with added column - and delay calibration metdata dictionary. + and delay calibration metadata dictionary. """ # pylint: disable=duplicate-code if calibration is None: @@ -407,7 +407,7 @@ def mm_to_ps( delay_mm: Union[float, np.ndarray], time0_mm: float, ) -> Union[float, np.ndarray]: - """Converts a delaystage position in mm into a relative delay in picoseconds + """Converts a delay stage position in mm into a relative delay in picoseconds (double pass). Args: diff --git a/sed/calibrator/energy.py b/sed/calibrator/energy.py index d05e22e4..2f799576 100644 --- a/sed/calibrator/energy.py +++ b/sed/calibrator/energy.py @@ -446,7 +446,7 @@ def add_ranges( traces (np.ndarray, optional): Collection of energy dispersion curves. Defaults to self.traces_normed. infer_others (bool, optional): Option to infer the feature detection range - in other traces from a given one using a time warp algorthm. + in other traces from a given one using a time warp algorithm. Defaults to True. mode (str, optional): Specification on how to change the feature ranges ('append' or 'replace'). Defaults to "replace". @@ -1157,7 +1157,7 @@ def common_apply_func(apply: bool): # noqa: ARG001 update(correction["amplitude"], x_center, y_center, diameter=correction["diameter"]) except KeyError as exc: raise ValueError( - "Parameter 'diameter' required for correction type 'sperical', ", + "Parameter 'diameter' required for correction type 'spherical', ", "but not present!", ) from exc @@ -1339,7 +1339,7 @@ def apply_energy_correction( Defaults to config["energy"]["correction_type"]. amplitude (float, optional): Amplitude of the time-of-flight correction term. Defaults to config["energy"]["correction"]["correction_type"]. - correction (dict, optional): Correction dictionary containing paramters + correction (dict, optional): Correction dictionary containing parameters for the correction. Defaults to self.correction or config["energy"]["correction"]. verbose (bool, optional): Option to print out diagnostic information. @@ -1939,7 +1939,7 @@ def _datacheck_peakdetect( x_axis: np.ndarray, y_axis: np.ndarray, ) -> Tuple[np.ndarray, np.ndarray]: - """Input format checking for 1D peakdtect algorithm + """Input format checking for 1D peakdetect algorithm Args: x_axis (np.ndarray): x-axis array @@ -2109,7 +2109,7 @@ def fit_energy_calibration( binwidth (float): Time width of each original TOF bin in ns. binning (int): Binning factor of the TOF values. ref_id (int, optional): Reference dataset index. Defaults to 0. - ref_energy (float, optional): Energy value of the feature in the refence + ref_energy (float, optional): Energy value of the feature in the reference trace (eV). required to output the calibration. Defaults to None. t (Union[List[float], np.ndarray], optional): Array of TOF values. Required to calculate calibration trace. Defaults to None. @@ -2131,7 +2131,7 @@ def fit_energy_calibration( Returns: dict: A dictionary of fitting parameters including the following, - - "coeffs": Fitted function coefficents. + - "coeffs": Fitted function coefficients. - "axis": Fitted energy axis. """ vals = np.asarray(vals) @@ -2248,7 +2248,7 @@ def poly_energy_calibration( each EDC. order (int, optional): Polynomial order of the fitting function. Defaults to 3. ref_id (int, optional): Reference dataset index. Defaults to 0. - ref_energy (float, optional): Energy value of the feature in the refence + ref_energy (float, optional): Energy value of the feature in the reference trace (eV). required to output the calibration. Defaults to None. t (Union[List[float], np.ndarray], optional): Array of TOF values. Required to calculate calibration trace. Defaults to None. diff --git a/sed/calibrator/momentum.py b/sed/calibrator/momentum.py index fea591cb..bcd9611e 100644 --- a/sed/calibrator/momentum.py +++ b/sed/calibrator/momentum.py @@ -337,7 +337,7 @@ def add_features( Option to calculate symmetry scores. Defaults to False. **kwds: Keyword arguments. - - **symtype** (str): Type of symmetry scores to calculte + - **symtype** (str): Type of symmetry scores to calculate if symscores is True. Defaults to "rotation". Raises: @@ -612,7 +612,7 @@ def spline_warp_estimate( interp_order (int, optional): Order of interpolation (see ``scipy.ndimage.map_coordinates()``). Defaults to 1. - ascale: (Union[float, np.ndarray], optional): Scale parameter determining a realtive + ascale: (Union[float, np.ndarray], optional): Scale parameter determining a relative scale for each symmetry feature. If provided as single float, rotsym has to be 4. This parameter describes the relative scaling between the two orthogonal symmetry directions (for an orthorhombic system). This requires the correction points to be @@ -785,7 +785,7 @@ def spline_warp_estimate( self.slice_corrected = corrected_image if verbose: - print("Calulated thin spline correction based on the following landmarks:") + print("Calculated thin spline correction based on the following landmarks:") print(f"pouter: {self.pouter}") if use_center: print(f"pcent: {self.pcent}") @@ -887,7 +887,7 @@ def coordinate_transform( - rotation_auto. - scaling. - scaling_auto. - - homomorphy. + - homography. keep (bool, optional): Option to keep the specified coordinate transform in the class. Defaults to False. @@ -1007,7 +1007,7 @@ def coordinate_transform( ) self.slice_transformed = slice_transformed else: - # if external image is provided, apply only the new addional tranformation + # if external image is provided, apply only the new additional transformation slice_transformed = ndi.map_coordinates( image, [rdeform, cdeform], @@ -1040,7 +1040,7 @@ def pose_adjustment( Args: transformations (dict, optional): Dictionary with transformations. - Defaults to self.transformations or config["momentum"]["transformtions"]. + Defaults to self.transformations or config["momentum"]["transformations"]. apply (bool, optional): Option to directly apply the provided transformations. Defaults to False. @@ -1417,11 +1417,10 @@ def select_k_range( equiscale: bool = True, apply: bool = False, ): - """Interactive selection function for features for the Momentum axes calibra- - tion. It allows the user to select the pixel positions of two symmetry points - (a and b) and the k-space distance of the two. Alternatively, the corrdinates - of both points can be provided. See the equiscale option for details on the - specifications of point coordinates. + """Interactive selection function for features for the Momentum axes calibration. It allows + the user to select the pixel positions of two symmetry points (a and b) and the k-space + distance of the two. Alternatively, the coordinates of both points can be provided. See the + equiscale option for details on the specifications of point coordinates. Args: point_a (Union[np.ndarray, List[int]], optional): Pixel coordinates of the @@ -1690,7 +1689,7 @@ def apply_corrections( Args: df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to apply - the distotion correction to. + the distortion correction to. x_column (str, optional): Label of the 'X' column before momentum distortion correction. Defaults to config["momentum"]["x_column"]. y_column (str, optional): Label of the 'Y' column before momentum @@ -1781,11 +1780,11 @@ def gather_correction_metadata(self) -> dict: metadata["registration"]["creation_date"] = datetime.now().timestamp() metadata["registration"]["applied"] = True metadata["registration"]["depends_on"] = ( - "/entry/process/registration/tranformations/rot_z" + "/entry/process/registration/transformations/rot_z" if "angle" in metadata["registration"] and metadata["registration"]["angle"] - else "/entry/process/registration/tranformations/trans_y" + else "/entry/process/registration/transformations/trans_y" if "xtrans" in metadata["registration"] and metadata["registration"]["xtrans"] - else "/entry/process/registration/tranformations/trans_x" + else "/entry/process/registration/transformations/trans_x" if "ytrans" in metadata["registration"] and metadata["registration"]["ytrans"] else "." ) @@ -1809,7 +1808,7 @@ def gather_correction_metadata(self) -> dict: [0.0, 1.0, 0.0], ) metadata["registration"]["trans_y"]["depends_on"] = ( - "/entry/process/registration/tranformations/trans_x" + "/entry/process/registration/transformations/trans_x" if "ytrans" in metadata["registration"] and metadata["registration"]["ytrans"] else "." ) @@ -1825,9 +1824,9 @@ def gather_correction_metadata(self) -> dict: (metadata["registration"]["center"], [0.0]), ) metadata["registration"]["rot_z"]["depends_on"] = ( - "/entry/process/registration/tranformations/trans_y" + "/entry/process/registration/transformations/trans_y" if "xtrans" in metadata["registration"] and metadata["registration"]["xtrans"] - else "/entry/process/registration/tranformations/trans_x" + else "/entry/process/registration/transformations/trans_x" if "ytrans" in metadata["registration"] and metadata["registration"]["ytrans"] else "." ) @@ -1848,7 +1847,7 @@ def append_k_axis( Args: df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to apply the - distotion correction to. + distortion correction to. x_column (str, optional): Label of the source 'X' column. Defaults to config["momentum"]["corrected_x_column"] or config["momentum"]["x_column"] (whichever is present). @@ -1895,7 +1894,7 @@ def append_k_axis( calibration["creation_date"] = datetime.now().timestamp() try: - (df[new_x_column], df[new_y_column]) = detector_coordiantes_2_k_koordinates( + (df[new_x_column], df[new_y_column]) = detector_coordinates_2_k_coordinates( r_det=df[x_column], c_det=df[y_column], r_start=calibration["rstart"], @@ -1951,7 +1950,7 @@ def cm2palette(cmap_name: str) -> list: cmap_name (str): Name of the colormap/palette. Returns: - list: List of colors in hex representation (a bokoeh palette). + list: List of colors in hex representation (a bokeh palette). """ if cmap_name in bp.all_palettes.keys(): palette_func = getattr(bp, cmap_name) @@ -1995,7 +1994,7 @@ def dictmerge( return main_dict -def detector_coordiantes_2_k_koordinates( +def detector_coordinates_2_k_coordinates( r_det: float, c_det: float, r_start: float, @@ -2007,7 +2006,7 @@ def detector_coordiantes_2_k_koordinates( r_step: float, c_step: float, ) -> Tuple[float, float]: - """Conversion from detector coordinates (rdet, cdet) to momentum coordinates + """Conversion from detector coordinates (r_det, c_det) to momentum coordinates (kr, kc). Args: @@ -2046,7 +2045,7 @@ def apply_dfield( Args: df (Union[pd.DataFrame, dask.dataframe.DataFrame]): Dataframe to apply the - distotion correction to. + distortion correction to. dfield (np.ndarray): The distortion correction field. 3D matrix, with column and row distortion fields stacked along the first dimension. x_column (str): Label of the 'X' source column. @@ -2078,7 +2077,7 @@ def generate_inverse_dfield( bin_ranges: List[Tuple], detector_ranges: List[Tuple], ) -> np.ndarray: - """Generate inverse deformation field using inperpolation with griddata. + """Generate inverse deformation field using interpolation with griddata. Assuming the binning range of the input ``rdeform_field`` and ``cdeform_field`` covers the whole detector. diff --git a/sed/config/NXmpes_config.json b/sed/config/NXmpes_config.json index 94861027..a636ef62 100755 --- a/sed/config/NXmpes_config.json +++ b/sed/config/NXmpes_config.json @@ -353,7 +353,7 @@ }, "/ENTRY[entry]/PROCESS[process]/REGISTRATION[registration]": { "depends_on": "@attrs:metadata/momentum_correction/registration/depends_on", - "TRANSFORMATIONS[tranformations]": { + "TRANSFORMATIONS[transformations]": { "AXISNAME[trans_x]": "@attrs:metadata/momentum_correction/registration/trans_x/value", "AXISNAME[trans_x]/@transformation_type": "@attrs:metadata/momentum_correction/registration/trans_x/type", "AXISNAME[trans_x]/@units": "@attrs:metadata/momentum_correction/registration/trans_x/units", diff --git a/sed/config/default.yaml b/sed/config/default.yaml index b75b42d9..d0f779be 100644 --- a/sed/config/default.yaml +++ b/sed/config/default.yaml @@ -37,9 +37,9 @@ dataframe: adc_binning: 1 # list of columns to apply jitter to. jitter_cols: ["@x_column", "@y_column", "@tof_column"] - # Jitter amplitude or list of jitter amplitudes. Should equal half the digitial step size of each jitter_column + # Jitter amplitude or list of jitter amplitudes. Should equal half the digital step size of each jitter_column jitter_amps: 0.5 - # Time stepping in seconds of the succesive events in the timed dataframe + # Time stepping in seconds of the successive events in the timed dataframe timed_dataframe_unit_time: 0.001 energy: @@ -57,7 +57,7 @@ energy: fastdtw_radius: 2 # Window around a peak to make sure that no other peaks are present peak_window: 7 - # Mehtod to use for energy calibration + # Method to use for energy calibration calibration_method: "lmfit" # Energy scale to use for energy calibration energy_scale: "kinetic" @@ -66,11 +66,11 @@ energy: tof_fermi: 132250 # TOF range to visualize for the correction tool around tof_fermi tof_width: [-600, 1000] - # x-intergration range for the correction tool around the center pixel + # x-integration range for the correction tool around the center pixel x_width: [-20, 20] - # y-intergration range for the correction tool around the center pixel + # y-integration range for the correction tool around the center pixel y_width: [-20, 20] - # High intensity cutoff for the visulaization tool + # High intensity cutoff for the visualization tool color_clip: 300 @@ -105,7 +105,7 @@ delay: binning: # Histogram computation mode to use. hist_mode: "numba" - # Mode for hostogram recombination to use + # Mode for histogram recombination to use mode: fast # Whether to display a progress bar pbar: True @@ -117,7 +117,7 @@ binning: histogram: # number of bins used for histogram visualization bins: [80, 80, 80] - # default axes to use for histgram visualization. + # default axes to use for histogram visualization. # Axes names starting with "@" refer to keys in the "dataframe" section axes: ["@x_column", "@y_column", "@tof_column"] # default ranges to use for histogram visualization (in unbinned detector coordinates) diff --git a/sed/config/flash_example_config.yaml b/sed/config/flash_example_config.yaml index bbc6940c..35e30db0 100644 --- a/sed/config/flash_example_config.yaml +++ b/sed/config/flash_example_config.yaml @@ -5,7 +5,7 @@ core: loader: flash # the beamline where experiment took place beamline: pg2 - # the ID number of the beamtimme + # the ID number of the beamtime beamtime_id: 11013410 # the year of the beamtime year: 2023 @@ -89,7 +89,7 @@ dataframe: # channelAlias: # format: per_pulse/per_electron/per_train # group_name: the hdf5 group path - # slice: if the group contains multidim data, where to slice + # slice: if the group contains multidimensional data, where to slice channels: # The timestamp @@ -123,8 +123,8 @@ dataframe: group_name: "/uncategorised/FLASH.EXP/HEXTOF.DAQ/DLD1/" slice: 3 - # The auxillary channel has a special structure where the group further contains - # a multidim structure so further aliases are defined below + # The auxiliary channel has a special structure where the group further contains + # a multidimensional structure so further aliases are defined below dldAux: format: per_pulse group_name: "/uncategorised/FLASH.EXP/HEXTOF.DAQ/DLD1/" diff --git a/sed/config/mpes_example_config.yaml b/sed/config/mpes_example_config.yaml index 95f93218..37a2b5ae 100644 --- a/sed/config/mpes_example_config.yaml +++ b/sed/config/mpes_example_config.yaml @@ -7,7 +7,7 @@ core: copy_tool_source: "/path/to/data/" # path to the root or the local data storage copy_tool_dest: "/path/to/localDataStore/" - # optional keyworkds for the copy tool: + # optional keywords for the copy tool: copy_tool_kwds: # number of parallel copy jobs ntasks: 20 @@ -25,11 +25,11 @@ dataframe: Stream_4: "ADC" # dataframe column name for the time stamp column time_stamp_alias: "timeStamps" - # hdf5 group name containing eventIDs occuring at every millisecond (used to calculate timestamps) + # hdf5 group name containing eventIDs occurring at every millisecond (used to calculate timestamps) ms_markers_group: "msMarkers" # hdf5 attribute containing the timestamp of the first event in a file first_event_time_stamp_key: "FirstEventTimeStamp" - # Time stepping in seconds of the succesive events in the timed dataframe + # Time stepping in seconds of the successive events in the timed dataframe timed_dataframe_unit_time: 0.001 # list of columns to apply jitter to jitter_cols: ["X", "Y", "t", "ADC"] @@ -96,7 +96,7 @@ energy: fastdtw_radius: 2 # Window around a peak to make sure that no other peaks are present peak_window: 7 - # Mehtod to use for energy calibration + # Method to use for energy calibration calibration_method: "lmfit" # Energy scale to use for energy calibration energy_scale: "kinetic" @@ -105,11 +105,11 @@ energy: tof_fermi: 132250 # TOF range to visualize for the correction tool around tof_fermi tof_width: [-600, 1000] - # x-intergration range for the correction tool around the center pixel + # x-integration range for the correction tool around the center pixel x_width: [-20, 20] - # y-intergration range for the correction tool around the center pixel + # y-integration range for the correction tool around the center pixel y_width: [-20, 20] - # High intensity cutoff for the visulaization tool + # High intensity cutoff for the visualization tool color_clip: 300 correction: # Correction type @@ -155,9 +155,9 @@ momentum: sigma_radius: 1 # default momentum calibration calibration: - # x momentum scaleing factor + # x momentum scaling factor kx_scale: 0.010729535670610963 - # y momentum scaleing factor + # y momentum scaling factor ky_scale: 0.010729535670610963 # x BZ center pixel x_center: 256.0 @@ -195,7 +195,7 @@ delay: binning: # Histogram computation mode to use. hist_mode: "numba" - # Mode for hostogram recombination to use + # Mode for histogram recombination to use mode: "fast" # Whether to display a progress bar pbar: True @@ -209,7 +209,7 @@ binning: histogram: # number of bins used for histogram visualization bins: [80, 80, 80, 80] - # default axes to use for histgram visualization. + # default axes to use for histogram visualization. # Axes names starting with "@" refer to keys in the "dataframe" section axes: ["@x_column", "@y_column", "@tof_column", "@adc_column"] # default ranges to use for histogram visualization (in unbinned detector coordinates) @@ -307,6 +307,6 @@ nexus: reader: "mpes" # NeXus application definition to use for saving definition: "NXmpes" - # List conatining additional input files to be handed to the pynxtools converter tool, + # List containing additional input files to be handed to the pynxtools converter tool, # e.g. containing a configuration file, and additional metadata. input_files: ["../sed/config/NXmpes_config.json"] diff --git a/sed/core/config.py b/sed/core/config.py index 2de09240..a16fc847 100644 --- a/sed/core/config.py +++ b/sed/core/config.py @@ -175,10 +175,10 @@ def load_config(config_path: str) -> dict: def save_config(config_dict: dict, config_path: str, overwrite: bool = False): """Function to save a given config dictionary to a json or yaml file. Normally, it loads any existing file of the given name, and keeps any existing dictionary keys not present in the - provided dictionary. The overwrite option creates a fully empty dictionry first. + provided dictionary. The overwrite option creates a fully empty dictionary first. Args: - config_dict (dict): The dictionry to save. + config_dict (dict): The dictionary to save. config_path (str): A string containing the path to the file where to save the dictionary to. overwrite (bool, optional): Option to overwrite an existing file with the given dictionary. diff --git a/sed/core/dfops.py b/sed/core/dfops.py index 7127f7f0..4c428c90 100644 --- a/sed/core/dfops.py +++ b/sed/core/dfops.py @@ -30,7 +30,7 @@ def apply_jitter( with added jitter. Defaults to None. amps (Union[float, Sequence[float]], optional): Amplitude scalings for the jittering noise. If one number is given, the same is used for all axes. - For normal noise, the added noise will have sdev [-amp, +amp], for + For normal noise, the added noise will have stdev [-amp, +amp], for uniform noise it will cover the interval [-amp, +amp]. Defaults to 0.5. jitter_type (str, optional): the type of jitter to add. 'uniform' or 'normal' @@ -204,7 +204,7 @@ def forward_fill_lazy( Allows forward filling between partitions. This is useful for dataframes that have sparse data, such as those with many NaNs. - Runnin the forward filling multiple times can fix the issue of having + Running the forward filling multiple times can fix the issue of having entire partitions consisting of NaNs. By default we run this twice, which is enough to fix the issue for dataframes with no consecutive partitions of NaNs. @@ -331,11 +331,12 @@ def offset_by_other_columns( df (dask.dataframe.DataFrame): Dataframe to use. Currently supports only dask dataframes. target_column (str): Name of the column to apply the offset to. offset_columns (str): Name of the column(s) to use for the offset. - weights (flot): weights to apply on each column before adding. Used also for changing sign. - reductions (str, optional): Reduction function to use for the offset. Defaults to "mean". - Currently, only mean is supported. - preserve_mean (bool, optional): Whether to subtract the mean of the offset column. - Defaults to False. If a list is given, it must have the same length as + weights (Union[float, Sequence[float]]): weights to apply on each column before adding. + Used also for changing sign. + reductions (Union[str, Sequence[str]], optional): Reduction function to use for the offset. + Defaults to "mean". Currently, only mean is supported. + preserve_mean (Union[bool, Sequence[bool]], optional): Whether to subtract the mean of the + offset column. Defaults to False. If a list is given, it must have the same length as offset_columns. Otherwise the value passed is used for all columns. inplace (bool, optional): Whether to apply the offset inplace. If false, the new column will have the name provided by rename, or has the same name as diff --git a/sed/core/metadata.py b/sed/core/metadata.py index 155bdfce..25f501ea 100644 --- a/sed/core/metadata.py +++ b/sed/core/metadata.py @@ -64,7 +64,7 @@ def add( Args: entry: dictionary containing the metadata to add. name: name of the dictionary key under which to add entry. - duplicate_policy: Control behaviour in case the 'name' key + duplicate_policy: Control behavior in case the 'name' key is already present in the metadata dictionary. Can be any of: - "raise": raises a DuplicateEntryError. diff --git a/sed/core/processor.py b/sed/core/processor.py index ee085739..cfefc222 100644 --- a/sed/core/processor.py +++ b/sed/core/processor.py @@ -331,7 +331,7 @@ def normalization_histogram(self) -> xr.DataArray: """Getter attribute for the normalization histogram Returns: - xr.DataArray: The normalizazion histogram + xr.DataArray: The normalization histogram """ if self._normalization_histogram is None: raise ValueError("No normalization histogram available, generate histogram first!") @@ -542,7 +542,7 @@ def define_features( ): """2. Step of the distortion correction workflow: Define feature points in momentum space. They can be either manually selected using a GUI tool, be - ptovided as list of feature points, or auto-generated using a + provided as list of feature points, or auto-generated using a feature-detection algorithm. Args: @@ -591,7 +591,7 @@ def generate_splinewarp( **kwds, ): """3. Step of the distortion correction workflow: Generate the correction - function restoring the symmetry in the image using a splinewarp algortihm. + function restoring the symmetry in the image using a splinewarp algorithm. Args: use_center (bool, optional): Option to use the position of the @@ -688,7 +688,7 @@ def pose_adjustment( Args: transformations (dict, optional): Dictionary with transformations. - Defaults to self.transformations or config["momentum"]["transformtions"]. + Defaults to self.transformations or config["momentum"]["transformations"]. apply (bool, optional): Option to directly apply the provided transformations. Defaults to False. use_correction (bool, option): Whether to use the spline warp correction @@ -707,7 +707,7 @@ def pose_adjustment( if verbose is None: verbose = self.verbose - # Generate homomorphy as default if no distortion correction has been applied + # Generate homography as default if no distortion correction has been applied if self.mc.slice_corrected is None: if self.mc.slice is None: self.mc.slice = np.zeros(self._config["momentum"]["bins"][0:2]) @@ -854,7 +854,7 @@ def calibrate_momentum_axes( second point used for momentum calibration. Defaults to config["momentum"]["center_pixel"]. k_distance (float, optional): Momentum distance between point a and b. - Needs to be provided if no specific k-koordinates for the two points + Needs to be provided if no specific k-coordinates for the two points are given. Defaults to None. k_coord_a (Union[np.ndarray, List[float]], optional): Momentum coordinate of the first point used for calibration. Used if equiscale is False. @@ -991,7 +991,7 @@ def adjust_energy_correction( apply=False, **kwds, ): - """1. step of the energy crrection workflow: Opens an interactive plot to + """1. step of the energy correction workflow: Opens an interactive plot to adjust the parameters for the TOF/energy correction. Also pre-bins the data if they are not present yet. @@ -1070,7 +1070,7 @@ def apply_energy_correction( verbose: bool = None, **kwds, ): - """2. step of the energy correction workflow: Apply the enery correction + """2. step of the energy correction workflow: Apply the energy correction parameters stored in the class to the dataframe. Args: @@ -1245,7 +1245,7 @@ def find_bias_peaks( radius (int, optional): Radius parameter for fast_dtw. Defaults to config["energy"]["fastdtw_radius"]. peak_window (int, optional): Peak_window parameter for the peak detection - algorthm. amount of points that have to have to behave monotoneously + algorithm. amount of points that have to have to behave monotonously around a peak. Defaults to config["energy"]["peak_window"]. apply (bool, optional): Option to directly apply the provided parameters. Defaults to False. @@ -1960,7 +1960,7 @@ def add_jitter( """Add jitter to the selected dataframe columns. Args: - cols (List[str], optional): The colums onto which to apply jitter. + cols (List[str], optional): The columns onto which to apply jitter. Defaults to config["dataframe"]["jitter_cols"]. amps (Union[float, Sequence[float]], optional): Amplitude scalings for the jittering noise. If one number is given, the same is used for all axes. @@ -2155,7 +2155,7 @@ def compute( ranges (Sequence[Tuple[float, float]], optional): list of tuples containing the start and end point of the binning range. Defaults to None. normalize_to_acquisition_time (Union[bool, str]): Option to normalize the - result to the acquistion time. If a "slow" axis was scanned, providing + result to the acquisition time. If a "slow" axis was scanned, providing the name of the scanned axis will compute and apply the corresponding normalization histogram. Defaults to False. **kwds: Keyword arguments: @@ -2382,12 +2382,12 @@ def view_event_histogram( Args: dfpid (int): Number of the data frame partition to look at. ncol (int, optional): Number of columns in the plot grid. Defaults to 2. - bins (Sequence[int], optional): Number of bins to use for the speicified + bins (Sequence[int], optional): Number of bins to use for the specified axes. Defaults to config["histogram"]["bins"]. axes (Sequence[str], optional): Names of the axes to display. Defaults to config["histogram"]["axes"]. ranges (Sequence[Tuple[float, float]], optional): Value ranges of all - specified axes. Defaults toconfig["histogram"]["ranges"]. + specified axes. Defaults to config["histogram"]["ranges"]. backend (str, optional): Backend of the plotting library ('matplotlib' or 'bokeh'). Defaults to "bokeh". legend (bool, optional): Option to include a legend in the histogram plots. @@ -2469,7 +2469,7 @@ def save( - "*.h5", "*.hdf5": Saves an HDF5 file. - "*.nxs", "*.nexus": Saves a NeXus file. - **kwds: Keyword argumens, which are passed to the writer functions: + **kwds: Keyword arguments, which are passed to the writer functions: For TIFF writing: - **alias_dict**: Dictionary of dimension aliases to use. @@ -2480,9 +2480,9 @@ def save( For NeXus: - - **reader**: Name of the nexustools reader to use. + - **reader**: Name of the pynxtools reader to use. Defaults to config["nexus"]["reader"] - - **definiton**: NeXus application definition to use for saving. + - **definition**: NeXus application definition to use for saving. Must be supported by the used ``reader``. Defaults to config["nexus"]["definition"] - **input_files**: A list of input files to pass to the reader. diff --git a/sed/io/hdf5.py b/sed/io/hdf5.py index 34ab0016..5d4d45d8 100644 --- a/sed/io/hdf5.py +++ b/sed/io/hdf5.py @@ -48,7 +48,7 @@ def recursive_write_metadata(h5group: h5py.Group, node: dict): print(f"Saved {key} as string.") except BaseException as exc: raise ValueError( - f"Unknown error occured, cannot save {item} of type {type(item)}.", + f"Unknown error occurred, cannot save {item} of type {type(item)}.", ) from exc @@ -141,7 +141,7 @@ def load_h5(faddr: str, mode: str = "r") -> xr.DataArray: ValueError: Raised if data or axes are not found in the file. Returns: - xr.DataArray: output xarra data + xr.DataArray: output xarray data """ with h5py.File(faddr, mode) as h5_file: # Reading data array diff --git a/sed/io/nexus.py b/sed/io/nexus.py index 99ca139d..2ccaccc4 100644 --- a/sed/io/nexus.py +++ b/sed/io/nexus.py @@ -1,5 +1,5 @@ """This module contains NuXus file input/output functions for the sed.io module. -The conversion is based on the nexusutils from the FAIRmat NFDI consortium. +The conversion is based on the pynxtools from the FAIRmat NFDI consortium. For details, see https://github.com/nomad-coe/nomad-parser-nexus """ @@ -26,9 +26,10 @@ def to_nexus( data._attrs["metadata"]. faddr (str): The file path to save to. reader (str): The name of the NeXus reader to use. - definition (str): The NeXus definiton to use. - config_file (str): The file path to the configuration file to use. - **kwds: Keyword arguments for ``nexusutils.dataconverter.convert``. + definition (str): The NeXus definition to use. + input_files (Union[str, Sequence[str]]): The file path or paths to the additional files to + use. + **kwds: Keyword arguments for ``pynxtools.dataconverter.convert.convert()``. """ if isinstance(input_files, str): diff --git a/sed/loader/base/loader.py b/sed/loader/base/loader.py index 880be88d..4e64e528 100644 --- a/sed/loader/base/loader.py +++ b/sed/loader/base/loader.py @@ -66,7 +66,7 @@ def read_dataframe( files will be ignored. Defaults to None. runs (Union[str, Sequence[str]], optional): Run identifier(s). Corresponding files will be located in the location provided by ``folders``. Takes - precendence over ``files`` and ``folders``. Defaults to None. + precedence over ``files`` and ``folders``. Defaults to None. ftype (str, optional): File type to read ('parquet', 'json', 'csv', etc). If a folder path is given, all files with the specified extension are read into the dataframe in the reading order. Defaults to None. diff --git a/sed/loader/flash/loader.py b/sed/loader/flash/loader.py index 8f9198b6..04d9b051 100644 --- a/sed/loader/flash/loader.py +++ b/sed/loader/flash/loader.py @@ -5,7 +5,7 @@ The dataframe is a amalgamation of all h5 files for a combination of runs, where the NaNs are automatically forward filled across different files. This can then be saved as a parquet for out-of-sed processing and reread back to access other -sed funtionality. +sed functionality. """ import time from functools import reduce @@ -402,15 +402,15 @@ def create_dataframe_per_pulse( DataFrame: The pandas DataFrame for the channel's data. Notes: - - For auxillary channels, the macrobunch resolved data is repeated 499 times to be - compared to electron resolved data for each auxillary channel. The data is then + - For auxiliary channels, the macrobunch resolved data is repeated 499 times to be + compared to electron resolved data for each auxiliary channel. The data is then converted to a multicolumn DataFrame. - For all other pulse resolved channels, the macrobunch resolved data is exploded to a DataFrame and the MultiIndex is set. """ - # Special case for auxillary channels + # Special case for auxiliary channels if channel == "dldAux": # Checks the channel dictionary for correct slices and creates a multicolumn DataFrame data_frames = ( @@ -881,7 +881,7 @@ def read_dataframe( Path has priority such that if it's specified, the specified files will be ignored. Defaults to None. runs (Union[str, Sequence[str]], optional): Run identifier(s). Corresponding files will - be located in the location provided by ``folders``. Takes precendence over + be located in the location provided by ``folders``. Takes precedence over ``files`` and ``folders``. Defaults to None. ftype (str, optional): The file extension type. Defaults to "h5". metadata (dict, optional): Additional metadata. Defaults to None. diff --git a/sed/loader/generic/loader.py b/sed/loader/generic/loader.py index f3cd5f25..fae675a7 100644 --- a/sed/loader/generic/loader.py +++ b/sed/loader/generic/loader.py @@ -47,7 +47,7 @@ def read_dataframe( files will be ignored. Defaults to None. runs (Union[str, Sequence[str]], optional): Run identifier(s). Corresponding files will be located in the location provided by ``folders``. Takes - precendence over ``files`` and ``folders``. Defaults to None. + precedence over ``files`` and ``folders``. Defaults to None. ftype (str, optional): File type to read ('parquet', 'json', 'csv', etc). If a folder path is given, all files with the specified extension are read into the dataframe in the reading order. Defaults to "parquet". @@ -60,7 +60,7 @@ def read_dataframe( Raises: ValueError: Raised if neither files nor folder provided. - FileNotFoundError: Raised if the fileds or folder cannot be found. + FileNotFoundError: Raised if the files or folder cannot be found. ValueError: Raised if the file type is not supported. Returns: diff --git a/sed/loader/mirrorutil.py b/sed/loader/mirrorutil.py index 1946a171..1ad626b2 100644 --- a/sed/loader/mirrorutil.py +++ b/sed/loader/mirrorutil.py @@ -1,7 +1,7 @@ """ module sed.loader.mirrorutil, code for transparently mirroring file system trees to a second (local) location. This is speeds up binning of data stored on network drives -tremendiously. +tremendously. Mostly ported from https://github.com/mpes-kit/mpes. @author: L. Rettig """ @@ -19,7 +19,7 @@ class CopyTool: """File collecting and sorting class. Args: - source (str): Dource path for the copy tool. + source (str): Source path for the copy tool. dest (str): Destination path for the copy tool. """ @@ -262,7 +262,7 @@ def cleanup_oldest_scan( proceed = input() if proceed == "y": shutil.rmtree(oldest_scan) - print("Removed sucessfully!") + print("Removed successfully!") else: print("Aborted.") @@ -291,7 +291,7 @@ def get_target_dir( ValueError: Raised if sdir not inside of source Returns: - str: The mapped targed directory inside dest + str: The mapped target directory inside dest """ if not os.path.isdir(sdir): diff --git a/sed/loader/mpes/loader.py b/sed/loader/mpes/loader.py index 1793a300..342158b1 100644 --- a/sed/loader/mpes/loader.py +++ b/sed/loader/mpes/loader.py @@ -71,7 +71,7 @@ def hdf5_to_dataframe( if group_names == []: group_names, alias_dict = get_groups_and_aliases( h5file=test_proc, - seach_pattern="Stream", + search_pattern="Stream", ) column_names = [alias_dict.get(group, group) for group in group_names] @@ -152,7 +152,7 @@ def hdf5_to_timed_dataframe( if group_names == []: group_names, alias_dict = get_groups_and_aliases( h5file=test_proc, - seach_pattern="Stream", + search_pattern="Stream", ) column_names = [alias_dict.get(group, group) for group in group_names] @@ -190,7 +190,7 @@ def hdf5_to_timed_dataframe( def get_groups_and_aliases( h5file: h5py.File, - seach_pattern: str = None, + search_pattern: str = None, alias_key: str = "Name", ) -> Tuple[List[str], Dict[str, str]]: """Read groups and aliases from a provided hdf5 file handle @@ -198,7 +198,7 @@ def get_groups_and_aliases( Args: h5file (h5py.File): The hdf5 file handle - seach_pattern (str, optional): + search_pattern (str, optional): Search pattern to select groups. Defaults to include all groups. alias_key (str, optional): Attribute key where aliases are stored. Defaults to "Name". @@ -211,10 +211,10 @@ def get_groups_and_aliases( group_names = list(h5file) # Filter the group names - if seach_pattern is None: + if search_pattern is None: filtered_group_names = group_names else: - filtered_group_names = [name for name in group_names if seach_pattern in name] + filtered_group_names = [name for name in group_names if search_pattern in name] alias_dict = {} for name in filtered_group_names: @@ -332,7 +332,7 @@ def hdf5_to_timed_array( timestamp of a file. Defaults to "FirstEventTimeStamp". Returns: - np.ndarray: the array of the values at evently spaced timing obtained from + np.ndarray: the array of the values at evenly spaced timing obtained from the ms_markers. """ @@ -377,7 +377,7 @@ def hdf5_to_timed_array( def get_attribute(h5group: h5py.Group, attribute: str) -> str: - """Reads, decodes and returns an attrubute from an hdf5 group + """Reads, decodes and returns an attribute from an hdf5 group Args: h5group (h5py.Group): @@ -434,7 +434,7 @@ def get_elapsed_time( are stored. Defaults to "msMarkers". Return: - float: The acquision time of the file in seconds. + float: The acquisition time of the file in seconds. """ secs = h5file[ms_markers_group].len() / 1000 @@ -515,7 +515,7 @@ def read_dataframe( files will be ignored. Defaults to None. runs (Union[str, Sequence[str]], optional): Run identifier(s). Corresponding files will be located in the location provided by ``folders``. Takes - precendence over ``files`` and ``folders``. Defaults to None. + precedence over ``files`` and ``folders``. Defaults to None. ftype (str, optional): File extension to use. If a folder path is given, all files with the specified extension are read into the dataframe in the reading order. Defaults to "h5". @@ -834,7 +834,7 @@ def gather_metadata( print("Contrast aperture size not found.") # Storing the lens modes corresponding to lens voltages. - # Use lens volages present in first lens_mode entry. + # Use lens voltages present in first lens_mode entry. lens_list = self._config["metadata"]["lens_mode_config"][ next(iter(self._config["metadata"]["lens_mode_config"])) ].keys() diff --git a/sed/loader/sxp/loader.py b/sed/loader/sxp/loader.py index 67faca4c..878ad3fa 100644 --- a/sed/loader/sxp/loader.py +++ b/sed/loader/sxp/loader.py @@ -6,7 +6,7 @@ The dataframe is a amalgamation of all h5 files for a combination of runs, where the NaNs are automatically forward filled across different files. This can then be saved as a parquet for out-of-sed processing and reread back to access other -sed funtionality. +sed functionality. Most of the structure is identical to the FLASH loader. """ import time @@ -407,7 +407,7 @@ def create_dataframe_per_electron( """ if self.array_indices is None or len(self.array_indices) != np_array.shape[0]: raise RuntimeError( - "macrobunch_indices not set correctly, internal inconstency detected.", + "macrobunch_indices not set correctly, internal inconsistency detected.", ) train_data = [] for i, _ in enumerate(self.array_indices): @@ -446,15 +446,15 @@ def create_dataframe_per_pulse( DataFrame: The pandas DataFrame for the channel's data. Notes: - - For auxillary channels, the macrobunch resolved data is repeated 499 times to be - compared to electron resolved data for each auxillary channel. The data is then + - For auxiliary channels, the macrobunch resolved data is repeated 499 times to be + compared to electron resolved data for each auxiliary channel. The data is then converted to a multicolumn DataFrame. - For all other pulse resolved channels, the macrobunch resolved data is exploded to a DataFrame and the MultiIndex is set. """ - # Special case for auxillary channels + # Special case for auxiliary channels if channel == "dldAux": # Checks the channel dictionary for correct slices and creates a multicolumn DataFrame data_frames = ( @@ -925,7 +925,7 @@ def read_dataframe( Path has priority such that if it's specified, the specified files will be ignored. Defaults to None. runs (Union[str, Sequence[str]], optional): Run identifier(s). Corresponding files will - be located in the location provided by ``folders``. Takes precendence over + be located in the location provided by ``folders``. Takes precedence over ``files`` and ``folders``. Defaults to None. ftype (str, optional): The file extension type. Defaults to "h5". metadata (dict, optional): Additional metadata. Defaults to None. diff --git a/tests/calibrator/test_energy.py b/tests/calibrator/test_energy.py index 0c1735fb..697bf375 100644 --- a/tests/calibrator/test_energy.py +++ b/tests/calibrator/test_energy.py @@ -176,8 +176,8 @@ def test_calibrate_append(energy_scale: str, calibration_method: str) -> None: and the application to the data frame. Args: - energy_scale (str): tpye of energy scaling - calibration_method (str): method used for ralibration + energy_scale (str): type of energy scaling + calibration_method (str): method used for calibration """ config = parse_config( config={"dataframe": {"tof_binning": 2}}, @@ -345,7 +345,7 @@ def test_append_tof_ns_axis() -> None: ) def test_energy_correction(correction_type: str, correction_kwd: dict) -> None: """Function to test if all energy correction functions generate symmetric curves - with the maximum at the cetner x/y. + with the maximum at the center x/y. Args: correction_type (str): type of correction to test diff --git a/tests/calibrator/test_momentum.py b/tests/calibrator/test_momentum.py index c65bfc28..c40e75e7 100644 --- a/tests/calibrator/test_momentum.py +++ b/tests/calibrator/test_momentum.py @@ -52,7 +52,7 @@ def test_bin_data_and_slice_image() -> None: def test_feature_extract() -> None: - """Testextracting the feature from a 2D slice""" + """Test extracting the feature from a 2D slice""" config = parse_config( config={"core": {"loader": "mpes"}}, folder_config={}, @@ -74,7 +74,7 @@ def test_feature_extract() -> None: [True, False], ) def test_splinewarp(include_center: bool) -> None: - """Test the generation of the splinewarp etimate. + """Test the generation of the splinewarp estimate. Args: include_center (bool): Option to include the center point. @@ -110,7 +110,7 @@ def test_splinewarp(include_center: bool) -> None: def test_ascale() -> None: - """Test the generation of the splinewarp etimate with ascale parameter.""" + """Test the generation of the splinewarp estimate with ascale parameter.""" config = parse_config( config={"core": {"loader": "mpes"}}, folder_config={}, @@ -232,44 +232,44 @@ def test_apply_correction() -> None: ] depends_on_list = [ { - "root": "/entry/process/registration/tranformations/trans_x", + "root": "/entry/process/registration/transformations/trans_x", "axes": {"trans_x": "."}, }, { - "root": "/entry/process/registration/tranformations/trans_y", + "root": "/entry/process/registration/transformations/trans_y", "axes": {"trans_y": "."}, }, { - "root": "/entry/process/registration/tranformations/rot_z", + "root": "/entry/process/registration/transformations/rot_z", "axes": {"rot_z": "."}, }, { - "root": "/entry/process/registration/tranformations/trans_y", + "root": "/entry/process/registration/transformations/trans_y", "axes": { "trans_x": ".", - "trans_y": "/entry/process/registration/tranformations/trans_x", + "trans_y": "/entry/process/registration/transformations/trans_x", }, }, { - "root": "/entry/process/registration/tranformations/rot_z", + "root": "/entry/process/registration/transformations/rot_z", "axes": { "trans_x": ".", - "rot_z": "/entry/process/registration/tranformations/trans_x", + "rot_z": "/entry/process/registration/transformations/trans_x", }, }, { - "root": "/entry/process/registration/tranformations/rot_z", + "root": "/entry/process/registration/transformations/rot_z", "axes": { "trans_y": ".", - "rot_z": "/entry/process/registration/tranformations/trans_y", + "rot_z": "/entry/process/registration/transformations/trans_y", }, }, { - "root": "/entry/process/registration/tranformations/rot_z", + "root": "/entry/process/registration/transformations/rot_z", "axes": { "trans_x": ".", - "trans_y": "/entry/process/registration/tranformations/trans_x", - "rot_z": "/entry/process/registration/tranformations/trans_y", + "trans_y": "/entry/process/registration/transformations/trans_x", + "rot_z": "/entry/process/registration/transformations/trans_y", }, }, ] @@ -322,7 +322,7 @@ def test_apply_registration( mc.add_features(features=features, rotsym=6) mc.spline_warp_estimate() mc.pose_adjustment(**transformations, apply=True) - # disable re-calculation of inverse defield to save time, as we are just testing meta data here + # disable re-calculation of inverse dfield to save time, as we are just testing meta data here mc.dfield_updated = False df, metadata = mc.apply_corrections(df=df) assert "Xm" in df.columns diff --git a/tests/data/loader/flash/config.yaml b/tests/data/loader/flash/config.yaml index b7049dfb..f04f08e8 100644 --- a/tests/data/loader/flash/config.yaml +++ b/tests/data/loader/flash/config.yaml @@ -99,8 +99,8 @@ dataframe: group_name: "/uncategorised/FLASH.EXP/HEXTOF.DAQ/DLD1/" slice: 3 - # The auxillary channel has a special structure where the group further contains - # a multidim structure so further aliases are defined below + # The auxiliary channel has a special structure where the group further contains + # a multidimensional structure so further aliases are defined below dldAux: format: per_pulse group_name: "/uncategorised/FLASH.EXP/HEXTOF.DAQ/DLD1/" diff --git a/tests/helpers.py b/tests/helpers.py index c7f6d3e3..09cd4dd6 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -18,7 +18,7 @@ def simulate_binned_data(shape: tuple, dims: list) -> xr.DataArray: """ assert len(dims) == len( shape, - ), "number of dimesions and data shape must coincide" + ), "number of dimensions and data shape must coincide" return xr.DataArray( data=np.random.rand(*shape), diff --git a/tests/loader/test_mirrorutil.py b/tests/loader/test_mirrorutil.py index db402108..388345b1 100644 --- a/tests/loader/test_mirrorutil.py +++ b/tests/loader/test_mirrorutil.py @@ -20,7 +20,7 @@ def test_copy_tool_folder() -> None: - """Test the folder copy functionalty of the CopyTool""" + """Test the folder copy functionality of the CopyTool""" dest_folder = tempfile.mkdtemp() gid = os.getgid() ct = CopyTool( diff --git a/tests/test_binning.py b/tests/test_binning.py index 69a5d1b9..417472f3 100644 --- a/tests/test_binning.py +++ b/tests/test_binning.py @@ -97,7 +97,7 @@ def test_histdd_error_is_raised(_samples: np.ndarray, _bins: List[int]) -> None: ) def test_histdd_bins_as_numpy(args: Tuple[np.ndarray, np.ndarray, int]) -> None: """Test whether the numba_histogramdd functions produces the same result - as np.histogramdd if called with a list of bin edgees + as np.histogramdd if called with a list of bin edges Args: args (Tuple[np.ndarray, np.ndarray, int]): Tuple of diff --git a/tests/test_processor.py b/tests/test_processor.py index 5471410a..c2e4bd15 100644 --- a/tests/test_processor.py +++ b/tests/test_processor.py @@ -132,8 +132,8 @@ def test_processor_from_runs() -> None: def test_additional_parameter_to_loader() -> None: - """Test if additinal keyword parameter can be passed to the loader from the - Processor initialiuzation. + """Test if additional keyword parameter can be passed to the loader from the + Processor initialization. """ config = {"core": {"loader": "generic"}} processor = SedProcessor( @@ -671,7 +671,7 @@ def test_align_dld_sectors() -> None: tof_aligned_array[i][0 : len(val)] = val np.testing.assert_allclose(tof_ref_array, tof_aligned_array + sector_delays[:, np.newaxis]) - # cleanup flash inermediaries + # cleanup flash intermediaries parquet_data_dir = config["core"]["paths"]["data_parquet_dir"] for file in os.listdir(Path(parquet_data_dir, "buffer")): os.remove(Path(parquet_data_dir, "buffer", file)) @@ -1001,12 +1001,12 @@ def test_get_normalization_histogram() -> None: metadata: Dict[Any, Any] = {} metadata["entry_title"] = "Title" -# User +# user metadata["user0"] = {} metadata["user0"]["name"] = "Name" metadata["user0"]["email"] = "email" metadata["user0"]["affiliation"] = "affiliation" -# NXinstrument +# instrument metadata["instrument"] = {} # analyzer metadata["instrument"]["analyzer"] = {} diff --git a/tutorial/1_binning_fake_data.ipynb b/tutorial/1_binning_fake_data.ipynb index 61d8873b..04370e8e 100644 --- a/tutorial/1_binning_fake_data.ipynb +++ b/tutorial/1_binning_fake_data.ipynb @@ -9,7 +9,7 @@ "source": [ "# Binning demonstration on locally generated fake data\n", "In this example, we generate a table with random data simulating a single event dataset.\n", - "We showcase the binning method, first on a simple single table using the bin_partition method and then in the distributed mehthod bin_dataframe, using daks dataframes.\n", + "We showcase the binning method, first on a simple single table using the bin_partition method and then in the distributed method bin_dataframe, using daks dataframes.\n", "The first method is never really called directly, as it is simply the function called by the bin_dataframe on each partition of the dask dataframe." ] }, @@ -138,7 +138,7 @@ "source": [ "## Compute distributed binning on the partitioned dask dataframe\n", "In this example, the small dataset does not give significant improvement over the pandas implementation, at least using this number of partitions.\n", - "A single partition would be faster (you can try...) but we use multiple for demonstration purpouses." + "A single partition would be faster (you can try...) but we use multiple for demonstration purposes." ] }, { diff --git a/tutorial/2_conversion_pipeline_for_example_time-resolved_ARPES_data.ipynb b/tutorial/2_conversion_pipeline_for_example_time-resolved_ARPES_data.ipynb index af695478..7b9cb1e2 100644 --- a/tutorial/2_conversion_pipeline_for_example_time-resolved_ARPES_data.ipynb +++ b/tutorial/2_conversion_pipeline_for_example_time-resolved_ARPES_data.ipynb @@ -46,7 +46,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 GByte free space.\n", "data_path = dataset.dir # This is the path to the data\n", "scandir, caldir = dataset.subdirs # scandir contains the data, caldir contains the calibration files" ] @@ -182,7 +182,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Option whether a central point shall be fixed in the determiantion fo the correction\n", + "# Option whether a central point shall be fixed in the determination fo the correction\n", "sp.generate_splinewarp(include_center=True)" ] }, @@ -213,7 +213,7 @@ "metadata": {}, "source": [ "#### 4. Step:\n", - "To adjust scaling, position and orientation of the corrected momentum space image, you can apply further affine transformations to the distortion correction field. Here, first a postential scaling is applied, next a translation, and finally a rotation around the center of the image (defined via the config). One can either use an interactive tool, or provide the adjusted values and apply them directly." + "To adjust scaling, position and orientation of the corrected momentum space image, you can apply further affine transformations to the distortion correction field. Here, first a potential scaling is applied, next a translation, and finally a rotation around the center of the image (defined via the config). One can either use an interactive tool, or provide the adjusted values and apply them directly." ] }, { @@ -255,9 +255,9 @@ "source": [ "### Momentum calibration workflow\n", "#### 1. Step:\n", - "First, the momentum scaling needs to be calibtrated. Either, one can provide the coordinates of one point outside the center, and provide its distane to the Brillouin zone center (which is assumed to be located in the center of the image), one can specify two points on the image and their distance (where the 2nd point marks the BZ center),or one can provide absolute k-coordinates of two distinct momentum points.\n", + "First, the momentum scaling needs to be calibrated. Either, one can provide the coordinates of one point outside the center, and provide its distance to the Brillouin zone center (which is assumed to be located in the center of the image), one can specify two points on the image and their distance (where the 2nd point marks the BZ center),or one can provide absolute k-coordinates of two distinct momentum points.\n", "\n", - "If no points are provided, an interactive tool is created. Here, left mouse click selectes the off-center point (brillouin_zone_cetnered=True) or toggle-selects the off-center and center point." + "If no points are provided, an interactive tool is created. Here, left mouse click selects the off-center point (brillouin_zone_centered=True) or toggle-selects the off-center and center point." ] }, { @@ -267,7 +267,7 @@ "metadata": {}, "outputs": [], "source": [ - "k_distance = 2/np.sqrt(3)*np.pi/3.28 # k-distance of the K-point in a hexagonal Brilloiun zone\n", + "k_distance = 2/np.sqrt(3)*np.pi/3.28 # k-distance of the K-point in a hexagonal Brillouin zone\n", "#sp.calibrate_momentum_axes(k_distance = k_distance)\n", "point_a = [308, 345]\n", "sp.calibrate_momentum_axes(point_a=point_a, k_distance = k_distance, apply=True)\n", @@ -332,7 +332,7 @@ "metadata": {}, "source": [ "#### 1st step:\n", - "Here, one can select the functional form to be used, and adjust its parameters. The binned data used for the momentum calibration is plotted around the Fermi energy (defined by tof_fermi), and the correction function is plotted ontop. Possible correction functions are: \"sperical\" (parameter: diameter), \"Lorentzian\" (parameter: gamma), \"Gaussian\" (parameter: sigma), and \"Lorentzian_asymmetric\" (parameters: gamma, amplitude2, gamma2).\n", + "Here, one can select the functional form to be used, and adjust its parameters. The binned data used for the momentum calibration is plotted around the Fermi energy (defined by tof_fermi), and the correction function is plotted ontop. Possible correction functions are: \"spherical\" (parameter: diameter), \"Lorentzian\" (parameter: gamma), \"Gaussian\" (parameter: sigma), and \"Lorentzian_asymmetric\" (parameters: gamma, amplitude2, gamma2).\n", "\n", "One can either use an interactive alignment tool, or provide parameters directly." ] @@ -458,7 +458,7 @@ "metadata": {}, "source": [ "#### 3. Step:\n", - "Next, the detected peak positions and bias voltages are used to determine the calibration function. This can be either done by fitting the functional form d^2/(t-t0)^2 via lmfit (\"lmfit\"), or using a polynomial approxiamtion (\"lstsq\" or \"lsqr\"). Here, one can also define a reference id, and a reference energy. Those define the absolute energy position of the feature used for calibration in the \"reference\" trace, at the bias voltage where the final measurement has been performed. The energy scale can be either \"kinetic\" (decreasing energy with increasing TOF), or \"binding\" (increasing energy with increasing TOF).\n", + "Next, the detected peak positions and bias voltages are used to determine the calibration function. This can be either done by fitting the functional form d^2/(t-t0)^2 via lmfit (\"lmfit\"), or using a polynomial approximation (\"lstsq\" or \"lsqr\"). Here, one can also define a reference id, and a reference energy. Those define the absolute energy position of the feature used for calibration in the \"reference\" trace, at the bias voltage where the final measurement has been performed. The energy scale can be either \"kinetic\" (decreasing energy with increasing TOF), or \"binding\" (increasing energy with increasing TOF).\n", "\n", "After calculating the calibration, all traces corrected with the calibration are plotted ontop of each other, the calibration function together with the extracted features is plotted." ] @@ -661,7 +661,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.12" } }, "nbformat": 4, diff --git a/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb b/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb index 4de5cf2b..42fede36 100644 --- a/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb +++ b/tutorial/3_metadata_collection_and_export_to_NeXus.ipynb @@ -44,7 +44,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 GByte free space.\n", "data_path = dataset.dir # This is the path to the data\n", "scandir, _ = dataset.subdirs # scandir contains the data, _ contains the calibration files" ] @@ -307,7 +307,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.12" } }, "nbformat": 4, diff --git a/tutorial/4_hextof_workflow.ipynb b/tutorial/4_hextof_workflow.ipynb index 5cb79585..f428bf71 100644 --- a/tutorial/4_hextof_workflow.ipynb +++ b/tutorial/4_hextof_workflow.ipynb @@ -57,7 +57,7 @@ "outputs": [], "source": [ "# data_path can be defined and used to store the data in a specific location\n", - "dataset.get(\"Gd_W110\") # Put in Path to a storage of at least 10 Gbyte free space.\n", + "dataset.get(\"Gd_W110\") # Put in Path to a storage of at least 10 GByte free space.\n", "path = dataset.dir\n", "print(path)" ] @@ -247,7 +247,7 @@ "metadata": {}, "source": [ "### Binning\n", - "Here we define the parameters for binning the dataframe to an n-dimensional histogram, which we can then plot, analyse or save.\n", + "Here we define the parameters for binning the dataframe to an n-dimensional histogram, which we can then plot, analyze or save.\n", "\n", "If you never saw this before, the type after `:` is a \"hint\" to what type the object to the left will have. We include them here to make sure you know what each variable should be.\n", "```python\n", @@ -417,7 +417,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, to determine propper binning ranges, let's have again a look at the event histograms:" + "Now, to determine proper binning ranges, let's have again a look at the event histograms:" ] }, { @@ -455,7 +455,7 @@ "outputs": [], "source": [ "plt.figure()\n", - "res.plot.line(x='dldTime'); # the ; here is to suppres an annoying output" + "res.plot.line(x='dldTime'); # the ; here is to suppress an annoying output" ] }, { @@ -585,7 +585,7 @@ "metadata": {}, "source": [ "### correct offsets\n", - "The energy axis is now correct, but still the curves do not stack on eachother as we are not compensating for the `sampleBias`. In the same way, we can compensate the photon energy (`monocrhomatorPhotonEnergy`) and the `tofVoltage` " + "The energy axis is now correct, but still the curves do not stack on each other as we are not compensating for the `sampleBias`. In the same way, we can compensate the photon energy (`monochromatorPhotonEnergy`) and the `tofVoltage` " ] }, { @@ -639,7 +639,7 @@ "metadata": {}, "source": [ "### save the calibration parameters\n", - "The parameters we have found can be saved to a file, so that we can use them later. This means the calibrtion can be used for different runs." + "The parameters we have found can be saved to a file, so that we can use them later. This means the calibration can be used for different runs." ] }, { @@ -656,7 +656,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "A more general function, which saves parameters for all the calibrations performed. Use either the above or below function. They are equivalent (and overwrite eachother)" + "A more general function, which saves parameters for all the calibrations performed. Use either the above or below function. They are equivalent (and overwrite each other)" ] }, { @@ -826,7 +826,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "You may note some intensity variation along the delay axis. This comes mainly from inhomogenous speed of the delay stage, and thus inquivalently time spend on every delay point. This can be corrected for by normalizing the data to the aquisition time per delay point:" + "You may note some intensity variation along the delay axis. This comes mainly from inhomogeneous speed of the delay stage, and thus inequivalent amounts of time spent on every delay point. This can be corrected for by normalizing the data to the acquisition time per delay point:" ] }, { @@ -982,7 +982,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.9.19" } }, "nbformat": 4, diff --git a/tutorial/5_sxp_workflow.ipynb b/tutorial/5_sxp_workflow.ipynb index ea89238e..f7a89220 100644 --- a/tutorial/5_sxp_workflow.ipynb +++ b/tutorial/5_sxp_workflow.ipynb @@ -175,7 +175,7 @@ "metadata": {}, "source": [ "## Last bunch contains unusually many events \n", - "garbadge events, filter away" + "garbage events, filter away" ] }, { @@ -394,7 +394,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.16" + "version": "3.8.12" } }, "nbformat": 4, diff --git a/tutorial/6_binning_with_time-stamped_data.ipynb b/tutorial/6_binning_with_time-stamped_data.ipynb index dcde5d6f..230386eb 100644 --- a/tutorial/6_binning_with_time-stamped_data.ipynb +++ b/tutorial/6_binning_with_time-stamped_data.ipynb @@ -9,7 +9,7 @@ }, "source": [ "# Binning of temperature-dependent ARPES data using time-stamped external temperature data\n", - "In this example, we pull some temperature-dependent ARPES data from Zenodo, which was recorded as a continous temperture ramp. We then add the respective temperature informtion from the respective timestamp/temperature values to the dataframe, and bin the data as function of temperature\n", + "In this example, we pull some temperature-dependent ARPES data from Zenodo, which was recorded as a continuous temperature ramp. We then add the respective temperature information from the respective timestamp/temperature values to the dataframe, and bin the data as function of temperature\n", "For performance reasons, best store the data on a locally attached storage (no network drive). This can also be achieved transparently using the included MirrorUtil class." ] }, @@ -49,7 +49,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataset.get(\"TaS2\") # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataset.get(\"TaS2\") # Put in Path to a storage of at least 20 GByte free space.\n", "data_path = dataset.dir\n", "scandir, caldir = dataset.subdirs # scandir contains the data, caldir contains the calibration files\n", "\n", @@ -273,7 +273,7 @@ "metadata": {}, "outputs": [], "source": [ - "# Remaining fluctiations are an effect of the varying count rate throught the scan\n", + "# Remaining fluctuations are an effect of the varying count rate throughout the scan\n", "plt.figure()\n", "rate, secs = sp.loader.get_count_rate()\n", "plt.plot(secs, rate)" @@ -328,7 +328,7 @@ ], "metadata": { "kernelspec": { - "display_name": "sed-ugcuzRKD-py3.9", + "display_name": "python3", "language": "python", "name": "python3" }, @@ -342,7 +342,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.12" } }, "nbformat": 4, diff --git a/tutorial/7_correcting_orthorhombic_symmetry.ipynb b/tutorial/7_correcting_orthorhombic_symmetry.ipynb index 27c6f76a..a385b3d1 100644 --- a/tutorial/7_correcting_orthorhombic_symmetry.ipynb +++ b/tutorial/7_correcting_orthorhombic_symmetry.ipynb @@ -37,7 +37,7 @@ "metadata": {}, "source": [ "## Load Data\n", - "For this example, we use the example data from WSe2. Even though the system is hexagonal, we will use it for demonstation." + "For this example, we use the example data from WSe2. Even though the system is hexagonal, we will use it for demonstration." ] }, { @@ -47,7 +47,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 GByte free space.\n", "data_path = dataset.dir # This is the path to the data\n", "scandir, _ = dataset.subdirs # scandir contains the data, _ contains the calibration files" ] @@ -112,7 +112,7 @@ "metadata": {}, "source": [ "## Spline-warp generation: \n", - "For the spline-warp generation, we need to tell the algorithm the difference in length of Gamma-K and Gamma-M. This we can do using the ascale parameter, which can either be a single number (the ratio), or a list of length ``rotation_symmetry`` definint the relative length of the respective vectors." + "For the spline-warp generation, we need to tell the algorithm the difference in length of Gamma-K and Gamma-M. This we can do using the ascale parameter, which can either be a single number (the ratio), or a list of length ``rotation_symmetry`` defining the relative length of the respective vectors." ] }, { @@ -234,7 +234,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.12" } }, "nbformat": 4, diff --git a/tutorial/8_jittering_tutorial.ipynb b/tutorial/8_jittering_tutorial.ipynb index c2788a4b..ef11af7a 100644 --- a/tutorial/8_jittering_tutorial.ipynb +++ b/tutorial/8_jittering_tutorial.ipynb @@ -45,7 +45,7 @@ "metadata": {}, "outputs": [], "source": [ - "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 Gbyte free space.\n", + "dataset.get(\"WSe2\") # Put in Path to a storage of at least 20 GByte free space.\n", "data_path = dataset.dir # This is the path to the data\n", "scandir, _ = dataset.subdirs # scandir contains the data, _ contains the calibration files" ] @@ -107,7 +107,7 @@ "id": "de1d411c", "metadata": {}, "source": [ - "We notice some oscillation ontop of the data. These are re-binning artefacts, originating from a non-integer number of machine-bins per bin, as we can verify by binning with a different number of steps:" + "We notice some oscillation ontop of the data. These are re-binning artifacts, originating from a non-integer number of machine-bins per bin, as we can verify by binning with a different number of steps:" ] }, { @@ -155,9 +155,9 @@ "id": "c2d82124", "metadata": {}, "source": [ - "To mitigate this problem, we can add some randomness to the data, and re-distribute events into the gaps in-between bins. This is also termed `dithering` and e.g. known from image manipulation. The important factor is to add the right amount and right type of random distribution, to end up at a quasi-continous uniform distribution, but not lose information.\n", + "To mitigate this problem, we can add some randomness to the data, and re-distribute events into the gaps in-between bins. This is also termed `dithering` and e.g. known from image manipulation. The important factor is to add the right amount and right type of random distribution, to end up at a quasi-continuous uniform distribution, but not lose information.\n", "\n", - "We can use the add_jitter function for this. We can pass it the colums to add jitter to, and the amplitude of a uniform jitter. Importantly, this step should be taken in the very beginning as first step before any dataframe operations are added.\n", + "We can use the add_jitter function for this. We can pass it the columns to add jitter to, and the amplitude of a uniform jitter. Importantly, this step should be taken in the very beginning as first step before any dataframe operations are added.\n", "\n", "Let's try with a value of 0.2 for the amplitude:" ] @@ -250,7 +250,7 @@ "id": "282994b8", "metadata": {}, "source": [ - "This jittering fills the gaps, and produces a continous uniform distribution. Let's check again the longer-range binning that gave us the oscillations initially:" + "This jittering fills the gaps, and produces a continuous uniform distribution. Let's check again the longer-range binning that gave us the oscillations initially:" ] }, { @@ -275,7 +275,7 @@ "id": "bc64928b", "metadata": {}, "source": [ - "Now, the artefacts are absent, and similarly will they be in any dataframe columns derived from a column jittered in such a way. Note that this only applies to data present in digital (i.e. machine-binned) format, and not to data that are intrinsically continous. \n", + "Now, the artifacts are absent, and similarly will they be in any dataframe columns derived from a column jittered in such a way. Note that this only applies to data present in digital (i.e. machine-binned) format, and not to data that are intrinsically continuous. \n", "\n", "Also note that too large or not well-aligned jittering amplitudes will\n", "- deteriorate your resolution along the jittered axis\n", @@ -315,7 +315,7 @@ "id": "307557a9", "metadata": {}, "source": [ - "If the step-size of digitization is different from 1, the corresponding stepssize (half the distance between digitized values) can be adjusted as shown above.\n", + "If the step-size of digitization is different from 1, the corresponding stepsize (half the distance between digitized values) can be adjusted as shown above.\n", "\n", "Also, alternatively also normally distributed noise can be added, which is less sensitive to the exact right amplitude, but will lead to mixing of neighboring voxels, and thus loss of resolution. Also, normally distributed noise is substantially more computation-intensive to generate. It can nevertheless be helpful in situations where e.g. the stepsize is non-uniform." ] @@ -376,7 +376,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.6" + "version": "3.8.12" } }, "nbformat": 4,