How to use the pymatreader.read_mat function in pymatreader

To help you get started, we’ve selected a few pymatreader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dnvgl / qats / qats / readers / sintef_mat.py View on Github external
Returns
    -------
    dict
        Time and data

    Examples
    --------
    >>> tname, names = read_names('data.mat')
    >>> data = read_data('data.mat', [tname, *names])
    >>> t = data[tname]   # time
    >>> x1 = data[names[0]]  # first data series

    """
    # ignore the data field (if it exists) which contains the time series data in
    # latest file format
    data = read_mat(path)

    if "chan_names" in data.keys():
        # latest exhange format based on v.7.3 mat files
        data = dict(zip(data["chan_names"], np.transpose(data["data"])))
    else:
        # exhange format based on v.7.2 mat files
        ignored = ["comment", "fs", "test_num", "test_date", "__header__", "__version__", "__globals__"]
        data = {k: v for k, v in data.items() if k not in ignored}

    if names is not None:
        return {k: v for k, v in data.items() if k in names}
    else:
        return data

pymatreader

Convenient reader for Matlab mat files

BSD-2-Clause
Latest version published 3 months ago

Package Health Score

58 / 100
Full package analysis

Popular pymatreader functions