Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lookup_table_type [2011/04/02 23:19]
hermann
lookup_table_type [2020/12/07 19:48] (current)
hermann [Automatic Conversions]
Line 1: Line 1:
 ====== Lookup Table Type ====== ====== Lookup Table Type ======
  
-===== EGO Script =====+A lookup table is a collection of key and value pairs. Both key and value are represented using double precision [[wp>​Floating_point | floating point numbers]], allowing the definition of integral and fractional keys and value pairs.
  
-=== Basic ===+Optionally, a lookup table may also include a key and value names.
  
-Lookup tables are a sequence of key/value pair enclosed by [ ]. The key/values are represented by real values. Optionally, the first line may define the key/value names.+===== GUI Editor ===== 
 + 
 +[{{ :​editors:​lookup_table_editor.png?​nolink |Graphical representation of the lookup table editor}}] 
 + 
 +The editor provides some additional useful operations:​ 
 + 
 +It is possible to load the editor content importing the value from a [[wp>​Comma-separated_values|CSV file]]. It is also possible to export the content to a [[wp>​Comma-separated_values|CSV file]]. 
 + 
 +Two rows can be used to interpolate other rows in between. The keys are created incrementing the lower selected key until the greatest selected key is reached. The values are interpolated linearly between the two original selected values. 
 + 
 +The table can also be presented as a graph using different representations. 
 + 
 +===== EGO Script ===== 
 + 
 +Lookup tables are a sequence of key/value pair enclosed by [ ]. The key/values are represented by real values.
  
 <code cpp> <code cpp>
 [ [
-  "​Year"​ "​Transition Rate", 
   1991 0.02,   1991 0.02,
   1993 0.025,   1993 0.025,
Line 17: Line 30:
 </​code>​ </​code>​
  
-The use of comas between elements and key/​value ​pair is optional. The layout can also be changed at will.+The use of commas ​between elements and key/​value ​pairs is optional. The layout can also be changed at will.
  
 <code cpp> <code cpp>
-"​Year"​ "​Transition Rate" ​1991 0.02 1993 0.025 1997 0.01 1999 0.05 ]+[ 1991 0.02 1993 0.025 1997 0.01 1999 0.05 ]
 </​code>​ </​code>​
  
-=== Lookup table with a header ===+Optionally, the first two elements may define the key/value names. The key name must also be optionally suffixed ​with "​*"​. If the names are omitted, the resulting table uses "​Key"​ and "​Value"​ as the key and value names, respectively. Blanks in names are automatically replaced by "​_"​ (underscore).
  
 <code cpp> <code cpp>
Line 35: Line 48:
 </​code>​ </​code>​
  
-=== Lookup ​table without a header ===+Again, the table layout is not relevant.
  
-It is possible to ommit the table header definition. The resulting table uses "Key" ​and "Value" ​as the key and value names respectivaly.+<code cpp> 
 +"Year" "Transition Rate" ​1991 0.02 1993 0.025 1997 0.01 1999 0.05 ] 
 +</​code>​ 
 + 
 +Key/value sequences can be defined using the operator ''​..''​ (two consecutive dots). This operator forces the values between the given pair of entries to be automatically generated. Keys are generated incrementing the initial sequence ​key by one until reach the final sequence key. Values are generated interpolating the corresponding values across the key ranges.
  
 <code cpp> <code cpp>
 [ [
-  1991 0.02+ "​X"​ "​Y",​ 
-  1997 0.01+ 1.4.0
-  ​1999 ​0.05+ 1.3 12.0
 + 1.7 5... 7.3 8.5
 ] ]
 </​code>​ </​code>​
  
-=== Lookup ​table with sequences ===+The previous ​table is automatically expanded to
  
-Value sequences can be defined using the operator ​"..".+<code cpp> 
 +
 + "X" "​Y",​ 
 + 1.0 4.0, 
 + 1.3 12.0, 
 + 1.7 5.0, 
 + 2.0 5.5, 
 + 3.0 6.0, 
 + 4.0 6.5, 
 + 5.0 7.0, 
 + 6.0 7.5, 
 + 7.0 8.0, 
 + 7.3 8.5 
 +
 +</​code>​ 
 + 
 +It is possible to use more than one sequence definition in a given table.
  
 <code cpp> <code cpp>
Line 60: Line 94:
 ] ]
 </​code>​ </​code>​
 +
 +When a script is saved, the lookup tables are automatically collapsed using the ''​..''​ notation, if possible.
 +
 +===== Automatic Conversions =====
 +
 +  * **Converted from**: [[Table Type]]: the table must have columns “*#​real” and ”#​real”. [[Change Matrix Type]], [[Transition Matrix Type]] and [[Percent Matrix Type]].
 +
 +  * **Converted to**: [[Table Type]], [[Change Matrix Type]], [[Transition Matrix Type]], [[Percent Matrix Type]] and [[Int Set]].