Tuning curves
pynapple.process.tuning_curves
You can compute tuning curves for features in 1 dimension or 2 dimension.
Function | Description |
---|---|
nap.compute_discrete_tuning_curves |
Firing rate from a dictionnary of IntervalSet |
compute_1d_tuning_curves |
Firing rate as a function of a 1-d feature |
compute_2d_tuning_curves |
Firing rate as a function of a 2-d features |
compute_1d_tuning_curves_continuous |
Mean value as a function of a 1-d feature |
compute_2d_tuning_curves_continuous |
Mean value as a function of a 2-d features |
compute_1d_mutual_info |
Mutual information of a tuning curve computed from a 1-d feature. |
compute_2d_mutual_info |
Mutual information of a tuning curve computed from a 2-d features. |
compute_discrete_tuning_curves
Compute discrete tuning curves of a TsGroup using a dictionary of epochs. The function returns a pandas DataFrame with each row being a key of the dictionary of epochs and each column being a neurons.
This function can typically being used for a set of stimulus being presented for multiple epochs. An example of the dictionary is :
>>> dict_ep = {
"stim0": nap.IntervalSet(start=0, end=1),
"stim1":nap.IntervalSet(start=2, end=3)
}
In this case, the function will return a pandas DataFrame :
>>> tc
neuron0 neuron1 neuron2
stim0 0 Hz 1 Hz 2 Hz
stim1 3 Hz 4 Hz 5 Hz
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
TsGroup
|
The group of Ts/Tsd for which the tuning curves will be computed |
required |
dict_ep |
dict
|
Dictionary of IntervalSets |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Table of firing rate for each neuron and each IntervalSet |
Raises:
Type | Description |
---|---|
RuntimeError
|
If group is not a TsGroup object. |
Source code in pynapple/process/tuning_curves.py
compute_1d_tuning_curves
Computes 1-dimensional tuning curves relative to a 1d feature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
TsGroup
|
The group of Ts/Tsd for which the tuning curves will be computed |
required |
feature |
Tsd (or TsdFrame with 1 column only)
|
The 1-dimensional target feature (e.g. head-direction) |
required |
nb_bins |
int
|
Number of bins in the tuning curve |
required |
ep |
IntervalSet
|
The epoch on which tuning curves are computed. If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves. If None, the boundaries are inferred from the target feature |
None
|
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame to hold the tuning curves |
Raises:
Type | Description |
---|---|
RuntimeError
|
If group is not a TsGroup object. |
Source code in pynapple/process/tuning_curves.py
compute_2d_tuning_curves
Computes 2-dimensional tuning curves relative to a 2d features
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group |
TsGroup
|
The group of Ts/Tsd for which the tuning curves will be computed |
required |
features |
TsdFrame
|
The 2d features (i.e. 2 columns features). |
required |
nb_bins |
int or tuple
|
Number of bins in the tuning curves (separate for 2 feature dimensions if tuple provided) |
required |
ep |
IntervalSet
|
The epoch on which tuning curves are computed. If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves given as: (minx, maxx, miny, maxy) If None, the boundaries are inferred from the target features |
None
|
Returns:
Type | Description |
---|---|
tuple
|
A tuple containing: tc (dict): Dictionary of the tuning curves with dimensions (nb_bins, nb_bins). xy (list): List of bins center in the two dimensions |
Raises:
Type | Description |
---|---|
RuntimeError
|
If group is not a TsGroup object or if features is not 2 columns only. |
Source code in pynapple/process/tuning_curves.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
compute_1d_mutual_info
Mutual information as defined in
Skaggs, W. E., McNaughton, B. L., & Gothard, K. M. (1993). An information-theoretic approach to deciphering the hippocampal code. In Advances in neural information processing systems (pp. 1030-1037).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tc |
DataFrame or ndarray
|
Tuning curves in columns |
required |
feature |
Tsd (or TsdFrame with 1 column only)
|
The 1-dimensional target feature (e.g. head-direction) |
required |
ep |
IntervalSet
|
The epoch over which the tuning curves were computed If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves. If None, the boundaries are inferred from the target feature |
None
|
bitssec |
bool
|
By default, the function return bits per spikes. Set to true for bits per seconds |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Spatial Information (default is bits/spikes) |
Source code in pynapple/process/tuning_curves.py
compute_2d_mutual_info
Mutual information as defined in
Skaggs, W. E., McNaughton, B. L., & Gothard, K. M. (1993). An information-theoretic approach to deciphering the hippocampal code. In Advances in neural information processing systems (pp. 1030-1037).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dict_tc |
dict of numpy.ndarray or numpy.ndarray
|
If array, first dimension should be the neuron |
required |
features |
TsdFrame
|
The 2 columns features that were used to compute the tuning curves |
required |
ep |
IntervalSet
|
The epoch over which the tuning curves were computed If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves. If None, the boundaries are inferred from the target features |
None
|
bitssec |
bool
|
By default, the function return bits per spikes. Set to true for bits per seconds |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Spatial Information (default is bits/spikes) |
Source code in pynapple/process/tuning_curves.py
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
|
compute_1d_tuning_curves_continuous
Computes 1-dimensional tuning curves relative to a feature with continuous data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tsdframe |
Tsd or TsdFrame
|
Input data (e.g. continuous calcium data where each column is the calcium activity of one neuron) |
required |
feature |
Tsd (or TsdFrame with 1 column only)
|
The 1-dimensional target feature (e.g. head-direction) |
required |
nb_bins |
int
|
Number of bins in the tuning curves |
required |
ep |
IntervalSet
|
The epoch on which tuning curves are computed. If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves. If None, the boundaries are inferred from the target feature |
None
|
Returns:
Type | Description |
---|---|
pandas.DataFrame to hold the tuning curves
|
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If tsdframe is not a Tsd or a TsdFrame object. |
Source code in pynapple/process/tuning_curves.py
compute_2d_tuning_curves_continuous
Computes 2-dimensional tuning curves relative to a 2d feature with continuous data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tsdframe |
Tsd or TsdFrame
|
Input data (e.g. continuous calcium data where each column is the calcium activity of one neuron) |
required |
features |
TsdFrame
|
The 2d feature (two columns) |
required |
nb_bins |
int or tuple
|
Number of bins in the tuning curves (separate for 2 feature dimensions if tuple provided) |
required |
ep |
IntervalSet
|
The epoch on which tuning curves are computed. If None, the epoch is the time support of the feature. |
None
|
minmax |
tuple or list
|
The min and max boundaries of the tuning curves. Should be a tuple of minx, maxx, miny, maxy If None, the boundaries are inferred from the target feature |
None
|
Returns:
Type | Description |
---|---|
tuple
|
A tuple containing: tc (dict): Dictionary of the tuning curves with dimensions (nb_bins, nb_bins). xy (list): List of bins center in the two dimensions |
Raises:
Type | Description |
---|---|
RuntimeError
|
If tsdframe is not a Tsd/TsdFrame or if features is not 2 columns |
Source code in pynapple/process/tuning_curves.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 |
|