spiketools.spatial.information.compute_spatial_information¶
- spiketools.spatial.information.compute_spatial_information(bin_firing, occupancy, normalize=False)[source]¶
Compute spatial information.
- Parameters:
- bin_firing1d or 2d array
Binned firing.
- occupancy1d or 2d array
Occupancy across the space.
- normalizebool, optional, default: False
If True, normalize the binned firing rate data by the occupancy. If False, it is assumed that the binned firing has already been normalized.
- Returns:
- infofloat
Spike information rate for spatial information (bits/spike).
Notes
This measure computes the spatial information between the firing and spatial location, as:
\[I = \sum{\lambda (x) log_2 \frac{\lambda(x)} {\lambda} p(x)dx}\]References
[1]Skaggs, W. E., McNaughton, B. L., & Gothard, K. M. (1992). An Information-Theoretic Approach to Deciphering the Hippocampal Code. Advances in neural information processing systems.
Examples
Compute spatial information across a 1d space:
>>> bin_firing = np.array([1, 1, 1, 1, 4]) >>> occupancy = np.array([1, 1, 1, 1, 1]) >>> info = compute_spatial_information(bin_firing, occupancy) >>> print('{:5.4f}'.format(info)) 0.3219
Compute spatial information across a 2d space:
>>> bin_firing = np.array([[1, 1, 1, 5], ... [1, 1, 1, 5]]) >>> occupancy = np.array([[1, 1, 1, 1], ... [1, 1, 1, 1]]) >>> info = compute_spatial_information(bin_firing, occupancy) >>> print('{:5.4f}'.format(info)) 0.4512