Dataset Expressions

GX-TXT DEV112 P011-bis

Write expressions on datasets, use columns, metadata and selections as sources and browse the list of functions.

Generate and inspect the Dataset

From Session → New Session → Generate Session choose Descriptive Statistics Student Lab and create a Session Standalone. The Generator is in the public GX-TXT catalog. In Configuration → Modules enable Dataset Expression. In Dataset enable student.descriptive.source and open Canonical table. The column signed_V has 12 values from −5 to 6 V, while Metadata contains the numerical value teaching.expected_plot_variants = 4. These two inputs let you check all the exercises by hand.

Selection of Descriptive Statistics Student Lab in Generate Session before the Session is created.
Selection of Descriptive Statistics Student Lab in Generate Session before the Session is created.
Values and units in the Generator’s canonical table.
Values and units in the Generator’s canonical table.

Define the formula and the series

  1. In Analysis → Dataset Expression choose student.descriptive.source in the row primary of Dataset sources. Use the Dataset already prepared in the Session. To combine rows from different Datasets you need an explicit alignment before the computation.
  2. Leave empty Saved definition file, enter u*k in Expression and open Symbol bindings. In the first row put symbol u, source series, variable signed_V. Press + Add and create k as literal, with Scalar 2 and unit 1. Remove deletes the corresponding binding. Each symbol used in the formula must have its own definition.
  3. Leave Data selection on None, set Output Dataset ID on espressione.literal and Output variable ID on risultato. Write mV in Output unit. The unit must be compatible with the computed value. If you leave it empty, GX-TXT derives the unit from the resulting dimensions. Scalar unit / missing variable unit declares the unit of a literal or completes the missing unit of a variable. A series with a declared unit uses the source schema.
  4. Tick Run / recalculate now. In Run check the input primary, press Run enabled analyses and check Results. Open the resulting Dataset in the canonical table. The values range from −10,000 to 12,000 mV, with one sample per row.

In Supported operations, Browse NUMERIC_API operations… opens the catalog: select a name and read category, number of arguments and description. Insert function name transfers the name into the expression. Complete arguments and parentheses according to the function detail.

Browser of the numerical operations available to the formula.
Browser of the numerical operations available to the formula.
The series u comes from signed_V. The literal factor k is 2.
The series u comes from signed_V. The literal factor k is 2.
Result in millivolts in the canonical table.
Result in millivolts in the canonical table.

Use a metadata value, a row or an aggregate

Source
metadata
How to set the symbol k
Enter teaching.expected_plot_variants in Metadata key, unit 1. Compute u*k in V.
Checkable result
From −20 to 24 V in 12 rows. The numerical value of the metadata is a scalar.
Source
row
How to set the symbol k
Set signed_V, write 1 in Source row (one-based) and compute u-k in V.
Checkable result
From 0 to 11 V. Row 1 provides −5 V.
Source
selection
How to set the symbol k
Set sel_001 in Data selection, set signed_V and use k alone as the expression. Change the ID for each run.
Checkable result
On rows 3–12, mean and median is 1.5 V, minimum −3 V, maximum 6 V and sum 15 V. Each is published as a single row.

To use a different interval, first save the selection on the X coordinates of the Dataset in the plot and then choose its entry in Data selection. Check the number of samples in the result. Keep the formula and a distinct output ID for each comparison.

The mean aggregate uses the lab’s existing selection.
The mean aggregate uses the lab’s existing selection.
A scalar measurement in the canonical table after aggregation.
A scalar measurement in the canonical table after aggregation.

Browse the catalog of numerical operations

With Browse NUMERIC_API operations… select the operation in the table and read Arguments and the detail panel. Insert function name inserts the name followed by the opening parenthesis. Complete the arguments and close the parenthesis. In the following groups Arguments gives the number of arguments shown by the browser. For unit, domain, non-finite values and the options of each case use the operation panel. The module accepts a scalar result or a series compatible with the output rows.

To try an operation from the catalog, leave only the binding u to signed_V, remove k with Remove and enter abs(u). Keep the unit V and publish espressione.modulo. On 12 rows, the first value is 5 V and the last 6 V. Inserting the name was also exercised for the other listed operations.

elementwise · 32 operations

Transforms the values one by one. For a binary function check that the dimensions are compatible; logarithms, exponentials and trigonometric functions require arguments suited to the declared domain.

FunctionArguments
abs1–1
acos1–1
add2–2
asin1–1
atan1–1
atan22–2
ceil1–1
cos1–1
cosh1–1
divide2–2
exp1–1
expm11–1
floor1–1
hypot2–2
log1–1
log101–1
log1p1–1
maximum2–2
minimum2–2
multiply2–2
negate1–1
power2–2
reciprocal1–1
round1–1
sign1–1
sin1–1
sinh1–1
sqrt1–1
square1–1
subtract2–2
tan1–1
tanh1–1
comparison · 6 operations

Compares the operands at each position. The result is logical and can feed the mask operations.

FunctionArguments
equal2–2
greater_equal2–2
greater_than2–2
less_equal2–2
less_than2–2
not_equal2–2
predicate · 5 operations

Checks whether each value is finite, NaN or infinite, optionally with a specified sign.

FunctionArguments
is_finite1–1
is_inf1–1
is_nan1–1
is_neg_inf1–1
is_pos_inf1–1
mask · 6 operations

Combines or applies logical masks. For where, provide the mask and the two alternatives. Check that the resulting length can be published by the module.

FunctionArguments
logical_and2–2
logical_not1–1
logical_or2–2
logical_xor2–2
select2–2
where3–3
reduction · 19 operations

Summarizes several values along the given axis. Some reductions produce a scalar. For quantile see the probabilities and options suggested by the browser.

FunctionArguments
all1–1
any1–1
argmax1–1
argmin1–1
count1–1
count_true1–1
max1–1
mean1–1
median1–1
min1–1
product1–1
quantile1–2
rms1–1
std1–1
std_population1–1
sum1–1
valid_count1–1
variance_population1–1
variance_sample1–1
statistics · 8 operations

Computes a measure or statistic with declared options. Check the handling of pairs, the scale and the result type in the detail panel.

FunctionArguments
correlation2–2
covariance2–2
local_cloud_fit3–3
mad1–1
power_level1–1
rank1–1
spectral_features2–2
welch_aggregate2–2
calculus · 4 operations

Computes sums, integrals or derivatives on samples. For integrals and derivatives check the order of the axes, the domains and the units of X and Y.

FunctionArguments
cumulative_integral2–2
cumulative_sum1–1
differentiate2–2
integrate2–2
interpolation · 3 operations

Recomputes a series on target coordinates. Check the method, the domain coverage and the length of the output grid.

FunctionArguments
interpolate3–3
resample3–3
resample_uniform3–3

Rerun a definition and check the provenance

The computation writes expression_definition.ini in the module folder. Get the file of the double-voltage example (ZIP) and copy it into the Session as notes/examples/tensione-doppia.ini. In a Session of the same lab, enable the Dataset student.descriptive.source and write that path in Saved definition file. You can also use the absolute path to the file. Use a new ID and check the 12 values in mV again. To go back to a typed formula, clear the file field.

In Dataset → Preview look at the structure. To compare the numbers use Canonical table, with Metadata and Technical Details for identity and provenance. To plot the result use a Plot module, choosing the new Dataset as the source. Dataset Expression publishes the computed column and the definition.

Rerun of the formula from a definition with a path relative to the Session.
Rerun of the formula from a definition with a path relative to the Session.