Skip to content

ValueError is raised, if cycle_nr in channel group is lower than actual data-length #1270

@janriem

Description

@janriem

Hi Daniel,

starting with version 8.1.0, there is an exception, when reading from a channel group whose cycle_nr is wrong (too low) in the file.
Before this version the behaviour was to read cycle_nr samples from the signal (i.e. cutting the signal short) without failing.

The exception message "ValueError: memoryview assignment: lvalue and rvalue have different structures" is raised by this line:

buffer_view[cur_size : cur_size + original_size] = new_data

Although this is caused by an error in the file, I wanted to ask, if you could restore the previous behaviour so reading the signal doesn't fail?
If there was a way to read the full signal, that would of course be even better.

Example Code:

mdf = MDF("cycle_count.mf4")
signal = mdf.get("RandomSignal")

Versions:

Testfile:

cycle_count.mf4.zip


Jan Riemer jan.riemer@mercedes-benz.com on behalf of Mercedes-Benz Tech Innovation GmbH
https://github.com/mercedes-benz/foss/blob/master/PROVIDER_INFORMATION.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions