Repository navigation
Conversation
…kes mcstas_version _read_mcstas_version raised when entry1/simulation/program held no X.Y.Z. mccode-antlr up to 0.36 writes just "McStas" there, so its NeXus output could not be loaded; the error advised passing the version, but Read() did not accept it. - No version found: warn and assume the newest file layout in the settings registry (as written by current McStas and mccode-antlr) - Read(..., mcstas_version=(major, minor, patch)) is passed through to McStasNeXus, which already supported it New tests/version_test.py covers McStas, development-build and mccode-antlr version strings, the fallback warning and the passthrough. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Note: this overlaps with #49 ( Both change the
Whichever merges second gets a small conflict there. The resolution keeps both: def __init__(self, data_folder, filename="mccode.h5", entry="entry1", mcstas_version=None):
...
self.file_object = McStasNeXus(self.file, entry=entry, mcstas_version=mcstas_version)Also, |
Contributor
|
That's a great catch, thanks! Sensible fallback to use the newest |
This branch has not been deployed
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.
_read_mcstas_versionraised whenentry1/simulation/programcontained noX.Y.Z. mccode-antlr up to 0.36 writes just"McStas"there (fixed in mccode-dev/mccode-antlr#404), so its NeXus output couldn't be loaded at all:The error advised hardcoding the version as an argument, but
Read()didn't accept one.Changes
Read(..., mcstas_version=(major, minor, patch)): passed through toMcStasNeXus, which already supported it, to override the version from the file.The fallback is the judgement call here. It's right for anything written recently, but it would misread a genuinely old file that also lacks a version string; the warning says what was assumed and how to override it. If strictness is preferred, the
Read(..., mcstas_version=...)part alone still helps.Testing
tests/version_test.py: version parsing for McStas, development-build (" 3.99.99, git") and mccode-antlr ("McStas 3.10.0 (mccode-antlr 0.36.0)") strings; the no-version fallback warns;Read()passesmcstas_versionthrough. The two new behaviours fail without this change.export_scippnow loads 130,277 events with the warning, where it previously raised.🤖 Generated with Claude Code