@staticmethod<EOL><INDENT>def _compute_fano_factor(spike_res, neuron_id, time_window, start_time, end_time):<DEDENT>
assert(end_time >= start_time+time_window)<EOL>bins = (end_time-start_time)/time_window<EOL>bins = int(np.floor(bins))<EOL>binned_spikes = np.zeros(bins)<EOL>spike_array_neuron = spike_res.t[spike_res.i==neuron_id]<EOL>for bin in range(bins):<EOL><INDENT>lower_time = start_time+time_window*bin<EOL>upper_time = start_time+time_window*(bin+<NUM_LIT:1>)<EOL>spike_array_interval = spike_array_neuron[spike_array_neuron >= lower_time]<EOL>spike_array_interval = spike_array_interval[spike_array_interval < upper_time]<EOL>spikes = len(spike_array_interval)<EOL>binned_spikes[bin]=spikes<EOL><DEDENT>var = np.var(binned_spikes)<EOL>avg = np.mean(binned_spikes)<EOL>if avg > <NUM_LIT:0>:<EOL><INDENT>return var/float(avg)<EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>
Computes Fano Factor for one neuron.

        :param spike_res:

            Result containing the spiketimes of all neurons

        :param neuron_id:

            Index of neuron for which FF is computed

        :param time_window:

            Length of the consecutive time windows to compute the FF

        :param start_time:

            Start time of measurement to consider

        :param end_time:

            End time of measurement to consider

        :return:

            Fano Factor (float) or
            returns 0 if mean firing activity is 0.