Skip to content

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

Merged
paulmueller merged 3 commits into
AFM-analysis:masterfrom
CAOShurong:fix-wave-version-7
Nov 16, 2026
Merged

paulmueller merged 3 commits 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.

@paulmueller
paulmueller merged commit 33b2746 into AFM-analysis:master Nov 16, 2026
3 checks passed
jilavsky added a commit to jilavsky/pyirena that referenced this pull request Nov 17, 2026
…karound

igor2 0.5.16 (AFM-analysis/igor2#33) reads binary-wave version 7, the
format Igor Pro 8 uses for wave names longer than 31 characters. Verified
on temp/TestLongNames_liberalAll.pxp: the importer writes the same seven
files with identical numeric data under 0.5.15 + our workaround and under
0.5.16 alone, and on 0.5.16 the workaround is never reached.

- Pin igor2>=0.5.16 in pyproject.toml, requirements.txt, conda/meta.yaml
  (conda-forge has it; the TODO waiting for 0.5.15 is gone).
- Remove _patch_v7_wave_to_v5, _v7_long_wave_name and
  _apply_v7_long_wave_name, and the type-101 counter: an old igor2 now
  fails fast in _require_igor2 with an upgrade message instead of
  silently dropping long-named waves. ExtractionResult keeps
  n_igor8_longname_markers (always 0) for existing callers.
- batch.igor_to_nexus lets ImportError through so the GUI shows it.
- _load_pxp_filesystem returns (filesystem, n_skipped) again, which the
  scripts/diag_tree.py and diag_folders.py already expected;
  diag_pxp.py no longer imports the removed helper.
- append_smr_entry opens through open_h5 (main's SSHFS-Win rule,
  enforced by test_h5open after rebasing onto main).
- Tests: version gate, batch surfacing, and an integration test on the
  real long-names experiment when present.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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