Skip to content

Fix MRC ingestor's FEI parameter parsing - #13

Merged
ercius merged 5 commits into
mainfrom
fix/mrc-fei-parameter-parsing
Sep 14, 2026
Merged

ercius merged 5 commits into
mainfrom
fix/mrc-fei-parameter-parsing

Conversation

@ercius

@ercius ercius commented Sep 14, 2026

Copy link
Copy Markdown
Owner

get_mrc_metadata() used ll[0] as a dict key where ll[0] was actually a list (from a malformed list-comprehension), so every FEI parameter line raised TypeError, was swallowed by a bare except, and none of the vendor tomography parameters ever reached the metadata dict.

Replace it with a parser that follows the file's indentation to build a nested dict under meta_data['fei_parameters'], since section headers like "Check Focus" and "Tracking before exposures uses" repeat parameter names (e.g. "Periodicity (high tilt range)") that would collide if flattened.

Also add the utf-8-sig/cp1252 fallback used elsewhere in this codebase for reading the file, since the degree-sign bytes in these files raise UnicodeDecodeError under plain utf-8, and pretty-print nested dict values in the metadata viewer's text display instead of dumping a raw repr() on one line.

ercius and others added 5 commits September 14, 2026 11:15
get_mrc_metadata() used ll[0] as a dict key where ll[0] was actually a
list (from a malformed list-comprehension), so every FEI parameter
line raised TypeError, was swallowed by a bare except, and none of
the vendor tomography parameters ever reached the metadata dict.

Replace it with a parser that follows the file's indentation to build
a nested dict under meta_data['fei_parameters'], since section headers
like "Check Focus" and "Tracking before exposures uses" repeat
parameter names (e.g. "Periodicity (high tilt range)") that would
collide if flattened.

Also add the utf-8-sig/cp1252 fallback used elsewhere in this codebase
for reading the file, since the degree-sign bytes in these files raise
UnicodeDecodeError under plain utf-8, and pretty-print nested dict
values in the metadata viewer's text display instead of dumping a raw
repr() on one line.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
qtpy is imported directly (from qtpy import QtCore, ...) but wasn't
declared as a dependency; it currently installs transitively via
ScopeFoundry/pyqtgraph, which isn't guaranteed to hold across their
releases.

Also declares the MIT license (with LICENSE file), adds classifiers,
and adds Repository/Homepage project URLs so PyPI shows them.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Replaces the hardcoded version string with dynamic, scm-based
versioning (defaults: guess-next-dev scheme, node-and-date local
version). setuptools-scm was already a build dependency but unused.

Requires the full git history (tags included) to compute a version,
so the publish workflow's checkout is switched from the default
shallow clone to fetch-depth: 0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@ercius
ercius merged commit ce406ed into main Sep 14, 2026
3 checks passed
@ercius
ercius deleted the fix/mrc-fei-parameter-parsing branch September 14, 2026 18:33
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