Add mode for handling unknown columns in MPR files#124
Merged
chatcannon merged 7 commits intomasterfrom Jul 30, 2025
Merged
Conversation
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.
This PR provides a workaround for several open issues regarding unknown columns. The main reason this has been more prevalent recently seems to be that EC-lab adds extra columns to data files when opening and saving, even if these columns were not necessarily recorded directly by an instrument.
This does not remove the need to handling such columns properly, but should allow other known columns to be read successfully.
This PR adds a
error_on_unknown_columnoption toMPRfile(true by default, the current behaviour), which if false, will collect unknown columns and attempt to read the file with all possible combinations of common dtypes, until successful. This approach will not scale very well to cases with many unknown columns, but works well for one, two or three unknown columns (there is a guard preventing it from this exponential wall of possible combinations). These columns will still have unknown names in the output, but the remaining data can be used.As a side effect, the
VMPdata_dtype_from_colIDsmethod now returns an intermediate generic representation that can be easily edited, rather than the hardcodednp.dtype. It then needs to be converted before being used to read the buffer.This PR also adds col 182 as step time/s
<f8, as suggested by @AShnier in #112 (comment) (I finally have a file where I can confirm it directly).