ewoksxas.tasks.combine_rows#
Apply a mathematical equation to groups of rows selected by metadata.
The typical use-case is combining tabular data where multiple rows represent
different measurements or channels that should be merged. For example, a
dataset might have one row per counter (signal, monitor, …). This task
lets the user write an equation such as signal / monitor and receive
a new table whose result row is appended (or replaces) the originals.
Row selection#
Two metadata fields govern which rows participate in the calculation:
grouping - identifies which rows belong to the same group. Rows that share the same value of this column are treated as one group. Example:
"Group ID".equation_terms - the metadata column whose values name the rows within each group. All rows in the group are made available in the equation namespace by their value string (e.g.
signal,monitor).
Equation#
Inside the equation all rows of a group are available by their metadata
value (e.g. signal, monitor).
Common numpy/math helpers (sqrt, log, exp, abs, …) are available.
Values that are not valid Python identifiers (e.g. "det 1") cannot be
referenced in the equation and are ignored. Duplicate values within a group
raise an error because the equation result would depend on row order.
Output#
"insert"- inserts one result row per group immediately after the last row of that group; the new row gets the same grouping metadata as the group and the equation as the value for equation_terms."replace"- collapses each group to its single result row, in first-seen group order.
Functions
|
Evaluate the equation with rows available as local names. |
Classes
|
Apply a mathematical equation to groups of rows. |
|
|
|