pynapple.process.decoding#

Decoding functions for timestamps data (spike times). The first argument is always a tuning curves object.

Functions

decode_1d(tuning_curves, group, ep, bin_size)

Perform Bayesian decoding over a one dimensional feature.

decode_2d(tuning_curves, group, ep, bin_size, xy)

Performs Bayesian decoding over 2 dimensional features.

pynapple.process.decoding.decode_1d(tuning_curves, group, ep, bin_size, time_units='s', feature=None)[source]#

Perform Bayesian decoding over a one dimensional feature. See: Zhang, K., Ginzburg, I., McNaughton, B. L., & Sejnowski, T. J. (1998). Interpreting neuronal population activity by reconstruction: unified framework with application to hippocampal place cells. Journal of neurophysiology, 79(2), 1017-1044.

Parameters:
  • tuning_curves (pandas.DataFrame) – Each column is the tuning curve of one neuron relative to the feature. Index should be the center of the bin.

  • group (TsGroup or dict of Ts/Tsd object.) – A group of neurons with the same index as tuning curves column names.

  • ep (IntervalSet) – The epoch on which decoding is computed

  • bin_size (float) – Bin size. Default is second. Use the parameter time_units to change it.

  • time_units (str, optional) – Time unit of the bin size (‘s’ [default], ‘ms’, ‘us’).

  • feature (Tsd, optional) – The 1d feature used to compute the tuning curves. Used to correct for occupancy. If feature is not passed, the occupancy is uniform.

Returns:

  • Tsd – The decoded feature

  • TsdFrame – The probability distribution of the decoded feature for each time bin

Raises:

RuntimeError – If group is not a dict of Ts/Tsd or TsGroup. If different size of neurons for tuning_curves and group. If indexes don’t match between tuning_curves and group.

pynapple.process.decoding.decode_2d(tuning_curves, group, ep, bin_size, xy, time_units='s', features=None)[source]#

Performs Bayesian decoding over 2 dimensional features.

See: Zhang, K., Ginzburg, I., McNaughton, B. L., & Sejnowski, T. J. (1998). Interpreting neuronal population activity by reconstruction: unified framework with application to hippocampal place cells. Journal of neurophysiology, 79(2), 1017-1044.

Parameters:
  • tuning_curves (dict) – Dictionnay of 2d tuning curves (one for each neuron).

  • group (TsGroup or dict of Ts/Tsd object.) – A group of neurons with the same keys as tuning_curves dictionary.

  • ep (IntervalSet) – The epoch on which decoding is computed

  • bin_size (float) – Bin size. Default is second. Use the parameter time_units to change it.

  • xy (tuple) – A tuple of bin positions for the tuning curves i.e. xy=(x,y)

  • time_units (str, optional) – Time unit of the bin size (‘s’ [default], ‘ms’, ‘us’).

  • features (TsdFrame) – The 2 columns features used to compute the tuning curves. Used to correct for occupancy. If feature is not passed, the occupancy is uniform.

Returns:

  • Tsd – The decoded feature in 2d

  • numpy.ndarray – The probability distribution of the decoded trajectory for each time bin

Raises:

RuntimeError – If group is not a dict of Ts/Tsd or TsGroup. If different size of neurons for tuning_curves and group. If indexes don’t match between tuning_curves and group.