lmlib.utils.beta.load_source_csv#
- lmlib.utils.beta.load_source_csv(filename, time_format=None, K=- 1, k=0, ch_select=None)#
Loads time series from csv file with/without header section.
File format:
# Description Line 1 # ... # Description Line n # time, signal1, signal2, ... 00:00:20.000, 10.34, 11.09, ...
Description: the file can start with an (optional) description section, prefixed with an ‘#’
Header: The data table can start with an (optional) column labels. A header line is detected, if the first data line starts with a non-nummeric character
Data: float values separated by either
',',';','\space','\tab'
; first column commonly contains the time; either as float (seconds) or as ‘hh:mm:ss.ttt’; the later will be converted to floats (in seconds).
- Parameters
filename (string) – csv file to be loaded
time_format (string) – Format string to be used to decode first line: “H:M:S” (e.g., 00:02:01.123) or None (e.g. 1.12)
K (int) – Length of signal to be loaded or -1 to load until end of file. If K is larger than the maximal signal length, an assertion is raised.
k (int) – Signal load start index. If k is larger than the maximal signal length, an assertion is raised.
ch_select (int, list, None) – int: channel index to be loaded in single channel mode. list: List of M channels to be loaded in multi channel mode. Selects channel indices to be loaded from multi-channel signals. 0 <= ch_select < Number of CSV columns. If set to None, all channels are loaded in multi channel mode and M = Number of CSV columns. First column in the CSV file is addressed as channel 0, and contains the time, if time_format is set accordingly.
- Returns
out –
- with
col_labels: list of column labels; if csv does not provide column headers, headers are set as
'col1','col2','col3', ...
* NOT YET IMPLEMENTED *data: (ndarray, shape=(K[, M])) – Multi-channel signal of shape=(K, M) if ch_select is of type list, single-channel signal of shape=(K, ) if ch_select is of type `int.
- Return type
Tuple (col_labels, data)