Skip to content

Read Igor Pro 8 binary wave version 7 names - #33

Open
CAOShurong wants to merge 1 commit into
AFM-analysis:masterfrom
CAOShurong:fix-wave-version-7
Open

CAOShurong wants to merge 1 commit into
AFM-analysis:masterfrom
CAOShurong:fix-wave-version-7

Conversation

@CAOShurong

Copy link
Copy Markdown

Igor Pro 8 writes a binary wave as version 7 when its name is longer than 31 bytes. igor2 only accepts versions 1, 2, 3, and 5, so loading that record raises invalid binary wave version: 7 and the wave is dropped from a packed experiment.

Version 7 keeps the version 5 layout. optionsSize1, which the older format note says to ignore, is the length of the name that follows the last version 5 section. Those bytes are not NUL-terminated. When bname is the placeholder :wave name too long:, it is replaced with that name. A version 7 wave with optionsSize1 of 0 keeps the short name already stored in bname. If optionsSize1 is non-zero but bname is not the placeholder, the extra bytes are still read and the short name is left unchanged. optionsSize2 is still ignored.

Fixes #32

Verification

On master, the new tests raise invalid binary wave version: 7. After the change, pytest tests on Windows with Python 3.13: 27 passed. The version 7 cases start from the existing Windows and Macintosh version 5 sample waves, including the 32-byte name from the report and a longer name, and are read both as .ibw files and as type 3 records in a packed experiment. flake8 passed.

An Igor Pro experiment that already contains a version 7 wave was not available. The cases above are version 5 samples with the version field, optionsSize1, and the trailing name set to the layout described in the report.

A wave whose name is longer than 31 bytes is written as version 7.
igor2 rejected that version, so packed.load dropped the record. The
name follows the version 5 sections and replaces the placeholder in
bname.

Fixes AFM-analysis#32
@paulmueller

Copy link
Copy Markdown
Member

It would be nice to have an actual (ideally stripped for size) test measurement file. Could you please add that to the PR?

@CAOShurong

Copy link
Copy Markdown
Author

I looked for a version 7 measurement to add. The experiment attached on #28, Test.pxp, is 10,170,354 bytes and walks as 465 records with 336 waves. Every wave header is version 5, and the file does not contain :wave name too long:, so trimming it does not produce the case in #32.

I do not have Igor Pro here, so I cannot save a new wave and strip it. The tests in this PR still start from the checked-in version 5 samples and set the version, the length at offset 56, and the trailing name to the layout in #32.

@jilavsky if you still have a small experiment that Igor wrote with one of these waves, that file is the fixture this needs.

@jilavsky

jilavsky commented Nov 6, 2026

Copy link
Copy Markdown

TestLongNames_liberal.pxp.zip
Attached is test file where we have example of long folder names (which work) and one of them contains long wave names.
image
This is the file which was failing on import previously.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support binary wave version 7 (wave names longer than 31 characters)

3 participants