Skip to content

Commit 32a7878

Browse files
committed
SF: Add documentation for avg in group mode and extract operation
to rst and SF help notebook
1 parent 0982ecf commit 32a7878

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

Packages/MIES/SweepFormulaHelp.ifn

5.91 KB
Binary file not shown.

Packages/doc/SweepFormula.rst

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,15 @@ avg and mean
332332
`avg` and `mean` are synonyms for the same operation.
333333
They calculate the arithmetic average :math:`\frac{1}{n}\sum_i{x_i}`.
334334

335-
data: input data wave(s)
335+
data: input data wave(s) or array of datasets
336336

337337
mode: optional parameter that defines in which direction the average is applied.
338338
- `in` default, applies the average over each input data wave. In this mode the operation returns the same number of waves as input waves were specified. Each output wave contains a single data point. If input data type is `SF_DATATYPE_SWEEP` from the data operation the sweep meta data is transferred to the returned data waves. The default suggested x-axis values for the formula plotter are sweep numbers.
339339
- `over` averages over all input data waves. In this mode the operation returns a single wave. `NaN` values in input waves are ignored in the average calculation. A trace generated from the returned wave will be shown as topmost trace in the default color for averaged data.
340+
- `group` accepts an array of datasets as the first argument where each dataset must have the same number of elements. The average calculation is performed over the n-th elements of each dataset. Example: Lets say one has three datasets of sweep data with sweep 1, 2, 3; 4, 5, 6 and 7, 8, 9. Each prepared in an own variable `sweepset0`, `sweepset1` and `sweepset2`. When `avg([$sweepset0, $sweepset1, $sweepset2], group)` is called the averaging works on sweep 1, 4, 7, then 2, 5, 8 and finally 3, 6, 9. The result is a new dataset of the same size (three) as the input datasets. The input datasets can be of any type and do not need to be sweep data. The first argument must contain at least two datasets. Meta data (if present) is transferred from the first element datasets in the array to the result.
341+
342+
When an argument is of the select type then automatically data is applied to implicitly convert to sweep data.
343+
This conversion is also applied in the `group` mode for array element that are of select type.
340344

341345
The returned data type is `SF_DATATYPE_AVG`.
342346

@@ -348,6 +352,21 @@ The returned data type is `SF_DATATYPE_AVG`.
348352
349353
avg(data(select(selrange(ST))), in)
350354
355+
avg([select(selrange(E1)), select(selrange(E2))], group)
356+
357+
extract
358+
"""""""
359+
360+
.. code-block:: bash
361+
362+
extract(datasets, index)
363+
364+
`extract` takes datasets as first argument and an index number as second argument. It returns the dataset from position index.
365+
366+
.. code-block:: bash
367+
368+
sweep2DA = extract(data(select(selsweeps(1, 2, 3), selvis(all), selchannels(DA))), 1)
369+
351370
root mean square
352371
""""""""""""""""
353372

0 commit comments

Comments
 (0)