spiketools.spatial.occupancy.compute_occupancy_df

spiketools.spatial.occupancy.compute_occupancy_df(bindf, bins, minimum=None, normalize=False, set_nan=False)[source]

Compute the bin occupancy from bin-position dataframe.

Parameters:
bindfpd.DataFrame

Dataframe representation of position bin information.

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].

minimumfloat, optional

The minimum required occupancy. If defined, any values below this are set to zero.

normalizebool, optional, default: False

Whether to normalize occupancy to sum to 1.

set_nanbool, optional, default: False

Whether to set zero occupancy locations as NaN.

Returns:
occupancy1d or 2d array

Computed occupancy across the space. For 2d, has shape [n_y_bins, n_x_bins] (see notes in compute_occupancy).