Skip to content

Fix problem with dimensionality - #194

Merged
Harry-Rich merged 4 commits into
mainfrom
fix-dimension
Nov 3, 2025
Merged

Fix problem with dimensionality#194
Harry-Rich merged 4 commits into
mainfrom
fix-dimension

Conversation

@arm61

@arm61 arm61 commented Nov 3, 2025

Copy link
Copy Markdown
Collaborator

As highlighted with #193, currently inputting a single dimension doesn't work. This PR resolves this issue and adds appropriate tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes the behavior of single-dimension slicing in the Parser class to preserve the dimension axis. Previously, selecting a single dimension (e.g., 'x', 'y', or 'z') would eliminate the dimension axis entirely, while multi-dimension selections would preserve it. The fix ensures consistent behavior across all dimension selections.

  • Changed single-dimension slice definitions from index-based (np.s_[0]) to range-based (np.s_[0:1]) to preserve the dimension axis with size 1
  • Added three new test cases to verify the dimension axis size for single, double, and triple dimension selections

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
kinisi/parser.py Updated DIMENSIONALITY dictionary to use slice ranges instead of single indices for 'x', 'y', 'z' dimensions
kinisi/tests/test_parser.py Added test cases to verify that dimension axis is preserved with correct sizes (1, 2, 3) for different dimension selections
Comments suppressed due to low confidence (1)

kinisi/parser.py:31

  • The byte string versions of single dimensions ('b'x'', 'b'y'', 'b'z'') still use single-index slicing (np.s_[0], np.s_[1], np.s_[2]) instead of range-based slicing. This is inconsistent with the updated string versions and will cause the same dimension-elimination bug if byte string dimensions are used (e.g., from HDF5 loading). These should be updated to 'np.s_[0:1]', 'np.s_[1:2]', and 'np.s_[2:3]' respectively to match the fix applied to the string versions.
    b'x': np.s_[0],
    b'y': np.s_[1],
    b'z': np.s_[2],

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@arm61
arm61 requested a review from Copilot November 3, 2025 09:23
@github-actions

github-actions Bot commented Nov 3, 2025

Copy link
Copy Markdown

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
1952 1855 95% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
kinisi/parser.py 78% 🟢
kinisi/tests/test_parser.py 100% 🟢
TOTAL 89% 🟢

updated for commit: 8163580 by action🐍

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@arm61
arm61 removed the request for review from PythonFZ November 3, 2025 09:39
@arm61

arm61 commented Nov 3, 2025

Copy link
Copy Markdown
Collaborator Author

Removed @PythonFZ, cause I feel like he is doing a lot of reviewing for us 🤣.

@Harry-Rich

Copy link
Copy Markdown
Collaborator

Seems like a fairly small change and covered by new tests so I am happy.

@Harry-Rich Harry-Rich closed this Nov 3, 2025
@Harry-Rich Harry-Rich reopened this Nov 3, 2025

@Harry-Rich Harry-Rich left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change and covered by tests

@Harry-Rich
Harry-Rich merged commit 1a2dd0e into main Nov 3, 2025
18 checks passed
@Harry-Rich
Harry-Rich deleted the fix-dimension branch November 3, 2025 10:47
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.

3 participants