spiketools.spatial.occupancy.create_position_df¶
- spiketools.spatial.occupancy.create_position_df(position, timestamps, bins, area_range=None, speed=None, min_speed=None, max_speed=None, min_time=None, max_time=None, dropna=True, check_range=True)[source]¶
Create a dataframe that stores information about position bins.
- Parameters:
- position1d or 2d array
Position values.
- timestamps1d array
Timestamps, in seconds, corresponding to the position values.
- 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].
- area_rangelist of list, optional
Edges of the area to bin, defined as [[x_min, x_max], [y_min, y_max]].
- speed1d array, optional
Speed values corresponding to each position. Should be the same length as timestamps.
- min_speed, max_speedfloat, optional
Minimum and/or maximum speed thresholds to apply. Any entries with an associated speed below the minimum or above maximum are dropped.
- min_time, max_timefloat, optional
Minimum and/or maximum time thresholds, per bin observation, to apply. Any entries with an associated time length below the minimum or above maximum are dropped.
- dropnabool, optional, default: True
If True, drops any rows from the dataframe that contain NaN values.
- check_rangebool, optional, default: True
Whether to check the given bin definition range against the position values.
- Returns:
- bindfpd.DataFrame
Dataframe representation of position bin information.