spiketools.stats.trials.compare_pre_post_activity¶
- spiketools.stats.trials.compare_pre_post_activity(trial_spikes, pre_window, post_window, avg_type='mean')[source]¶
Compare pre & post activity, computing the average firing rates and a t-test comparison.
- Parameters:
- trial_spikeslist of 1d array
Spike times per trial, in seconds.
- pre_window, post_windowlist of [float, float]
The pre and post event time window, in seconds, to compute firing rate across.
- avg_type{‘mean’, ‘median’}
The type of averaging function to use.
- Returns:
- avg_pre, avg_postfloat
The average firing rates pre and post event.
- t_val, p_valfloat
The t value and p statistic for a t-test comparing pre and post event firing.
Examples
Compute the average firing rates pre & post event as well as a t-test comparison:
>>> trial_spikes = [np.array([-0.3, -0.2, 0.4, 0.5, 0.6, 0.75]), ... np.array([-0.15, 0.45, 1.0, 1.2, 1.6]), ... np.array([-0.45, -0.12, -0.02, 0.32, 0.67, 0.89, 1.7])] >>> pre_window, post_window = [-0.5, 0], [0, 2] >>> compare_pre_post_activity(trial_spikes, pre_window, post_window, avg_type='mean') (4.0, 2.0, 1.7320508075688774, 0.22540333075851657)