Skip to content

Add mode for handling unknown columns in MPR files#124

Merged
chatcannon merged 7 commits intomasterfrom
ml-evs/col-182-and-warning-only-mode
Jul 30, 2025
Merged

Add mode for handling unknown columns in MPR files#124
chatcannon merged 7 commits intomasterfrom
ml-evs/col-182-and-warning-only-mode

Conversation

@ml-evs
Copy link
Collaborator

@ml-evs ml-evs commented Jun 13, 2025

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_column option to MPRfile (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_colIDs method now returns an intermediate generic representation that can be easily edited, rather than the hardcoded np.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).

@ml-evs ml-evs marked this pull request as ready for review June 13, 2025 17:26
@chatcannon chatcannon merged commit baec893 into master Jul 30, 2025
4 checks passed
@chatcannon chatcannon deleted the ml-evs/col-182-and-warning-only-mode branch July 30, 2025 12:27
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.

2 participants