Skip to content

Add SerialEM .mdoc decoding (0.7.0) - #5

Merged
aaronkanzer merged 1 commit into
mainfrom
feat/serialem-mdoc
Oct 22, 2026
Merged

aaronkanzer merged 1 commit into
mainfrom
feat/serialem-mdoc

Conversation

@aaronkanzer

Copy link
Copy Markdown
Member

SerialEM and Thermo Fisher Tomography write a plain-text .mdoc beside every tilt series, montage and saved movie. It holds the acquisition settings (dose, exposure, tilt, defocus, frame count) that the MRC or TIFF itself does not, and compare_acquisition could read EPU but not this.

What it adds

  • .mdoc decoder, dispatched by extension with a 1 MiB leading read, also importable as decode_mdoc.
  • voltageKv, pixelSizeA, doseEA2, fractions, magnification and exposureS use the EPU decoder's names, so an mdoc goes straight into compare_acquisition.
  • Software and version, tilt axis, tilt range, total dose, acquisition times, the first image's stage position, defocus and frame path, and montage settings.
  • All four section kinds: [ZValue], [FrameSet] (including the unbracketed title of a per-movie file), [MontSection] (kept out of the per-image values) and IMOD's [Image = name] series.

Verification

  • 116 public mdoc files from GitHub: every compared value (16 fields) agrees with mdocfile on the 111 it can read. The other five are deliberately malformed test files; they decode with the bad values left out.
  • 46,400 mutations of those files (truncation, byte flips, dropped and shuffled lines, NaN and junk values): nothing raised, all output JSON-safe.
  • 12 new tests on synthetic files (no collection data in the repo). Full suite passes on Python 3.9 and 3.14.

Version bumped to 0.7.0. Publishing needs a v0.7.0 tag after merge.

SerialEM and Thermo Fisher Tomography write a plain-text .mdoc beside every
tilt series, montage and saved movie. It is the only place the acquisition
settings live (dose, exposure, tilt, defocus, frame count), and the
acquisition cross-check could read EPU but not this.

New decoder for .mdoc, dispatched by extension (1 MiB leading read). The
fields compare_acquisition reads use the EPU decoder's names, so an mdoc goes
straight into it. Handles [ZValue], [FrameSet] (including the unbracketed
title of a per-movie file), [MontSection] (kept out of the per-image values)
and IMOD's [Image = name] series.

Checked on 116 public mdoc files from GitHub: every compared value agrees
with mdocfile on the 111 it reads; 46,400 mutations raised nothing.
@aaronkanzer
aaronkanzer merged commit 9b3e037 into main Oct 22, 2026
3 checks passed
@aaronkanzer
aaronkanzer deleted the feat/serialem-mdoc branch October 22, 2026 10:47
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.

1 participant