spiketools.measures.trials.compute_pre_post_diffs

spiketools.measures.trials.compute_pre_post_diffs(frs_pre, frs_post, average=True, avg_type='mean')[source]

Compute the difference in firing rates between pre & post event windows.

Parameters:
frs_pre, frs_post1d array

Firing rates across pre & post event windows.

averagebool, optional, default: True

Whether to average

avg_type{‘mean’, ‘median’}

The type of averaging function to use.

Returns:
diffsfloat or 1d array

The difference between firing in pre & post event windows. If average is True, is a float reflecting the average difference. If average is False, is an array with trial-by-trial differences.

Examples

Compute the difference between pre & post event firing rates:

>>> frs_pre = np.array([5, 3, 1])
>>> frs_post = np.array([12, 8, 10])
>>> compute_pre_post_diffs(frs_pre, frs_post, average=True, avg_type='mean')
7.0