fix(saxs): harden experimental data loading on Windows#127
Conversation
Incorporate the safe parts of PR #125 onto the up-to-date continuation branch. Preserve comment-header column detection for metadata-heavy experimental files and constrain the experimental data header dialog so long Windows paths do not oversized-crash the UI. Co-authored-by: KWWyatt <117381914+KWWyatt@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25104474b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| keywords = ("q", "iq", "intensity", "error", "sigma", "uncert") | ||
| return any( | ||
| any(keyword in token for keyword in keywords) for token in normalized |
There was a problem hiding this comment.
Stop treating any token containing 'q' as a column label
Using "q" as a substring keyword in _tokens_look_like_column_labels causes many metadata comments (e.g., lines containing words like Acquisition) to be classified as column headers. In load_experimental_data_file, this can promote a metadata comment to column_names, after which _resolve_experimental_columns may infer column indices from metadata token positions that do not exist in the numeric matrix (for example, inferring intensity/error at index 2+ for a 2-column file), raising an out-of-range ValueError for otherwise valid data files.
Useful? React with 👍 / 👎.
Summary
This PR incorporates the safe Windows crash fixes from #125 onto the current up-to-date
mainbaseline.Changes included:
# q I(q)while ignoring metadata comments such as# Background offset factor: 1.0.np.loadtxtcan parse the file directly.Validation