Tuning curves
pynapple.process.tuning_curves
compute_discrete_tuning_curves
Compute discrete tuning curves of a TsGroup using a dictionnary of epochs. The function returns a pandas DataFrame with each row being a key of the dictionnary 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 dictionnary 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
|
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 given as: (minx, maxx, miny, maxy) If None, the boundaries are inferred from the target variable |
None
|
Returns:
Type | Description |
---|---|
tuple
|
A tuple containing: tc (dict): Dictionnary 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
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 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 |
|
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 |
---|---|---|---|
tc |
dict or 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
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 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 |
|
compute_1d_tuning_curves_continuous
Computes 1-dimensional tuning curves relative to a feature with continous data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tsdframe |
Tsd or TsdFrame
|
Input data (e.g. continus 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 |
---|---|
DataFrame
|
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 continous 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): Dictionnary 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
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 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 |
|