neuroinformatics-unit / movement

Python tools for analysing body movements across space and time
http://movement.neuroinformatics.dev
BSD 3-Clause "New" or "Revised" License
96 stars 8 forks source link

A general-purpose validator for data array dimensions and coordinates #292

Closed niksirbi closed 2 weeks ago

niksirbi commented 1 month ago

Is your feature request related to a problem? Please describe. In vector.py we have a private function that checks for the existence of any required dimensions + coordinate in a data array. These dims and coords are passed as a dict. For example, if {'space': ['x, y'], 'time': []} is passed, it will check that the space and time dimensions exists, and that the space dimension specifically has x and y coordinates.

This sort of function is generally useful, and could be used across vector.py, kinematics.py and filtering.py to validate the existence of an arbitrary subsets of dims and coords in data array objects. For example, this would eliminate the need for the _validate_time_dimension function in kinematics.py, which is much narrower in scope.

Describe the solution you'd like Make the above function public, perhaps in a new validators/arrays.py module?

Additional context This issue could be solved in conjunction with #291