Debian Codegraph @

doc/features/signal/menu_operations.rst

raw
1 .. _sig-menu-operations:
2
3 Operations on Signals
4 =====================
5
6 This section describes the operations that can be performed on signals.
7
8 .. seealso::
9
10 :ref:`sig-menu-processing` for more information on signal processing features,
11 or :ref:`sig-menu-analysis` for information on analysis features on signals.
12
13 .. figure:: /images/shots/s_operation.png
14
15 Screenshot of the "Operations" menu.
16
17 When the "Signal Panel" is selected, the menus and toolbars are updated to
18 provide signal-related actions.
19
20 The "Operations" menu allows you to perform various operations on the
21 selected signals, such as arithmetic operations, peak detection, or
22 convolution.
23
24 Operations with a constant
25 --------------------------
26
27 Create a new signal which is the result of a constant operation on each selected signal:
28
29 .. list-table::
30 :header-rows: 1
31 :widths: 40, 60
32
33 * - Operation
34 - Description
35 * - |constant_add| Addition
36 - :math:`y_{k} = y_{k-1} + c`
37 * - |constant_subtract| Subtraction
38 - :math:`y_{k} = y_{k-1} - c`
39 * - |constant_multiply| Multiplication
40 - :math:`y_{k} = y_{k-1} \times c`
41 * - |constant_divide| Division
42 - :math:`y_{k} = \dfrac{y_{k-1}}{c}`
43
44 .. |constant_add| image:: ../../../datalab/data/icons/operations/constant_add.svg
45 :width: 24px
46 :height: 24px
47 :class: dark-light no-scaled-link
48
49 .. |constant_subtract| image:: ../../../datalab/data/icons/operations/constant_subtract.svg
50 :width: 24px
51 :height: 24px
52 :class: dark-light no-scaled-link
53
54 .. |constant_multiply| image:: ../../../datalab/data/icons/operations/constant_multiply.svg
55 :width: 24px
56 :height: 24px
57 :class: dark-light no-scaled-link
58
59 .. |constant_divide| image:: ../../../datalab/data/icons/operations/constant_divide.svg
60 :width: 24px
61 :height: 24px
62 :class: dark-light no-scaled-link
63
64 Basic arithmetic operations
65 ---------------------------
66
67 .. list-table::
68 :header-rows: 1
69 :widths: 40, 60
70
71 * - Operation
72 - Description
73 * - |sum| Sum
74 - :math:`y_{M} = \sum_{k=0}^{M-1}{y_{k}}`
75 * - |difference| Difference
76 - :math:`y_{2} = y_{1} - y_{0}`
77 * - |product| Product
78 - :math:`y_{M} = \prod_{k=0}^{M-1}{y_{k}}`
79 * - |division| Division
80 - :math:`y_{2} = \dfrac{y_{1}}{y_{0}}`
81 * - |inverse| Inverse
82 - :math:`y_{2} = \dfrac{1}{y_{1}}`
83 * - |exponential| Exponential
84 - :math:`y_{2} = \exp(y_{1})`
85 * - |logarithm| Logarithm (base 10)
86 - :math:`y_{2} = \log_{10}(y_{1})`
87
88
89 .. |sum| image:: ../../../datalab/data/icons/operations/sum.svg
90 :width: 24px
91 :height: 24px
92 :class: dark-light no-scaled-link
93
94 .. |difference| image:: ../../../datalab/data/icons/operations/difference.svg
95 :width: 24px
96 :height: 24px
97 :class: dark-light no-scaled-link
98
99 .. |product| image:: ../../../datalab/data/icons/operations/product.svg
100 :width: 24px
101 :height: 24px
102 :class: dark-light no-scaled-link
103
104 .. |division| image:: ../../../datalab/data/icons/operations/division.svg
105 :width: 24px
106 :height: 24px
107 :class: dark-light no-scaled-link
108
109 .. |inverse| image:: ../../../datalab/data/icons/operations/inverse.svg
110 :width: 24px
111 :height: 24px
112 :class: dark-light no-scaled-link
113
114 .. |exponential| image:: ../../../datalab/data/icons/operations/exp.svg
115 :width: 24px
116 :height: 24px
117 :class: dark-light no-scaled-link
118
119 .. |logarithm| image:: ../../../datalab/data/icons/operations/log10.svg
120 :width: 24px
121 :height: 24px
122 :class: dark-light no-scaled-link
123
124 Convolution and Deconvolution
125 ------------------------------
126
127 .. list-table::
128 :header-rows: 1
129 :widths: 40, 60
130
131 * - Operation
132 - Implementation
133 * - |convolution| Convolution
134 - Based on `scipy.signal.convolve <https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve.html>`_
135 * - |deconvolution| Deconvolution
136 - Frequency domain deconvolution
137
138 .. |convolution| image:: ../../../datalab/data/icons/operations/convolution.svg
139 :width: 24px
140 :height: 24px
141 :class: dark-light no-scaled-link
142
143 .. |deconvolution| image:: ../../../datalab/data/icons/operations/deconvolution.svg
144 :width: 24px
145 :height: 24px
146 :class: dark-light no-scaled-link
147
148 Absolute value and complex signal operations
149 --------------------------------------------
150
151 .. list-table::
152 :header-rows: 1
153 :widths: 40, 60
154
155 * - Operation
156 - Description
157 * - |abs| Absolute value
158 - :math:`y_{k} = |y_{k-1}|`
159 * - |phase| Phase (argument)
160 - :py:func:`sigima.proc.signal.phase`
161 * - |complex_from_magnitude_phase| Combine with phase
162 - Consider current signal as the module and allow to select a signal representing the phase to merge them in a complex signal
163 :py:func:`sigima.proc.signal.complex_from_magnitude_phase`
164 * - |re| Real part
165 - :math:`y_{k} = \Re(y_{k-1})`
166 * - |im| Imaginary part
167 - :math:`y_{k} = \Im(y_{k-1})`
168 * - |complex_from_real_imag| Combine with imaginary part
169 - Consider current signal as the real part and allow to select a signal representing the imaginary part to merge them in a complex signal :py:func:`sigima.proc.signal.complex_from_real_imag`
170
171 .. |abs| image:: ../../../datalab/data/icons/operations/abs.svg
172 :width: 24px
173 :height: 24px
174 :class: dark-light no-scaled-link
175
176 .. |phase| image:: ../../../datalab/data/icons/operations/phase.svg
177 :width: 24px
178 :height: 24px
179 :class: dark-light no-scaled-link
180
181 .. |complex_from_magnitude_phase| image:: ../../../datalab/data/icons/operations/phase.svg
182 :width: 24px
183 :height: 24px
184 :class: dark-light no-scaled-link
185
186 .. |re| image:: ../../../datalab/data/icons/operations/re.svg
187 :width: 24px
188 :height: 24px
189 :class: dark-light no-scaled-link
190
191 .. |im| image:: ../../../datalab/data/icons/operations/im.svg
192 :width: 24px
193 :height: 24px
194 :class: dark-light no-scaled-link
195
196 .. |complex_from_real_imag| image:: ../../../datalab/data/icons/operations/im.svg
197 :width: 24px
198 :height: 24px
199 :class: dark-light no-scaled-link
200
201 Data type conversion
202 --------------------
203
204 The "Convert data type" |convert_dtype| action allows you to convert the data type
205 of the selected signals.
206
207 .. |convert_dtype| image:: ../../../datalab/data/icons/operations/convert_dtype.svg
208 :width: 24px
209 :height: 24px
210 :class: dark-light no-scaled-link
211
212 .. note::
213
214 Data type conversion relies on :py:func:`numpy.ndarray.astype` function with
215 the default parameters (`casting='unsafe'`).
216
217 Statistics between signals
218 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
219 Create a new signal which is the result of a statistical operation on each point of the selected signals:
220
221 .. list-table::
222 :header-rows: 1
223 :widths: 40, 60
224
225 * - Operation
226 - Description
227 * - |average| Average
228 - :math:`y_{M} = \dfrac{1}{M}\sum_{k=0}^{M-1}{y_{k}}`
229 * - |standard_deviation| Standard Deviation
230 - :math:`y_{M} = \sqrt{\dfrac{1}{M}\sum_{k=0}^{M-1}{(y_{k} - \bar{y})^{2}}}`
231
232 .. |average| image:: ../../../datalab/data/icons/operations/average.svg
233 :width: 24px
234 :height: 24px
235 :class: dark-light no-scaled-link
236
237 .. |standard_deviation| image:: ../../../datalab/data/icons/operations/std.svg
238 :width: 24px
239 :height: 24px
240 :class: dark-light no-scaled-link
241
242 Other mathematical functions
243 ----------------------------
244
245 .. list-table::
246 :header-rows: 1
247 :widths: 40, 60
248
249 * - Function
250 - Description
251 * - |power| Power
252 - :math:`y_{k} = y_{k}^{n}`
253 * - |sqrt| Square root
254 - :math:`y_{k} = \sqrt{y_{k}}`
255 * - |derivative| Derivative
256 - Based on `numpy.gradient <https://numpy.org/doc/stable/reference/generated/numpy.gradient.html>`_
257 * - |integral| Integral
258 - Based on `scipy.integrate.cumulative_trapezoid <https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.cumulative_trapezoid.html>`_
259 * - |signal_to_image| Assemble signals into image
260 - Create a 2D image by assembling selected 1D signals as rows or columns,
261 with optional normalization.
262
263
264 .. |power| image:: ../../../datalab/data/icons/operations/power.svg
265 :width: 24px
266 :height: 24px
267 :class: dark-light no-scaled-link
268
269 .. |sqrt| image:: ../../../datalab/data/icons/operations/sqrt.svg
270 :width: 24px
271 :height: 24px
272 :class: dark-light no-scaled-link
273
274 .. |derivative| image:: ../../../datalab/data/icons/operations/derivative.svg
275 :width: 24px
276 :height: 24px
277 :class: dark-light no-scaled-link
278
279 .. |integral| image:: ../../../datalab/data/icons/operations/integral.svg
280 :width: 24px
281 :height: 24px
282 :class: dark-light no-scaled-link
283
284 .. |signal_to_image| image:: ../../../datalab/data/icons/operations/signals_to_image.svg
285 :width: 24px
286 :height: 24px
287 :class: dark-light no-scaled-link