Fix MRC ingestor's FEI parameter parsing - #13
Merged
Merged
Conversation
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>
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.
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.