Fix c2p misinterpretation and add comprehensive tests #4447
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 addresses the confusing behavior of the Axes.c2p() function when passing 1D lists or arrays as input coordinates.
Changes made:
Fix for c2p() behavior:
Properly handles single points provided as lists or 1D numpy arrays.
Returns a single point as np.array of shape (3,) and multiple points as np.array of shape (3, n_points).
Maintains compatibility with existing multi-argument input (x, y, z) and 2D list/array inputs.
Added tests:
Tests that reproduce the previously confusing outputs for 1D lists and arrays.
Confirms that single points, multi-points, and lists of points all produce expected outputs.

Motivation:
This clarifies the expected input/output behavior of c2p(), reduces confusion for users, and ensures consistency across different input types.
Notes:
No changes to existing functionality beyond the improved handling of 1D inputs.
Thanks to @uwezi for highlighting the issue in #4073
.