Skip to content

feat(kinematics): add compute_roaming_entropy (#1001)#1012

Open
AshNicolus wants to merge 1 commit into
neuroinformatics-unit:mainfrom
AshNicolus:add-compute-roaming-entropy
Open

feat(kinematics): add compute_roaming_entropy (#1001)#1012
AshNicolus wants to merge 1 commit into
neuroinformatics-unit:mainfrom
AshNicolus:add-compute-roaming-entropy

Conversation

@AshNicolus
Copy link
Copy Markdown

Description

Closes #1001

Adds a new path-level metric, compute_roaming_entropy, which quantifies how
broadly and uniformly an individual explores 2D space over the course of a
trajectory. It is the Shannon entropy of the spatial occupancy distribution
obtained by binning positions onto a regular 2D grid:

$$H = -\sum_{i=1}^{N} p_i \ln p_i$$

where $p_i$ is the proportion of (non-NaN) time points spent in bin $i$.
The metric is invariant to the order of visits, so it captures where an
individual went rather than how, complementing speed/distance-based metrics.

API

def compute_roaming_entropy(
    data: xr.DataArray,
    bins: int | tuple[int, int] = 30,
    normalise: bool = True,
) -> xr.DataArray:

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Metric] Add function for computing roaming entropy

1 participant