|
| 1 | +Workflows |
| 2 | +=============== |
| 3 | + |
| 4 | +The ``workflow`` module in **EPRpy** provides high-level processing pipelines for |
| 5 | +common pulsed-EPR experiments. It is designed to take an ``EprData`` object as input |
| 6 | +and return a fully processed ``EprData`` object, with all intermediate results and |
| 7 | +processing steps preserved for reproducibility in the ``data_dict`` method. |
| 8 | + |
| 9 | +Currently, the module supports workflows for: |
| 10 | + |
| 11 | +* **HYSCORE** (Hyperfine Sublevel Correlation) experiments |
| 12 | +* **ESEEM** (Electron Spin Echo Envelope Modulation) experiments |
| 13 | + |
| 14 | +These workflows include baseline correction, windowing, zero-filling, Fourier |
| 15 | +transformation, and frequency axis generation. Optionally, symmetrisation of HYSCORE |
| 16 | +spectra and background fitting strategies for ESEEM are provided. |
| 17 | + |
| 18 | +A workflow can be simply used by loading experimental data with a compatible pulse program : |
| 19 | + |
| 20 | +.. code-block:: python |
| 21 | +
|
| 22 | + # import EPRpy |
| 23 | + import eprpy as epr |
| 24 | + |
| 25 | + # Load data by providing path to .DSC or .DTA file |
| 26 | + hyscore_data = epr.load('hyscore_exp.DSC') |
| 27 | +
|
| 28 | + # process using a workflow, zero fill 1024 points |
| 29 | + hyscore_processed = hyscore_data.workflow(zf=1024) |
| 30 | +
|
| 31 | +
|
| 32 | +Have a look at `workflow examples <notebooks/examples.html#Workflows>`_. |
| 33 | + |
| 34 | +Internally, the :ref:`eprworkflowclass` is used when ``EprData.workflow()`` is called. In the example above, ``hyscore_processed`` is an ``EprData`` object, so all methods of ``EprData`` object are also accessible. |
| 35 | +Other parameters which are supported for a workflow is explained in the section :ref:`eprworkflowclass`. In the following, the workflow processing steps are elaborated. |
| 36 | + |
| 37 | +HYSCORE processing |
| 38 | +-------------------- |
| 39 | + |
| 40 | +The workflow supports pulse programs: |
| 41 | + - ``HYSCORE`` |
| 42 | + |
| 43 | + |
| 44 | +HYSCORE datasets are procssed by by: |
| 45 | + - Applying 2D polynomial baseline correction. |
| 46 | + - Windowing with Hamming functions in both dimensions. |
| 47 | + - Zero-filling (optional). |
| 48 | + - Performing a 2D FFT and shifting the result. |
| 49 | + - Symmetrising the FFT data (optional). |
| 50 | + - Returning all results (raw, intermediate, final) in a dictionary. |
| 51 | + |
| 52 | +The output contains frequency axes in MHz and processed spectra suitable for |
| 53 | +plotting and further analysis. |
| 54 | + |
| 55 | +If you have a processed ``EprData`` object from a ``HYSCORE`` data set, the processed arrays can be accessed using ``EprData.data_dict``: |
| 56 | + |
| 57 | +.. code-block:: python |
| 58 | +
|
| 59 | + - 'proc_param': Processing parameters used. |
| 60 | + - 'raw_data': Original raw data. |
| 61 | + - 'baseline_dim1', 'baseline_dim2': Baseline correction results for both dimensions. |
| 62 | + - 'bc_data': Baseline-corrected data. |
| 63 | + - 'window_dim1', 'window_dim2': Window functions applied. |
| 64 | + - 'bc_w_data': Baseline-corrected and windowed data. |
| 65 | + - 'time_axis1', 'time_axis2': Time axes (extended if zero-filled). |
| 66 | + - 'bc_w_zf_data': Zero-filled, baseline-corrected, windowed data. |
| 67 | + - 'frequency_axis1', 'frequency_axis2': Frequency axes for FFT. |
| 68 | + - 'FFT_data': 2D FFT of processed data. |
| 69 | + - 'FFT_shifted_data': FFT data after shift. |
| 70 | + - 'data': Absolute value of shifted FFT (final processed data, optionally symmeterised). |
| 71 | + - 'dims': Frequency axes for plotting. |
| 72 | + - 'is_complex': Boolean indicating if data is complex (always False). |
| 73 | + - 'history': List of processing steps. |
| 74 | +
|
| 75 | +
|
| 76 | +ESEEM processing |
| 77 | +-------------------- |
| 78 | +
|
| 79 | +The workflow supports pulse programs: |
| 80 | + - ``2P ESEEM`` |
| 81 | + - ``3P ESEEM`` |
| 82 | + - ``2P ESEEM vs. B0`` |
| 83 | + - ``3P ESEEM vs. B0`` |
| 84 | + - ``3P ESEEM vs tau`` |
| 85 | +
|
| 86 | +ESEEM datasets are processed by: |
| 87 | + - Applying background correction (exponential or polynomial). |
| 88 | + - Windowing with a Hamming function. |
| 89 | + - Zero-filling (optional). |
| 90 | + - Performing a 1D FFT (or along the last axis for 2D data). |
| 91 | + - Returning absolute, shifted FFT spectra along with all intermediate steps. |
| 92 | +
|
| 93 | +Results include the processed frequency-domain spectra in MHz, with |
| 94 | +dimensionality preserved for field-dependent ESEEM maps. |
| 95 | +
|
| 96 | +If you have a processed ``EprData`` object from a ``ESEEM`` data set, the processed arrays can be accessed using ``EprData.data_dict``: |
| 97 | +
|
| 98 | +.. code-block:: python |
| 99 | +
|
| 100 | + - 'proc_param': Processing parameters used. |
| 101 | + - 'raw_data': Original raw data. |
| 102 | + - 'baseline_dim1': Baseline correction results. |
| 103 | + - 'bc_data': Baseline-corrected data. |
| 104 | + - 'window_dim1': Window function applied. |
| 105 | + - 'bc_w_data': Baseline-corrected and windowed data. |
| 106 | + - 'time_axis1': Time axis (extended if zero-filled). |
| 107 | + - 'bc_w_zf_data': Zero-filled, baseline-corrected, windowed data. |
| 108 | + - 'frequency_axis1': Frequency axis for FFT. |
| 109 | + - 'FFT_data': FFT of processed data. |
| 110 | + - 'FFT_shifted_data': FFT data after shift. |
| 111 | + - 'data': Absolute value of shifted FFT (final processed data). |
| 112 | + - 'dims': Frequency axis (and second axis if 2D data). |
| 113 | + - 'is_complex': Boolean indicating if data is complex (always False). |
| 114 | + - 'history': List of processing steps. |
| 115 | +
|
| 116 | +
|
| 117 | +.. _eprworkflowclass: |
| 118 | +
|
| 119 | +EprWorkflow Class |
| 120 | +-------------------- |
| 121 | +
|
| 122 | +The ``EprWorkflow`` class encapsulates complete workflows for HYSCORE and ESEEM |
| 123 | +data processing. It manages parameters like zero-filling, polynomial order for |
| 124 | +baseline correction, and optional symmetrisation. All results, including raw |
| 125 | +data, corrected data, intermediate steps, and frequency-domain spectra, are |
| 126 | +stored in a dictionary that is updated step by step. |
| 127 | +
|
| 128 | +**Parameters** |
| 129 | + - **eprdata** (*EprData*) – Instance of the EprData class. |
| 130 | + - **zf** (*int, optional*) – Number of points to add via zero filling. |
| 131 | + - **poly_order** (*int, optional, default=3*) – Order of the polynomial for baseline correction in case of 3P ESEEM experiments |
| 132 | + - **x_max** (*float, optional*) – Upper bound of the Hamming window. |
| 133 | + - **pick_eseem_points** (*bool, default=False*) – Whether to pick points along the ESEEM decay curve for background calculation. If False, all data points are used. |
| 134 | + - **symmeterise** (*bool or str, default=False*) – If set, symmetrises HYSCORE FFT results across diagonal or anti-diagonal. |
| 135 | +
|
| 136 | +Both ``hyscore()`` and ``eseem()`` return a **dictionary** containing raw data, |
| 137 | +intermediate results, processing parameters, and final spectra. |
| 138 | +Some keys are primarily useful for debugging, while others are essential for |
| 139 | +end-users who wish to analyse or visualise results. |
| 140 | +
|
| 141 | +
|
0 commit comments