Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
calculate_value [2026/07/04 23:52] hermann |
calculate_value [2026/08/28 03:14] (current) hermann Sync from local documentation review |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ===== Description ===== | ===== Description ===== | ||
| - | Evaluates an expression **once** and returns a single **scalar value**. Unlike the map and lookup table calculators, there is no current cell, row, or spatial grid — the expression is evaluated in a purely scalar context. | + | Evaluates an algebraic or logical expression once and returns a single scalar value. Unlike the map and lookup table calculators, there is no current cell, row, or spatial grid: the expression is evaluated in a purely scalar context, drawing only on tables, lookup tables, and scalar values connected through hooks. |
| - | This functor is one of five in the [[calculate_functors|calculator family]]. Use it to compute a single parameter — such as a global threshold, a weighted sum of scalar inputs, or a value derived from a table — that can then be passed as input to other functors. | + | This is one of Dinamica EGO's five calculator functors. Its abbreviated (shorthand) syntax is ''$''. See [[ego_script#calculator_functor_shorthand|Calculator functor shorthand]] in the EGO Script documentation for the verbose and abbreviated forms, and [[Calculate Functors|Calculate Functors — Complete Operator Documentation]] for the full expression language reference. |
| - | + | ||
| - | The **abbreviated syntax** (also called **shorthand**) for this functor is ''$''. See [[ego_script#calculator_functor_shorthand|Calculator functor shorthand]] in the EGO Script documentation for the full syntax of both the verbose and abbreviated forms, and [[calculate_functors|Calculate Functors — Complete Operator Documentation]] for the complete expression language reference. | + | |
| ===== Inputs ===== | ===== Inputs ===== | ||
| - | ^ Name ^ Type ^ Description ^ | + | ^ Name ^ Type ^ Description ^ |
| - | | Expression | [[Image Expression Type]] | The algebraic or logical formula that evaluates to a single numeric result, written using the [[Image Expression Type|image expression editor]]. Must be enclosed in square brackets ''[ ]'' in EGO Script. | | + | | Expression | [[Image Expression Type]] | Algebraic or logical expression that evaluates to a single numeric result. Must be enclosed in square brackets ''[ ]'' in EGO Script. | |
| ===== Optional Inputs ===== | ===== Optional Inputs ===== | ||
| - | ^ Name ^ Type ^ Default ^ Description ^ | + | ^ Name ^ Type ^ Description ^ Default Value ^ |
| - | | Default Value | [[Real Value Type]] | None | Value returned if the expression produces an algebraic error. When provided, acts as a catch-all fallback equivalent to wrapping the entire expression in the ''?'' operator. | | + | | Default Value | [[Real Value Type]] | Value returned if evaluating the expression produces an algebraic error. When not provided, evaluation errors are propagated. This is an advanced port. | .none | |
| - | ===== Output ===== | + | ===== Outputs ===== |
| - | ^ Name ^ Type ^ Description ^ | + | ^ Name ^ Type ^ Description ^ |
| - | | Result | [[Real Value Type]] | The computed scalar value. | | + | | Result | [[Real Value Type]] | The computed scalar value. | |
| ===== Group ===== | ===== Group ===== | ||
| Line 32: | Line 30: | ||
| ==== Connecting data inputs ==== | ==== Connecting data inputs ==== | ||
| - | Tables, lookup tables, and scalar values referenced in the expression must be connected to the functor's ports before writing the expression, using **hook** functors: | + | Tables, lookup tables, and scalar values referenced in the expression must be connected to the functor's ports before writing the expression, using hook functors: |
| - | * Tables and lookup tables → [[Number Table]] → referenced in the expression as ''t1'', ''t2'', …, ''t100'' | + | * Tables and lookup tables → [[Number Table]] → referenced in the expression as t1, t2, …, t100 |
| - | * Scalar values → [[Number Value]] → referenced as ''v1'', ''v2'', …, ''v100'' | + | * Scalar values → [[Number Value]] → referenced as v1, v2, …, v100 |
| Maps cannot be connected — there is no cell context in this functor. In the abbreviated syntax, tables are referenced as ''%variableName'' and values as ''$variableName''. | Maps cannot be connected — there is no cell context in this functor. In the abbreviated syntax, tables are referenced as ''%variableName'' and values as ''$variableName''. | ||
| Line 41: | Line 39: | ||
| ==== Available expression features ==== | ==== Available expression features ==== | ||
| - | Image operators (''iX''), the ''line'' and ''column'' spatial keywords, neighbourhood functions, neighbourhood indexing, and convolution are not available — there is no cell or row context. Available features are arithmetic and logical operators and table and lookup table queries (''tX[...]'') in all single-key and multi-column forms. See [[calculate_functors#the_expression_language|The Expression Language]] for the complete reference, or [[Image Expression Type]] for the navigable operator index. | + | Image operators (''iX''), the line and column spatial keywords, neighbourhood functions, neighbourhood indexing, and convolution are not available — there is no cell or row context. Available features are arithmetic and logical operators and table and lookup table queries (''tX[...]'') in all single-key and multi-column forms. See [[Calculate Functors#The Expression Language|The Expression Language]] for the complete reference, or [[Image Expression Type]] for the navigable operator index. |
| + | |||
| + | All operations are performed using the precision defined by ImageExpression::Value; the final result is then converted to a double-precision real. See [[Calculate Value 2]] for a variant that instead performs all operations using double precision throughout. | ||
| ==== Null value handling ==== | ==== Null value handling ==== | ||
| - | Null propagation rules and defensive patterns are covered in [[calculate_functors#null_value_handling|Null Value Handling]] in the Calculate Functors documentation. | + | Null propagation rules and defensive patterns are covered in [[Calculate Functors#Null Value Handling|Null Value Handling]] in the Calculate Functors documentation. |
| ===== Internal Name ===== | ===== Internal Name ===== | ||
| - | ''CalculateValue'' | + | CalculateValue |
| ===== Usage examples ===== | ===== Usage examples ===== | ||
| - | * [[calculate_functors#calculatevalue_examples|CalculateValue practical examples]] in the Calculate Functors documentation | + | * [[Calculate Functors#CalculateValue practical examples|CalculateValue practical examples]] in the Calculate Functors documentation |
| * [[lesson_8|Lesson 8: Inserting and getting a specific value into a table]] | * [[lesson_8|Lesson 8: Inserting and getting a specific value into a table]] | ||
| - | |||