spiketools.spatial.checks.check_bin_definition

spiketools.spatial.checks.check_bin_definition(bins, position=None)[source]

Check a bin definition for binning spatial data.

Parameters:
binsint or list of [int, int]

The bin definition for dividing up the space. If 1d, can be integer. If 2d should be a list, defined as [number of x_bins, number of y_bins].

position1d or 2d array, optional

Position values across a 1d or 2d space. If provided, used to check consistency between position dimensionality and bin definition.

Returns:
binslist of [int] or list of [int, int]

Bin definition, after checking, and converted to being a list.

Raises:
AssertionError

Raised if there are any issues with the given bin definition.