Repository navigation
Conversation
Some measurement systems store a whole array (e.g. 100 float32 values) as a single REAL channel without a CA block. get_fmt_v4 returned a dtype like "<f400" for such a channel, numpy raised "TypeError: data type '<f400' not understood" and the whole file could not be opened. REAL channels wider than 128 bits, i.e. wider than any numpy float type, are now read as raw bytes like integer channels wider than 64 bits. REAL channels up to 128 bits keep their numeric dtypes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
I have MDF 4.00 files from a measurement system that store a whole array (thousands of float32 values) as one REAL channel without a CA block, e.g.
cn_bit_count = 115200. That is not spec conforming, but because of these channels the whole file can't be opened, although all other channels are fine:get_fmt_v4returnsf"<f{size // 8}"for such a channel. Integer channels wider than 64 bits are already caught and read as raw bytes (f"({size // 8},)u1").Change
get_fmt_v4: REAL channels wider than 128 bits (wider than any numpy float type) now get the same raw byte format as wide integer channels. REAL channels up to 128 bits keep their numeric dtypes, sofloat128on platforms that have it and REAL channels with a bit offset behave as before.get(..., raw=True)returns the bytes unchanged.test_real_channel_wider_than_128_bits: it writes a byte array channel of 400 bytes per record and sets itscn_data_typeto REAL (Intel and Motorola) in the file. It fails without the fix. With the fix the file opens, the other channel reads correctly and the payload comes back byte for byte. It also checks the 128-bit boundary inget_fmt_v4.Verification
get_fmt_v4is identical ondevelopment). The only failures are two tests for fixes that exist only ondevelopment.ruff formatandruff checkare clean.get_fmt_v3has the same pattern for MDF 3. I left it unchanged because I have no such file, but I'm happy to extend it if you like.Thanks for asammdf!
Background: I vibe-coded a Python app with Claude Opus 5.5 that reads MDF files with asammdf. Opus found this issue while we were building it, and I asked it to prepare the fix and report it here for me. Fable 5.1 and GPT-6 Astra (via Codex) cross-reviewed the change. All tests and measurements were run locally on my machine.