Skip to content

Conversation

@Tiomat85
Copy link

This adds unit tests for function_warp testing various data types and shapes, and validates shape and quick sanity check of data. Additionally extended the function_warp functionality itself to be able to handle data of higher dimensionality than the provided warp map, with it broadcasting the map over the higher dimensions. So as an example if the data provided was of shape (8,4,32,32) and the warp map was (32,32) it broadcasts it applying the warp map to each data dimension correctly for each of the sequence/scan dimensions.

Tiomat85 and others added 3 commits January 15, 2026 16:03
This adds unit tests for function_warp testing various data types and shapes, and validates shape and quick sanity check of data.
Additionally extended the function_warp functionality itself to be able to handle data of higher dimensionality than the provided warp map, with it broadcasting the map over the higher dimensions.
So as an example if the data provided was of shape (8,4,32,32) and the warp map was (32,32) it broadcasts it applying the warp map to each data dimension correctly for each of the sequence/scan dimensions.
Added is_channel_data to specify whether data has the last dimension as channel (rgb/rgba) and so to correctly validate the warped shape.

Missed return type, Adding typing to validate_warp
Copy link
Collaborator

@cmeyer cmeyer left a comment

Choose a reason for hiding this comment

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

Overall code looks good other than the few nitpicks I put in comments.

@cmeyer
Copy link
Collaborator

cmeyer commented Jan 16, 2026

Btw - I can make all these changes when I merge it, if you want.

Removed test-test code.
Adds function description comment.
Utilise better properties to identify if data is channelled.
def function_warp(data_and_metadata_in: _DataAndMetadataLike, coordinates_in: typing.Sequence[
_DataAndMetadataLike], order: int = 1) -> DataAndMetadata.DataAndMetadata:
def function_warp(data_and_metadata_in: _DataAndMetadataLike, coordinates_in: typing.Sequence[_DataAndMetadataLike], order: int = 1) -> DataAndMetadata.DataAndMetadata:
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll fix this during the merge, but this is the wrong format for a Python function comment.

https://peps.python.org/pep-0257/#multi-line-docstrings

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