3.1.1UI Theme#
Controls the color theme of the user interface. Default: 'dark'.
Setting this option to 'lite' enables the lite theme.
Changes are applied immediately.
C-LAB 26.08.0 · October 2026
This document describes the API of the C-LAB Python module distributed with C-LAB 26.08.0. Get the latest version from https://www.c-lab.tech.
For additional information, support, or feedback, contact us at info@c-lab.tech.
Python® is a registered trademark of the Python Software Foundation.
Copyright 2018 – 2026
All rights reserved
C-LAB module defines 6 custom classes, as listed below. Refer to each section for further information.
clab.Array stores data as a contiguous array of IEEE 754 double-precision (64-bit) floating-point values.
An instance of clab.Array can be created directly using the following functions:
clab.Array(list)listrequiredclab.Array(other)otherrequiredclab.Array. This constructor will shallow-copy other to the new object. Therefore, both objects will share the same underlying data values: modifications done in one object will reflect upon the other. Check the clone function if a deep-copy is required.clab.Array(len)lenrequiredclab.Array will be zero-initialized.clab.Array has no publicly exposed member variables.
clab.Array implements the Number Protocol, supporting standard arithmetic operations: addition, subtraction, multiplication, remainder, division, exponentiation, bitwise AND (), bitwise XOR (^), bitwise OR (), negation (), and absolute value. In-place equivalents are also supported.
clab.Array implements the Sequence Protocol, allowing element access via the standard operator.
Besides standard protocols, the following member functions are available:
out = clab.Array.clone()outclab.Array.Return a new clab.Array containing a deep-copy of the caller’s values.
out = clab.Array.to_list()outclab.Array.Export array values as a standard Python list.
out = clab.Array.avg()outReturn the arithmetic mean (average) of the array’s values.
out = clab.Array.sum()outReturn the sum of all elements in the array.
out = clab.Array.count_eq(val)outvalrequiredReturn the number of elements in the array that are exactly equal to val.
out = clab.Array.count_gt(val)outvalrequiredReturn the count of elements that are strictly greater than val.
out = clab.Array.count_lt(val)outvalrequiredReturn the count of elements that are strictly less than val.
out = clab.Array.count_bt(val1, val2)outval1requiredval2requiredReturn the count of elements that are strictly between the provided arguments, i.e., and .
out = clab.Array.logical_and(rhs)outclab.Array.rhsclab.Array.Return a new array (containing 0s and 1s) resulting from the logical AND operation between the current array and clab.Array rhs.
out = clab.Array.logical_or(rhs)outclab.Array.rhsclab.Array.Return a new array (containing 0s and 1s) resulting from the logical OR operation between the current array and clab.Array rhs.
out = clab.Array.logical_not()outclab.Array.Return a new array (containing 0s and 1s) representing the logical NOT operation on all elements.
out = clab.Array.logical_xor(rhs)outclab.Array.rhsclab.Array.Return a new array (containing 0s and 1s) resulting from the logical XOR operation between the current array and clab.Array rhs.
The clab.Container class stores variables loaded from a file or acquired from a real-time source (experimental feature). Each clab.TimeSeries is also exposed as an attribute of the container, with its name automatically converted into a valid Python identifier.
An instance of clab.Container can be created using:
clab.Container(path, plugin='', realtime=False, samples=300)pathrequiredFull path to the input file.
If the file is compressed, C-LAB will first decompress it into the cache directory and then load the extracted file using the appropriate loader.
pluginoptionalFull path to a plugin.
If omitted, C-LAB automatically selects a compatible loader by testing installed plugins and built-in loaders. If provided, the specified plugin is used directly, bypassing compatibility checks.
realtimeoptional[experimental] Enables acquisition from a real-time data source when set to True.
This feature is experimental and its API may change in future releases.
samplesoptional[experimental] Maximum number of samples stored when acquiring real-time data.
Once this limit is reached, older samples are discarded to accommodate new data. This feature is experimental and subject to change.
clab.Container.id64integerRead-only. Unique 64-bit identifier.
clab.Container.flagsintegerRead-only. Reserved for internal use.
clab.Container partially implements the Mapping Protocol, allowing access to individual clab.TimeSeries objects via the [] operator using their source names.
In addition to standard protocol behavior, the following member functions are available:
out = clab.Container.get_path()outReturns the list of file paths associated with the container.
out = clab.Container.get_size()outReturns the number of TimeSeries objects in the container.
clab.Container.axpb(a, b)arequiredbrequiredApplies the transformation to the x-axis of all variables.
If the data is not yet loaded, the operation is deferred until loading completes.
clab.Container.aypb(a, b)arequiredbrequiredApplies the transformation to the y-axis of all variables.
If the data is not yet loaded, the operation is deferred until loading completes.
clab.Container.merge(path)pathrequiredMerges the contents of the specified file into the container.
All TimeSeries loaded after this call will use data from this file in addition to previously loaded sources. Already loaded TimeSeries remain unchanged.
clab.Container.replace_xdata(ts)tsrequiredclab.TimeSeries used as the source for x-axis data.Replaces the x-axis data of all contained variables using the y-data from ts.
The source data must be strictly increasing (monotonically increasing with no repeated or decreasing values).
If data sizes differ, the maximum compatible subset is copied without overflow, and a warning message is issued.
clab.Container.rt_read()Refreshes data from a real-time source by invoking the Load function (see Section 5.1.2).
clab.Container.rt_start()Starts real-time data acquisition by invoking the Start function (see Section 5.1.2).
clab.Container.rt_stop()Stops real-time data acquisition by invoking the Stop function (see Section 5.1.2).
clab.Mesh stores clab.Array data of the x, y and z-axis to be plotted in a surface mesh plot. X and Z are the input of the mesh function. Y is the output matrix, where x values are stored contiguously:
An instance of clab.Mesh can be created directly using the following functions:
clab.Mesh()Create an empty clab.Mesh object.
clab.Mesh.id64integerRead-only. Unique 64-bit identifier assigned upon creation.
clab.Mesh.flagsintegerRead-only. Internal use only.
clab.Mesh.xdataclab.Arrayclab.Array containing the data points for the x-axis coordinates.
clab.Mesh.ydataclab.Arrayclab.Array containing the data values for the y-coordinate, corresponding to the specified and pairs.
clab.Mesh.zdataclab.Arrayclab.Array containing the data points for the z-axis coordinates.
clab.Mesh has no public member functions.
The clab.Model class represents a simulation model. It can be created programmatically or loaded from a JSON file and used for validation, execution, and code generation.
An instance of clab.Model can be created using:
clab.Model()Creates an empty clab.Model.
clab.Model(path)pathCreates a clab.Model by loading the JSON file located at the given path.
clab.Model.flagsintegerRead-only. Internal use only.
out = clab.Model.get(key, id)outkeyrequiredString with the parameter name. It can be one of the following values:
idoptionalReturns model-level or block-level parameters.
model.get(key='ts')
model.get(key='x', id=1234)clab.Model.set(...)idoptionalxoptionalyoptionalwidthoptionalheightoptionalredoptionalgreenoptionalblueoptionaltioptionaltfoptionaltsoptionalSets model-level or block-level parameters.
model.set(ti=5.0, tf=10.0)
model.set(id=1234, x=10, y=20)out = clab.Model.create(class, ...)outclassrequiredBlock class. It can be one of the following values:
type parameter ('bool', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'flt32', 'flt64').expression parameter.-1.target parameter.obj parameter.target parameter.True when the input is greater than valueOn and False when it is less than valueOff. Otherwise, it keeps its last value.portNumber parameter (zero-based indexing).coeffA and coeffB parameters.operator parameter ('and', 'or', 'nand', 'nor').out and out parameters.out, bp1 and bp2 parameters.True to False and vice versa.portNumber parameter (zero-based indexing).coeffA and coeffB parameters.initialValue, finalValue and time parameters.min, max and seed parameters.path parameter.operator parameter ('eq', 'ge', 'gt', 'le', 'lt', 'ne').frequency and phase parameters. The frequency is given in hertz and the phase, in degrees.timeOn, timeOff, valueOn and valueOff parameters.initialValue, finalValue and time parameters.name parameter.lsb, msb, coeffA and coeffB parameters. The bits indexing is zero-based.nameoptionalparentoptionalCreates a new block and returns its unique identifier.
model = clab.Model()
c0 = model.create('constant', expression=3.14)
s0 = model.create('sinewave', frequency=2.0)clab.Model.link(blockFrom, blockTo, portFrom, portTo, name)blockFromrequiredblockTorequiredportFromrequiredportTorequirednameoptionalCreates a connection between blocks.
model.link(blockFrom=b1, blockTo=b2, portFrom=0, portTo=1)clab.Model.codegen(lang, path)langrequired'c' or 'python'.pathrequiredGenerates source code from the model. Raises an exception on failure.
out = clab.Model.load(path)outpathrequiredLoads a model from disk.
clab.Model.run()Runs the simulation. Raises an exception on failure.
clab.Model.validate()Validates the model. Raises an exception if errors are found.
The clab.Result class stores the output data generated by a simulation. Each subsystem in the model is represented by a corresponding clab.Result object.
An instance of clab.Result can be created using:
clab.Result()Creates an empty clab.Result.
clab.Result.flagsintegerRead-only. Internal use only.
clab.Result does not provide any member functions.
clab.TimeSeries stores two clab.Array instances of the same size, holding the x-axis data (typically time, hence the name TimeSeries) and the y-axis data. The x-axis values are expected to be strictly increasing, i.e., for any given .
An instance of clab.TimeSeries can be created directly using the following functions:
clab.TimeSeries()Create an empty clab.TimeSeries object. It’s recommended not to use this function. It’s listed here only for the sake of completeness.
clab.TimeSeries(id64)id64requiredCreate a clab.TimeSeries from a valid variable identifier id64. This is for internal usage only.
clab.TimeSeries(xvalues, yvalues)xvaluesrequiredyvaluesrequiredCreate a clab.TimeSeries from two Python Lists or from two Python Tuples. The first one has the values for the x-axis and the second one for the y-axis.
clab.TimeSeries(rhs)rhsrequiredclab.TimeSeries.Create a clab.TimeSeries from another clab.TimeSeries rhs. Both objects will share the same xdata and ydata objects (shallow copy).
clab.TimeSeries.id64integerRead-only. Unique 64-bit identifier.
clab.TimeSeries.flagsintegerRead-only. Internal use only.
clab.TimeSeries.xdataclab.ArrayRead/write. clab.Array object that stores data to be used in the x-axis (typically time in seconds).
clab.TimeSeries.ydataclab.ArrayRead/write. clab.Array object that stores data to be used in the y-axis.
clab.TimeSeries implements the Number Protocol, i.e., clab.TimeSeries supports the standard operations: add, subtract, multiply, remainder, divide, power, and (&), xor (^), or (|) (and their in-place equivalents), negative (), absolute. For all the aforementioned functions that require two or more operands, the ydata is aligned over time using the xdata values.
clab.TimeSeries partially implements the Mapping Protocol, meaning that it’s possible to access each clab.TimeSeries in the container using the [] operator providing the child’s source name.
clab.TimeSeries implements the Sequence Protocol, meaning that it’s possible to read each x-y pair in the TimeSeries using the [] operator. Each item contains a two-element tuple: the first element contains the x value and the second, the y value.
Besides the standard protocols, the following member functions are available:
out = clab.TimeSeries.get_name()outReturn variable’s name. Only available for data loaded directly from sources; calculated variables return an empty string.
out = clab.TimeSeries.get_fs()outReturn the estimated sampling frequency in hertz. If the object has not been loaded yet, this function will force it.
out = clab.TimeSeries.get_ts()outReturn the estimated sampling period in seconds. If the object has not been loaded yet, this function will force it.
out = clab.TimeSeries.axpb(a, b)arequiredbrequiredApply for all values in the x-axis. If the data is empty, this operation will be postponed until the data has been successfully loaded.
out = clab.TimeSeries.aypb(a, b)arequiredbrequiredApply for all values in the y-axis. If the data is empty, this operation will be postponed until the data has been successfully loaded.
out = clab.TimeSeries.avg()outReturn the average of the object’s yvalues.
out = clab.TimeSeries.max()outReturn the maximum of the object’s yvalues.
out = clab.TimeSeries.min()outReturn the minimum of the object’s yvalues.
out = clab.TimeSeries.sum()outReturn the sum of the object’s yvalues.
out = clab.TimeSeries.index(val, op='eq')outvalrequiredopoptionaleq, ne, le, lt, ge or gt.Return sample index that match the search criteria.
clab.TimeSeries.inspect()Print TimeSeries internal information for debugging and troubleshooting.
clab.TimeSeries.load()Load TimeSeries values from source file, if they haven’t been already. On success, the members xdata and ydata are filled with the loaded values.
out = clab.TimeSeries.slice(tini, tend)outtinirequiredtendrequiredReturn a new object containing a slice (or subsequence) of the source object, within the limits defined by the arguments.
clab.TimeSeries.sort()Sort samples chronologically (i.e. by x-axis values).
out = clab.TimeSeries.tag(val)outvalrequiredReturn the tag associated with the value val for this object. If there’s no tag associated, it will return 'n/a'.
out = clab.TimeSeries.time_eq(val)outvalrequiredReturn total time in which y-axis values are equal to val.
out = clab.TimeSeries.time_ne(val)outvalrequiredReturn total time in which y-axis values are not equal to val.
out = clab.TimeSeries.time_gt(val)outvalrequiredReturn total time in which y-axis values are greater than val.
out = clab.TimeSeries.time_lt(val)outvalrequiredReturn total time in which y-axis values are less than val.
out = clab.TimeSeries.time_bt(val1, val2)outval1requiredval2requiredReturn total time in which y-axis values are between the provided arguments, i.e., simultaneously greater than val1 and less than val2.
Settings can be configured through the dedicated tab in the application UI or via the module functions (see Section 3.3).
Controls the color theme of the user interface. Default: 'dark'.
Setting this option to 'lite' enables the lite theme.
Changes are applied immediately.
Controls the color theme used when exporting charts to files. Default: 'dark'.
Setting this option to 'lite' enables the lite theme for exported charts. This allows dark UI users to export charts with a light background without changing the UI theme.
Changes are applied immediately.
Enables autosave and defines the interval for saving charts and models in memory to a backup file.
Autosave files are stored in: C:\Users\<user>\.clab\cache.
Defines the minimum severity level to be logged. Supported values (in increasing order): Trace, Debug, Info, Warning, Error, Fatal.
Logs are stored in: C:\Users\<user>\.clab\logs.
Restart required.
Path to a TSV file used to assign tags to specific values in data tips.
If both the parameter name and value match an entry, the corresponding tag is displayed.
Useful for parameters with discrete meanings (e.g., states, modes).
An example file is available in the example directory of the installation folder.
Required TSV columns:
Restart not required.
Path to a TSV file used to automatically unpack clab.TimeSeries data. If a parameter name matches an entry, its data is unpacked into one or more derived series, equivalent to clab.unpack() (see Section 6.2.8).
An example file is available in the example directory of the installation folder.
Required TSV columns:
2C, BCD, or BNR.Transformation: alias = source[msb:lsb] resolution offset
Restart not required.
Specifies the path to the Python 3 dynamic library (.dll) used by C-LAB.
If not set, the embedded version is used: C:\<clab folder>\python\python3.dll.
Restart required.
Defines the maximum fraction of system RAM that C-LAB may use. Default: 80%.
If the limit is exceeded, least frequently used data is unloaded until usage falls below the threshold.
Memory usage (used, available, total) is displayed in the application status area.
Restart required.
out = clab.get_config(key, group)outkeyrequiredgroupoptional'general'.value = clab.get_config(key='memory')Some changes are applied only after the module is reloaded, as with updates made through the UI. See Sections Section 3.1 and Section 3.2 for details.
clab.set_config(key, group, value)keyrequiredSetting key. Supported values:
'dark', 'lite'. Group: 'theme'.'dark', 'lite'. Group: 'theme'.'window'.'window'.'window'.'window'.groupoptional'general'.valuerequiredclab.set_config(key='memory', value='80')
clab.set_config(key='ui', group='theme', value='dark')
clab.set_config(key='width', group='window', value=800)Reloads configuration data from file. Required only if the configuration file is modified externally.
clab.reload_config()C-LAB supports loading data from a wide range of file formats using either native loaders or external plugins.
C-LAB does not require the user to explicitly specify the file format. Instead, format detection is performed automatically.
When a file is opened, C-LAB determines the appropriate loader using the following procedure:
If the input file is a compressed archive, C-LAB will extract its contents to a cache directory prior to loading.
After extraction, C-LAB applies the standard format resolution process to the extracted file(s).
*.bin, *.log*.csv, *.tsv, *.txt*.hdf5, *.h5*.ch10*.xlsx*.mat*.nc*.parquet, *.gzipIf one or more time-typed columns are present, the first (lowest index) will be used as the time vector.
If no time-typed column is present, the time vector will be generated as a strictly increasing sequence starting at zero.
*.wavC-LAB supports custom Dynamic Link Libraries (DLLs) as user-defined plugins for loading data from files.
A plugin MUST implement the API defined in Section 4.2.2 and MUST be located in the plugins directory at C:\Users\<user>\.clab\plugins.
A DLL will be loaded only once per process. Therefore, a plugin implementation MUST support concurrent handling of multiple files.
When a file is opened, C-LAB determines plugin compatibility and executes the following sequence:
IsCompatible() for each enabled plugin.Initialize(). The plugin MUST initialize internal state and allocate required resources.GetParameterName() to enumerate available parameters. The plugin MUST return consistent and deterministic results.Load() for each requested parameter. The plugin MUST return synchronized x- and y-value arrays of equal length.Terminate(). The plugin MUST release all associated resources.If Initialize() or Load() returns a non-zero value, C-LAB will call GetErrorMessage() (if implemented) to retrieve diagnostic information.
If no error is reported, C-LAB MAY call GetInfoMessage() to retrieve informational messages.
Initialize() or Load().file, folder, text.Determines whether the plugin supports the given file.
Return 0 if not compatible. Any other value is interpreted as compatible.
Initializes the plugin using the provided file path and configuration values.
Return 0 on success. Any other value is interpreted as error.
Releases resources associated with the provided file path.
Return 0 on success. Any other value is interpreted as error.
Loads parameter data.
C-LAB supports custom Python® 3 modules as user-defined plugins for loading data from files.
A plugin MUST implement the API defined in Section 4.3.2 and MUST be located in the plugins directory at C:\Users\<user>\.clab\plugins.
A Python module is imported only once per interpreter session. Therefore, a plugin implementation MUST support concurrent handling of multiple files.
When a file is opened, C-LAB determines plugin compatibility and executes the following sequence:
compatible() for each enabled plugin.init(). The plugin MUST initialize internal state and allocate required resources.list_names() to enumerate available parameters. The plugin MUST return consistent and deterministic results.load() for each requested parameter. The plugin MUST return synchronized x- and y-value sequences of equal length.terminate(). The plugin MUST release all associated resources.If init() or load() returns a non-zero value, the operation is considered to have failed. Implementations SHOULD provide meaningful error signaling via return codes or exceptions.
Determines whether the plugin supports the given file.
Return 0 if not compatible. Any other value is interpreted as compatible.
Initializes the plugin using the provided file path and configuration values.
Return 0 on success. Any other value is interpreted as error.
Releases resources associated with the provided file path.
Return 0 on success. Any other value is interpreted as error.
Loads parameter data.
Returns a tuple containing two sequences: x-values and y-values.
C-LAB provides support for loading data from real-time sources via external custom plugins, enabling dynamic data integration during runtime.
C-LAB supports custom Dynamic Link Libraries (DLLs) as user-defined plugins for loading data from real-time sources.
A plugin MUST implement the API described in Section 5.1.2 and MUST be located in the plugins directory at C:\Users\<user>\.clab\plugins.
The plugin lifecycle is defined as follows:
Initialize() to initialize the plugin with a file path and configuration values. The plugin MUST allocate and prepare all required resources during this phase.GetParameterName() to enumerate available parameters. The plugin MUST return consistent and deterministic results for a given input.Start() to signal the beginning of data acquisition. The plugin SHOULD begin producing data after this call.Load() periodically for each requested parameter. The plugin MUST return synchronized x- and y-value arrays of equal length.Stop() to signal the end of data acquisition. The plugin SHOULD cease data production promptly.Terminate() when the plugin is no longer required. The plugin MUST release all allocated resources.If Initialize() or Load() returns a non-zero value, C-LAB will invoke GetErrorMessage() (if implemented) to obtain diagnostic information.
If no error is reported, C-LAB MAY invoke GetInfoMessage() to retrieve informational messages for display.
Initialize() or Load().file, folder, text.Initializes the plugin using the provided file path and configuration values.
Return 0 on success. Any other value is interpreted as error.
Releases resources associated with the provided file path.
Return 0 on success. Any other value is interpreted as error.
Loads parameter data.
The C-LAB module provides a set of built-in functions for processing clab.Array, clab.Mesh, and clab.TimeSeries objects, in addition to those described in their respective sections.
Return a new object, whose values are equal to (Euler’s number, ) raised to power of each value in the input argument.
out = clab.exp(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.Return a new object, whose values are equal to the natural (base ) logarithm of the argument. There is also a version that computes the logarithm with base 10 of the argument.
out = clab.log(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.out = clab.log10(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.Computes the nearest integer value to the argument, following the specified rounding rules:
out = clab.<operation>(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.Return a new object, whose values are equal to the square root of each value in the input argument.
out = clab.sqrt(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.Computes standard trigonometric operations. All results for are in radians unless the degree suffix is used.
out = clab.<operation>(ts)outclab.TimeSeries object.tsrequiredclab.TimeSeries object.Calculate the minimum difference between two angles in a circle.
The function computes lhs - rhs, but taking into account the angle position in the circle. For instance, the distance between 0.0 and 360.0 is 0.0 and between +170.0 and -170.0 is 20.0.
out = clab.angular_distance(lhs, rhs, type='deg')outclab.TimeSeries.lhsrequiredclab.TimeSeries.rhsrequiredclab.TimeSeries.typeoptionaldeg (for degrees) or rad (for radians).diff = clab.angular_distance(y2, y1, type='rad')The output is calculated as follows:
out = clab.derivative(ts)outclab.TimeSeries.tsrequiredclab.TimeSeries.dY = clab.derivative(y)Discrete integration (numerical quadrature), calculated using the trapezoidal rule.
Differences between adjacent elements, calculated as
The nth element is the sum of the 1...n elements of the argument.
out = clab.accumulate(ts)outclab.TimeSeries.tsrequiredclab.TimeSeries.acc = clab.accumulate(y)The output represents the estimated instantaneous sampling frequency corresponding to the provided sample argument.
out = clab.estimate_sampling_frequency(ts)outclab.TimeSeries.tsrequiredclab.TimeSeries.fs = clab.estimate_sampling_frequency(y)The output represents the estimated instantaneous sampling period corresponding to the provided sample argument.
out = clab.estimate_sampling_period(ts)outclab.TimeSeries.tsrequiredclab.TimeSeries.ts = clab.estimate_sampling_period(y)Unpack values, selecting the desired bits and applying gain and bias (bit extraction).
The output is calculated as where is obtained by converting the input using the selected conversion type.
out = clab.unpack(ts, msb=0, lsb=0, base=0, gain=1.0, bias=0.0, type='USGN')outclab.TimeSeries.tsrequiredclab.TimeSeries.msboptionalbase.lsboptionalbase.baseoptionalgainoptionalbiasoptionaltypeoptional2C (two’s complement), BCD (binary coded decimal), USGN (unsigned binary) or SGN (signed binary).unpacked1 = clab.unpack(ts, msb=10, lsb=2)
unpacked2 = clab.unpack(ts, msb=32, lsb=28, gain=0.5, bias=10.0)
unpacked3 = clab.unpack(ts, msb=28, lsb=10, type='2C')Delay output of boolean signal after rising or falling edge. Persistences should be provided in the same unit of the argument’s time vector.
out = clab.debounce(ts, on=0.0, off=0.0)outclab.TimeSeries.tsrequiredclab.TimeSeries.onoptional'on' signal.offoptional'off' signal.out1 = clab.debounce(ts, on=10)
out2 = clab.debounce(ts, off=0.5)Output 1 if the argument is bigger than the upper threshold, 0 if the argument is smaller than the lower threshold and keep the last value otherwise.
out = clab.hysteresis(ts, lower=0.0, upper=0.0)outclab.TimeSeries.tsrequiredclab.TimeSeries.loweroptionalupperoptionalout = clab.hysteresis(ts, lower=90.0, upper=180.0)For each input sample, if value is less than lower limit, returns lower limit. If argument is greater than upper limit, returns upper limit. Otherwise returns input value.
out = clab.clamp(ts, lower=-inf, upper=+inf)outclab.TimeSeries.tsrequiredclab.TimeSeries.loweroptionalupperoptionalout = clab.clamp(ts, lower=90.0, upper=180.0)Create a new clab.TimeSeries, dropping every sample y for which op1(y, lim1) or op2(y, lim2) is true.
Valid operators are eq, ne, le, lt, ge or gt.
out = clab.drop(ts, lim1=-inf, lim2=+inf, op1='le', op2='ge')outclab.TimeSeries.tsrequiredclab.TimeSeries.lim1optionallim2optionalop1optionalop2optionalout = clab.drop(ts, lim1=90.0, lim2=180.0, op1='lt', op2='gt')For each input sample, if its value is less than the upper limit and greater than the lower limit for longer than the defined persistence time, returns 1.0. Otherwise returns 0.0.
out = clab.in_range(ts, lower=-inf, upper=+inf, pers=0.0)outclab.TimeSeries.tsrequiredclab.TimeSeries.loweroptionalupperoptionalpersoptionalout1 = clab.in_range(ts, lower=90.0, upper=180.0)
out2 = clab.in_range(ts, upper=180.0, pers=10.0)This function detects staleness of the input argument during the defined persistence window.
It returns 1.0 to indicate staleness, or 0.0 if the value has changed within the persistence window.
out = clab.stale(ts, pers)outclab.TimeSeries.tsrequiredclab.TimeSeries.persrequiredout = clab.stale(ts, pers=2.0)First order low pass filter.
out = clab.lowpass(ts, tau)outclab.TimeSeries.tsrequiredclab.TimeSeries.taurequiredfiltered = clab.lowpass(ts, tau=2)First order high pass filter.
out = clab.highpass(ts, tau)outclab.TimeSeries.tsrequiredclab.TimeSeries.taurequiredfiltered = clab.highpass(ts, tau=2)Computes a + ts (b - a), i.e. the linear interpolation between a and b for the parameter ts (or extrapolation, when ts is outside the range [0,1]).
out = clab.lerp(ts, a, b)outclab.TimeSeries.tsrequiredclab.TimeSeries.arequiredbrequiredout = clab.lerp(ts, a=2.0, b=4.0)Computes intermediate values of the input from the provided set of discrete data points using interpolation techniques.
out = clab.lut1d(ts, bp, val, clip=True)outclab.TimeSeries.tsrequiredclab.TimeSeries.bprequiredvalrequiredclipoptionalout = clab.lut1d(ts, bp=[2.0, 4.0, 8.0], val=[4.0, 16.0, 64.0], clip=True)Computes intermediate values of the inputs from the provided set of discrete data points using interpolation techniques.
out = clab.lut2d(in1, in2, bp1, bp2, val, clip=True)outclab.TimeSeries.in1requiredclab.TimeSeries. This is the row variable in the output values table.in2requiredclab.TimeSeries. This is the column variable in the output values table.bp1requiredin1.bp2requiredin2.valrequiredclipoptionaltable = [
[1.0, 2.0, 3.0, 4.0],
[2.0, 3.0, 4.0, 5.0],
[3.0, 4.0, 5.0, 6.0],
[4.0, 5.0, 6.0, 7.0],
[5.0, 6.0, 7.0, 8.0]]
out = clab.lut2d(in1=ts1, in2=ts2, bp1=[1.0, 2.0, 3.0, 4.0, 5.0], bp2=[0.0, 1.0, 2.0, 3.0], val=table)This function shares similarities with the Fast Fourier Transform Plot (see Section 8.1.6), except that it doesn’t create a graphical plot; instead, it provides the data as a tuple.
out = clab.fftdata(ts, ini=-inf, end=+inf)out2×N tuple, where the first element is the frequency in hertz and the second, the FFT component for that frequency.tsrequiredclab.TimeSeries.inioptionalendoptionalout = clab.fftdata(ts)This function shares similarities with the HeatMap Plot (see Section 8.1.9), except that it doesn’t create a graphical heatmap; instead, it provides the data as a tuple.
out = clab.heatmapdata(in1, in2, ini=-inf, end=+inf, cols=30, rows=30)outTuple with the heatmap data, formatted as described:
cols×rows. Each cell contains the number of samples that fit that square.in1requiredclab.TimeSeries.in2requiredclab.TimeSeries.inioptionalendoptionalcolsoptionalrowsoptionalout = clab.heatmapdata(in1, in2, cols=8, rows=8)This function shares similarities with the Histogram Plot (see Section 8.1.10), except that it doesn’t create a graphical histogram; instead, it provides the data as a tuple.
out = clab.histdata(ts, ini=-inf, end=+inf, nbins=8, bins=[])outtsrequiredclab.TimeSeries.inioptionalendoptionalnbinsoptionalbinsoptionalnbins, the latter will be ignored.out = clab.histdata(ts, nbins=4)
out = clab.histdata(ts, bins=[1,3,5,7])Converts a TimeSeries object values to the target unit.
out = clab.convert(ts, source, target)outclab.TimeSeries.tsrequiredclab.TimeSeries.sourcerequiredtargetrequiredString with unit name to convert to. It can be one of the following:
'deg', 'rad'.'feet', 'inches', 'kilometers', 'meters', 'miles', 'nautical miles'.'kilograms', 'pounds'.'knots', 'km/h', 'm/s', 'mph'.'celsius', 'fahrenheit', 'kelvin'.out = clab.convert(ts, 'rad', 'deg')Export a clab.Container or a list of clab.TimeSeries objects to a delimiter-separated file, to an HDF5 file or to a Parquet file.
clab.export_to_file(path, delimiter, step, tini, tend, src, tags=False, precision=0)pathrequired.tsv, .hdf5 or .parquet).tinirequiredtendrequireddelimiteroptionalstepoptionalsrcrequiredSource data to export. This can be one of the following:
clab.TimeSeries object and the desired name to be used as the column header in the file. E.g., [(obj1, name1), (obj2, name2)].clab.Container object: The function will use each clab.TimeSeries name within the container as a column header.tagsoptionalTrue, the exported file will contain the column headers defined by the tag names instead of the corresponding value data.precisionoptionalclab.export_to_file(path='c:/output.tsv', step=0.2, tini=0.0, tend=100.0, delimiter='\t', src=[(obj1, 'name1'),(obj2, 'name2')])
clab.export_to_file(path='c:/output.hdf5', tini=0.0, tend=100.0, src=f)Create a clab.Array with the length specified and all values set to random values in the interval [-1.0, +1.0].
out = clab.create_array_random(len)outclab.Array object.lenrequiredout = clab.create_array_random(500)Create a clab.Array with the length specified and all values set to 1.0.
out = clab.create_array_ones(len)outclab.Array object.lenrequiredout = clab.create_array_ones(500)Create a clab.Array with the length specified and all values set to 0.0.
out = clab.create_array_zeros(len)outclab.Array object.lenrequiredout = clab.create_array_zeros(500)Create a clab.Container object from clipboard content.
This functionality is also available from the UI, allowing the user to edit a data file (an Excel file for instance), CTRL+C its content into the clipboard and import it into C-LAB without saving it to the disk.
out = clab.create_from_clipboard()outclab.Container object.Create a clab.TimeSeries object with a chirp signal (sine sweep) values in the y-axis.
out = clab.create_chirp(xmin=0.0, xmax=100.0, xdiff=0.01, freq_start=0.0, freq_end=10.0)outclab.TimeSeries object.xminoptionalxmaxoptionalxdiffoptionalfreq_startoptionalfreq_endoptionalout = clab.create_chirp(freq_start=8.0, freq_end=0.0)Create a clab.TimeSeries object with a constant value in the y-axis.
out = clab.create_const(value=1.0, xmin=0.0, xmax=100.0, xdiff=0.01)outclab.TimeSeries object.valueoptionalxminoptionalxmaxoptionalxdiffoptionalout = clab.create_const(value=3.1415, xmin=10, xmax=20, xdiff=0.5)Create a clab.TimeSeries object with a ramp signal in the y-axis, defined between and over the x-range .
out = clab.create_ramp(rxmin, rxmax, ymin, ymax, xmin, xmax, xdiff)outclab.TimeSeries object.rxminrequiredrxmaxrequiredyminrequiredymaxrequiredxminrequiredxmaxrequiredxdiffrequiredout = clab.create_ramp(rxmin=1, rxmax=5, ymin=0.75, ymax=4, xmin=1, xmax=7, xdiff=0.5)Create a clab.TimeSeries object with random values in the y-axis, generated from a specified distribution.
out = clab.create_random(dist='uniform', type='double', seed=0, ymin=0.0, ymax=1.0, mean=0.0, stddev=1.0, xmin=0.0, xmax=100.0, xdiff=0.01)outclab.TimeSeries object.distoptional'uniform' or 'normal'.typeoptional'double' or 'int'.seedoptionalyminoptional'uniform' distribution is selected.ymaxoptional'uniform' distribution is selected.meanoptional'normal' distribution is selected.stddevoptional'normal' distribution is selected.xminoptionalxmaxoptionalxdiffoptionalout = clab.create_random(dist='normal', mean=1.0, stddev=2.0)
out = clab.create_random(dist='uniform', ymin=-1.0, ymax=1.0, xmin=10, xmax=20, xdiff=0.5)Create a clab.TimeSeries object with a sine wave in the y-axis.
out = clab.create_sine(freq=1.0, phase=0.0, amplitude=1.0, xmin=0.0, xmax=100.0, xdiff=0.01)outclab.TimeSeries object.freqoptionalphaseoptionalamplitudeoptionalxminoptionalxmaxoptionalxdiffoptionalout = clab.create_sine(freq=10, phase=90, amplitude=10.0, xmin=10, xmax=20, xdiff=0.5)Create a clab.TimeSeries object with a step signal in the y-axis. The signal will start with the minimum value defined and switch to the maximum when the time is equal to or greater than step.
out = clab.create_step(step=50.0, ymin=0.0, ymax=1.0, xmin=0.0, xmax=100.0, xdiff=0.01)outclab.TimeSeries object.stepoptionalyminoptionalymaxoptionalxminoptionalxmaxoptionalxdiffoptionalout = clab.create_step(step=1.0, xmin=10, xmax=20, xdiff=0.5)Create a clab.Mesh object with a sinc function signal in the y-axis.
For 2 dimensions, is defined as For 3 dimensions, sinc is defined as where
out = clab.create_mesh_sinc(xmin=-10.0, xmax=+10.0, xdiff=0.5, zmin=-10.0, zmax=+10.0, zdiff=0.5)outclab.Mesh object.xminoptionalxmaxoptionalxdiffoptionalzminoptionalzmaxoptionalzdiffoptionalCreate a mesh with 1600 values in the Y matrix
out = clab.create_mesh_sinc()
Create a mesh with 40000 values in the Y matrix
out = clab.create_mesh_sinc(xdiff=0.1, zdiff=0.1)
Returns the first clab.TimeSeries object whose name matches the specified text.
out = clab.find(text, regex=False)outclab.TimeSeries.textrequiredregexoptionalTrue, text is evaluated as a regular expression. If False (default), performs an exact string match.out1 = clab.find('.*value', regex=True)
out2 = clab.find('value')List all clab.TimeSeries objects whose names match the regular expression provided.
out = clab.list(text)outclab.TimeSeries objects.textrequiredout1 = clab.list('.*value')
out2 = clab.list('value')List the file system paths of all clab.Container objects currently loaded or accessible by the module.
out = clab.list_paths()outout1 = clab.list_paths()Computes linear regression to fit observed data into a first order linear function
out = clab.fit_linear(ts)outTuple with the following values:
tsrequiredclab.TimeSeries.Computes exponential regression to fit observed data into a function
out = clab.fit_exp(ts)outTuple with the following values:
tsrequiredclab.TimeSeries.Computes polynomial regression to fit observed data into an arbitrary order function
out = clab.fit_polynomial(ts, order)outTuple with the following values:
tsrequiredclab.TimeSeries.orderrequiredMerge the content of a file into an existing clab.Container, provided the data structures are compatible.
If you need to force merging the content of a file into a specific clab.Container (regardless of compatibility), use the merge member function of clab.Container (refer to Section 2.2).
out = clab.merge(path)outclab.Container object. Returns None if the merge fails due to incompatibility or error.pathrequiredclab.merge(path='c:/user/data.csv')The clab module provides a collection of predefined mathematical constants. These constants are immutable, meaning their values cannot be modified at runtime.
clab.<constant>The following immutable constants are available:
2.718281828459045.1.4426950408889634.0.4342944819032518.3.141592653589793.0.3183098861837907.0.5641895835477563.6.283185307179586.0.6931471805599453.2.302585092994046.1.4142135623730951.1.7320508075688772.0.5773502691896257.0.5772156649015329.1.618033988749895.The clab module also provides a collection of system-defined constants. These constants are mutable, meaning their values may change during program execution to reflect the current runtime state.
clab.<constant>The following mutable constants are available:
The C-LAB module provides functions to create and manipulate charts.
Each chart has a unique identifier (a 64-bit unsigned integer) which is returned by the plotting functions. Henceforth, this unique identifier will be referred to as id. This id shall be passed as an argument to all functions that modify a chart.
All functions in this section require either a clab.TimeSeries object or the name of a variable. When only the variable’s name is supplied, C-LAB will attempt to locate an object whose name corresponds to the given string. If both the object and the name are provided, C-LAB will utilize the data from the specified object and label it using the provided variable’s name.
Plot a clab.TimeSeries object, displaying the engineering values in the y-axis and time in the x-axis. If the object was created using the built-in loaders, the x-axis will display time in seconds.
out = clab.plot(id=0, obj=None, name='', side='left', style='line')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalsideoptional'left' or 'right'.styleoptional'bool', 'dots' or 'line'.chart_id1 = clab.plot()
clab.plot(id=chart_id1, obj=f['roll_angle (deg)'])
clab.plot(id=chart_id1, obj=f['pitch_angle (deg)'], side='right')Estimate the transfer function of a system using the FFT of the input and output signals and plot its Bode Diagram. The first signal added to the plot will be used as input, and the second as output.
out = clab.bode(id=0, obj=None, name='')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalchart_id1 = clab.bode()
clab.bode(id=chart_id1, obj=f['Input Signal'])
clab.bode(id=chart_id1, obj=f['Output Signal'])
This function plots data points based on boolean values. A dot is plotted for each value different from zero in the data; zero values result in no plot for that specific data point.
out = clab.boolplot(id=0, obj=None, name='')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalts1 = clab.create_random(seed=1234, type='int', ymin=0.0, ymax=1.0, xdiff=0.5)
ts2 = clab.create_random(seed=4321, type='int', ymin=0.0, ymax=1.0, xdiff=0.5)
chart_id1 = clab.boolplot()
clab.boolplot(id=chart_id1, obj=ts1, name='VAR1')
clab.boolplot(id=chart_id1, obj=ts2, name='VAR2')Plot a clab.TimeSeries object against another one, displaying the engineering values in both the x-axis and y-axis.
The plotting is done by pairs: the first variable added to the chart will be the x-axis variable and the second, the y-axis. If there is an odd number of variables in the chart, the last pair will be incomplete and will not be displayed.
out = clab.crossplot(id=0, obj=None, name='', side='left')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalsideoptional'left' or 'right'. For the first variable, this value is ignored.chart_id1 = clab.crossplot()
clab.crossplot(id=chart_id1, obj=f['Latitude'])
clab.crossplot(id=chart_id1, obj=f['Longitude'])Calculate and plot the cross-correlation (also known as a sliding dot product or sliding inner-product) of a clab.TimeSeries object against another one (the reference variable).
The first variable added to the chart will be the reference variable.
out = clab.xcorrplot(id=0, obj=None, name='', side='left')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalsideoptional'left' or 'right'. For the first variable, this value is ignored.chart_id1 = clab.xcorrplot()
clab.xcorrplot(id=chart_id1, obj=f['X1'])
clab.xcorrplot(id=chart_id1, obj=f['X2'])
Plot the Fast Fourier Transform of a clab.TimeSeries object. The x-axis will display frequency in hertz.
If you only need the FFT data, use the clab.fftdata function (refer to Section 6.2.20).
out = clab.fft(id=0, obj=None, name='', side='left')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalsideoptional'left' or 'right'.chart_id1 = clab.fft(obj=f['signal_12hz'])Plot the spectrogram of a clab.TimeSeries object. The y-axis will display frequency in hertz.
This function computes the Fast Fourier Transform (FFT) of consecutive time windows (spectrogram). The window size is determined by the nfft parameter, and the overlap between adjacent windows is controlled by the overlap parameter.
out = clab.spectrogram(id=0, obj=None, name='', nfft=256, overlap=0.1)outidoptionalobjoptionalclab.TimeSeries object.nameoptionalnfftoptionaloverlapoptionalvar1 = clab.create_random(xdiff=0.02, dist='normal') * 0.5
var2 = clab.create_sine(xdiff=0.02, freq=16)
var3 = clab.create_chirp(xdiff=0.02)
signal = var1 + var2 + var3
clab.spectrogram(obj=signal, nfft=128)
Generates a geographical map visualization from latitude/longitude data contained within a clab.TimeSeries object.
Each plot supports a single variable, whose data must present the following layout:
clab.Array representing the unique longitude coordinates. The inner loop iterates through this data to determine the column position for each data point.clab.Array representing the unique latitude coordinates. The outer loop iterates through this data to determine the row position for each data point.clab.Array representing a 2D grid of values (len(ydata) len(xdata)). It is stored in row-major order, where all the X-values for a given Y-row are contiguous in memory. The element at a specific grid intersection is accessed using the formula: out = clab.geomap(id=0, obj=None, name='')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalclab.geomap(obj=f['tas'])
Plot the heatmap between two clab.TimeSeries objects.
If you only need the underlying data matrix, use the clab.heatmapdata function (refer to Section 6.2.21).
out = clab.heatmap(id=0, obj=None, name='')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalchart_id1 = clab.heatmap()
clab.heatmap(id=chart_id1, obj=f['X3'])
clab.heatmap(id=chart_id1, obj=f['X4'])Plot the histogram of a clab.TimeSeries object.
If you only need the histogram data, use the clab.histdata function (refer to Section 6.2.22).
out = clab.hist(id=0, obj=None, name='', type='bar', nbins=8, bins=[])outidoptionalobjoptionalclab.TimeSeries object.nameoptionaltypeoptional'bar' or 'pie'.nbinsoptional'bar' type) or number of slices (for the 'pie' type). Value cannot be less than 3.binsoptionalnbins, the latter will be ignored.rand = clab.create_random(dist='normal')
chart_id1 = clab.hist(obj=rand, nbins=10)
chart_id2 = clab.hist(obj=rand, type='pie', nbins=4)Plot the violin diagram of a clab.TimeSeries object.
If you only need the violin data, use the clab.histdata function (refer to Section 6.2.22).
out = clab.violinplot(id=0, obj=None, name='', nbins=100)outidoptionalobjoptionalclab.TimeSeries object.nameoptionalnbinsoptionalvar1 = clab.create_random(dist='normal', mean=0.0, stddev=1.0, seed=1234)
var2 = clab.create_random(dist='normal', mean=1.0, stddev=1.0, seed=1234)
chart_id = clab.violinplot()
clab.violinplot(id=chart_id, obj=var1, name='VAR1', nbins=25)
clab.violinplot(id=chart_id, obj=var2, name='VAR2', nbins=25)Plot two clab.TimeSeries objects to display engineering values on the y-axis and z-axis, with time on the x-axis. If the objects were created using built-in loaders, the x-axis will display time in seconds. Only two variables can be added to a single chart: one for the y-axis and one for the z-axis.
out = clab.plot3d(id=0, obj=None, name='')outidoptionalobjoptionalclab.TimeSeries object.nameoptionalchart_id1 = clab.plot3d()
clab.plot3d(id=chart_id1, name='Altitude')
clab.plot3d(id=chart_id1, name='Longitude')Plot a clab.Mesh object in a 3D surface chart.
out = clab.mesh(obj)outobjrequiredclab.Mesh object.mesh1 = clab.create_mesh_sinc(xdiff=1.0, zdiff=1.0)
chart_id1 = clab.mesh(mesh1)
Create a chart with gauges that visualize clab.TimeSeries values. The gauge values dynamically update based on the input clab.TimeSeries they are linked to. To update the gauge values manually, hold CTRL while moving the mouse cursor along a standard 2D chart.
out = clab.synoptic(id=0, obj=None, name='', x=-1, y=-1, width=250, min=0.0, max=10.0, red=0x36, green=0x7b, blue=0xf5)outidoptionalobjoptionalclab.TimeSeries object whose value will be displayed on the gauge.nameoptionalxoptionalyoptionalwidthoptionalminoptionalmaxoptionalredoptionalgreenoptionalblueoptionalchart_id1 = clab.synoptic()
clab.synoptic(id=chart_id1, name='roll_angle (deg)', min=-180.0, max=180.0)
clab.synoptic(id=chart_id1, name='pitch_angle (deg)', min=-180.0, max=180.0)
clab.synoptic(id=chart_id1, name='heading (deg)', min=0.0, max=360.0)Create a chart embedding a synchronized video frame from a clab.TimeSeries that contains video data. To manually scrub through video frames, hold CTRL while moving the mouse cursor along a standard 2D chart.
out = clab.video(id=0, obj=None, name='', brightness=0.0, contrast=1.0, gamma=1.0, posterization=1, thresholding=0)outidoptionalobjoptionalclab.TimeSeries video object supplying the frames.nameoptionalbrightnessoptionalcontrastoptionalgammaoptionalposterizationoptionalthresholdingoptionalclab.video(name='VideoCh1', brightness=0.5)Save charts to file. Currently, only PDF and PNG formats are supported.
clab.save(path, id=0, size='')pathrequiredidoptionalsizeoptionalPage size specification. If no size is provided, the system automatically selects a default based on the file extension. Supported values are:
clab.save(path='c:/user/out.pdf')
clab.save(path='c:/user/out.png', id=1234, size='256x128')Set parameters for a single chart.
clab.set_chart(id, ...)idrequiredlmaxoptionallminoptionalrmaxoptionalrminoptionalltickoptionalrtickoptionalfitoptional'exp', 'linear', or 'poly'.xlabeloptionalclab.set_chart(id=1234, lmax=10, lmin=0)
clab.set_chart(id=1234, rtick=2.5)
clab.set_chart(id=1234, fit='linear')Create a circle in a single chart.
clab.circle(chart, xcenter, ycenter, diameter, red, green, blue)chartrequiredxcenterrequiredycenterrequireddiameterrequiredredoptionalgreenoptionalblueoptionalclab.circle(chart=1234, xcenter=10, ycenter=20, diameter=5, red=128, green=128, blue=128)Create a datatip in a single chart.
clab.datatip(chart, name, x, red, green, blue)chartrequirednamerequiredxrequiredredoptionalgreenoptionalblueoptionalclab.datatip(chart=1234, name='value1', x=10, red=128, green=128, blue=128)Create a vertical flag across all charts (if only x is provided) or a horizontal flag in a single chart (if only y is provided).
clab.flag(chart, x, y, text, red, green, blue)chartoptionalxoptionaly is omitted, it creates a vertical flag.yoptionalx is omitted, it creates a horizontal flag.textoptionalredoptionalgreenoptionalblueoptionalclab.flag(x=20.0, text='event', red=128, green=128, blue=128)
clab.flag(chart=1234, y=100.0, text='limit')Create marks in all charts.
clab.mark(x, width, text, red, green, blue)xrequiredwidthrequiredtextoptionalredoptionalgreenoptionalblueoptionalclab.mark(x=10, width=12.5, text='event', red=128, green=128, blue=128)Create a rectangle in a single chart.
clab.rectangle(chart, xcenter, ycenter, width, height, red, green, blue)chartrequiredxcenterrequiredycenterrequiredwidthrequiredheightrequiredredoptionalgreenoptionalblueoptionalclab.rectangle(chart=1234, xcenter=10, ycenter=20, width=5, height=5, red=128, green=128, blue=128)Create a text label in a single chart.
clab.text(chart, x, y, text, red, green, blue)chartrequiredxrequiredyrequiredtextrequiredredoptionalgreenoptionalblueoptionalclab.text(chart=1234, x=10, y=20, text='this is a text', red=128, green=128, blue=128)Set up a legend for a single chart.
clab.legend(chart, x, y, visible, full)chartrequiredxoptionalyoptionalvisibleoptionalFalse, the legend will not be displayed.fulloptionalTrue, the legend will display full variable names.clab.legend(chart=1234, visible=False)
clab.legend(chart=1234, x=50)Creates a new empty page.
out = clab.new_page(name, id=0)outnamerequiredidoptionalclab.new_page(id=1234, name='page 1')Deletes an existing page.
clab.del_page(id=0, name='')idoptionalnameoptionalName of the page to delete.
At least one of id or name MUST be provided. If both are provided, id will take precedence.
clab.del_page(id=1234)Modifies properties of an existing page.
clab.set_page(id, cols=-1)idrequiredcolsoptionalNumber of columns in the page layout. If the value is negative, the column count will not be modified.
The page identified by id MUST exist. If cols is provided and non-negative, the layout will be updated accordingly.
clab.set_page(id=1234, cols=3)This section defines functions for interacting with global front-end state, including charts, pages, and navigation controls.
Sets global parameters affecting all charts and pages.
clab.set(key, args…)keyrequiredargs…requiredkey. Argument types and count depend on the selected key.'tab''globaltime'Set the current global time.
Used by time-dependent features such as clab.synoptic (see Section 8.3.1).
'timelimits''timeformat'Set the time display format used by charts. Argument must be one of the following values:
'default''hhmmss''unixtime''gpstime''zoom''timelimits'.clab.set('timeformat', 'hhmmss')
clab.set('timelimits', 10.0, 20.0)
Closes charts or pages by identifier.
clab.close(type, id=0)typerequiredIdentifier specifying the target to close. Valid values:
'pages''page''chart'idoptionaltype is page or chart. Ignored when type is pages.clab.close('pages')
clab.close('chart', id=1234)Resets global parameters affecting charts and pages.
clab.reset(key)keyrequiredIdentifier specifying the parameter to reset. Valid values:
clab.reset('zoom')Creates a bookmark representing a time interval in the front-end interface.
Bookmarks allow navigation between predefined time ranges and can also be created via the horizontal scrollbar context menu.
clab.bookmark(tini, tend)tinirequiredtendrequiredclab.bookmark(tini=1.0, tend=5.0)C-LAB provides support for COM servers (IDispatch-compatible) through an out-of-process architecture. It exposes an API that allows external applications to interact with C-LAB from a separate process.
The examples in the following subsections are written in Python; however, the same principles can be applied to other programming languages.
clab.TimeSeries#Creates a clab.TimeSeries object from two arrays.
HRESULT CreateTimeSeries([in] BSTR name, [in] SAFEARRAY(VARIANT) xvalues, [in] SAFEARRAY(VARIANT) yvalues)namexvaluesyvalues.yvaluesxvalues.import win32com.client
obj = win32com.client.Dispatch('ClabApp.ClabObject')
obj.CreateTimeSeries('parameter1', [1,2,3,4,5,6,7,8], [10,20,30,40,50,60,70,80])clab.TimeSeries#Updates a clab.TimeSeries object. If the object does not exist, it is created.
The length of an existing object is not modified:
Passing an empty array leaves the corresponding data unchanged.
HRESULT UpdateTimeSeries([in] BSTR name, [in] SAFEARRAY(VARIANT) xvalues, [in] SAFEARRAY(VARIANT) yvalues)namexvaluesyvalues or be empty.yvaluesxvalues or be empty.import win32com.client
obj = win32com.client.Dispatch('ClabApp.ClabObject')
obj.UpdateTimeSeries('parameter1', [1,2,3,4,5,6,7,8], [10,20,30,40,50,60,70,80])Plots a clab.TimeSeries object. The x-axis represents time, and the y-axis represents the corresponding values. If the object was created using built-in loaders, time is expressed in seconds.
See Section 8.1.1 for the Python API equivalent.
HRESULT Plot([in] ULONGLONG chartId, [in] BSTR name, [in] BSTR side, [in] BSTR style, [out, retval] ULONGLONG* result)chartIdnameside'left', 'right'.style'bool', 'dots', 'line'.resultimport win32com.client
obj = win32com.client.Dispatch('ClabApp.ClabObject')
obj.Plot(1234, 'parameter1', 'left', 'line') # returns 1234Exports charts to a file. Supported formats: PDF and PNG.
See Section 8.4.1 for the Python API equivalent.
HRESULT Save([in] BSTR path, [in] ULONGLONG id, [in] BSTR size)pathidsizeOutput page size. Supported values:
import win32com.client
obj = win32com.client.Dispatch('ClabApp.ClabObject')
obj.Save('c:/file.pdf', 0, '200x100')