Randomize
pynapple.process.randomize
shift_timestamps
Shifts all the time stamps of a random amount between min_shift and max_shift, wrapping the end of the time support to the beginning.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts |
Ts or TsGroup
|
The timestamps to shift. If TsGroup, shifts all Ts in the group independently. |
required |
min_shift |
float
|
minimum shift (default: 0 ) |
0.0
|
max_shift |
float
|
maximum shift, (default: length of time support) |
None
|
Returns:
Type | Description |
---|---|
Ts or TsGroup
|
The randomly shifted timestamps |
Source code in pynapple/process/randomize.py
shuffle_ts_intervals
Randomizes the timestamps by shuffling the intervals between them.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts |
Ts or TsGroup
|
The timestamps to randomize. If TsGroup, randomizes all Ts in the group independently. |
required |
Returns:
Type | Description |
---|---|
Ts or TsGroup
|
The randomized timestamps, with shuffled intervals |
Source code in pynapple/process/randomize.py
jitter_timestamps
Jitters each time stamp independently of random amounts uniformly drawn between -max_jitter and max_jitter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts |
Ts or TsGroup
|
The timestamps to jitter. If TsGroup, jitter is applied to each element of the group. |
required |
max_jitter |
float
|
maximum jitter |
None
|
keep_tsupport |
If True, keep time support of the input. The number of timestamps will not be conserved. If False, the time support is inferred from the jittered timestamps. The number of tmestamps is conserved. (default: False) |
False
|
Returns:
Type | Description |
---|---|
Ts or TsGroup
|
The jittered timestamps |
Source code in pynapple/process/randomize.py
resample_timestamps
Resamples the timestamps in the time support, with uniform distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ts |
Ts or TsGroup
|
The timestamps to resample. If TsGroup, each Ts object in the group is independently resampled, in the time support of the whole group. |
required |
Returns:
Type | Description |
---|---|
Ts or TsGroup
|
The resampled timestamps |