pynapple icon indicating copy to clipboard operation
pynapple copied to clipboard

Spatial bins calculation assumes full sampling of X,Y

Open dlevenstein opened this issue 3 years ago • 0 comments

In computeOcupancy, computePlaceFields, (and perhaps others) spatial bins are calculated using:

xpos = position_tsd.iloc[:,0] ypos = position_tsd.iloc[:,1] xbins = np.linspace(xpos.min(), xpos.max()+1e-6, nb_bins+1) ybins = np.linspace(ypos.min(), ypos.max()+1e-6, nb_bins+1)

Which assumes that the animal has sampled the x/y bounds of space. However, this is sometimes not the case, especially with shorter behavioral trials or with very sensitive position measurements.

A few ways to solve this: -TSD objects have a "data support" property, as well as a "time support" property -Optional input for spatial bounds

dlevenstein avatar Dec 23 '21 21:12 dlevenstein