Lookup tables
- class rtctools.optimization.csv_lookup_table_mixin.LookupTable(inputs: list[MX], function: Function, tck: tuple = None)[source]
Bases:
LookupTableLookup table.
- __call__(*args: float | Iterable | Timeseries) float | ndarray | Timeseries[source]
Evaluate the lookup table.
- Parameters:
args (Float, iterable of floats, or
Timeseries) – Input values.- Returns:
Lookup table evaluated at input values.
Example use:
y = lookup_table(1.0) [y1, y2] = lookup_table([1.0, 2.0])
- class rtctools.optimization.csv_lookup_table_mixin.CSVLookupTableMixin(**kwargs)[source]
Bases:
OptimizationProblemAdds lookup tables to your optimization problem.
During preprocessing, the CSV files located inside the
lookup_tablessubfolder are read. In every CSV file, the first column contains the output of the lookup table. Subsequent columns contain the input variables.Cubic B-Splines are used to turn the data points into continuous lookup tables.
Optionally, a file
curvefit_options.inimay be included inside thelookup_tablesfolder. This file contains, grouped per lookup table, the following options:- monotonicity:
is an integer, magnitude is ignored
if positive, causes spline to be monotonically increasing
if negative, causes spline to be monotonically decreasing
if 0, leaves spline monotonicity unconstrained
- curvature:
is an integer, magnitude is ignored
if positive, causes spline curvature to be positive (convex)
if negative, causes spline curvature to be negative (concave)
if 0, leaves spline curvature unconstrained
Note
Currently only one-dimensional lookup tables are fully supported. Support for two- dimensional lookup tables is experimental.
- Variables:
csv_delimiter – Column delimiter used in CSV files. Default is
,.csv_lookup_table_debug – Whether to generate plots of the spline fits. Default is
False.csv_lookup_table_debug_points – Number of evaluation points for plots. Default is
100.