spiketools.utils.checks.check_array_orientation¶
- spiketools.utils.checks.check_array_orientation(arr, expected=None)[source]¶
Check the orientation of an array of data.
- Parameters:
- arrndarray
Data array to check the orientation of.
- expectedint, optional
The expected number of values per sample (e.g. 2 for (x,y) position values). If provided, is used to infer orientation in ambiguous cases (e.g. # samples < # values).
- Returns:
- orientation{‘vector’, ‘row’, ‘column’}
The inferred orientation of the data array. For 1d arrays, ‘vector’ is returned. For 2d or 3rd arrays, ‘row’ or ‘column’ is returned based on the shape of the array.
Notes
In cases where # elements > 0 <= # dimensions, orientation can be ambiguous. In such cases, if expected is not provided, ‘row’ is returned by default.