This package deals with the evaluation of the parametrized models returned by optimization routines. Evaluation criteria used are:
This simulation file runs the subthreshold model together with the threshold model and plots the results against the actual recordings.
Plots the simulated voltage traces against the actual voltage traces and saves the result as .eps file.
Parameters: |
|
---|
Note
It is assumed that the keys of the dictionary inputs correspond to each other.
Plots spike distance metrics for the data provided. Metrics used are the gamma coincidence factor, the Schreiber similarity, and the van Rossum distance. Each is plotted as a function of the smoothness parameter for that particular metric. The spike times are extracted from the voltage traces using fit_neuron.data.extract_spikes.spk_from_sim() and fit_neuron.data.extract_spikes.spk_from_bio().
Parameters: |
|
---|
Note
The keys of bio_voltage_dict and simulated_voltage_dict must match. In addition, there may be multiple simulations for a single file ID, but there should be a single recorded voltage trace for a file ID.
[simulated_voltage_list,sim_file_id_list] = evaluate.simulate(neuron,input_current_list,file_id_list)
This function takes a neuron fitted from some data and simulates it against the data it is supposed to fit.
Parameters: |
|
---|---|
Returns: | dictionary of {file_id: simulated_voltage_list} |
Note
The values in the dictionary will be lists that have lengths corresponding to reps. Each element in these lists will be an array, computed as a single monte carlo trial.
This module is a library of spike distance metrics. For more information about the spike distance metrics used below, see http://www.scholarpedia.org/article/Measures_of_spike_train_synchrony.
Exponentially decaying function with additive method. Useful for efficiently computing Van Rossum distance.
TODO: test this function
This Python code (including all further comments) was written by Jeremy Fix (see http://jeremy.fix.free.fr/), based on Matlab code written by Thomas Kreuz.
The SPIKE-distance is described in this paper:
[KT2013] | Kreuz T, Chicharro D, Houghton C, Andrzejak RG, Mormann F: Monitoring spike train synchrony. J Neurophysiol 109, 1457-1472 (2013). |
Computes the bivariate SPIKE distance of Kreuz et al. (2012)
Parameters: |
|
---|---|
Returns: | Array of the values of the distance between time ti and te with N samples. |
Note
The arrays t1, t2 and values ti, te are unit less
Return the times (t1,t2) of the spikes in train[ibegin:] such that t1 < t and t2 >= t.
Returns the gamma precision factor between source and target trains, with precision delta. See [RJ2008] for a more detailed description. If normalize is True, the function returns the normalized gamma factor (less than 1.0), otherwise it returns the number of coincidences. dt is the precision of the trains, by default it is defaultclock.dt
Parameters: |
|
---|
[RJ2008] | Jolivet, Renaud, et al. “A benchmark test for a quantitative assessment of simple neuron models.” Journal of neuroscience methods 169.2 (2008): 417-424. |
t is an array of spike time arrays ti the initial time of the recordings te the end time of the recordings N the number of samples used to compute the distance spike_trains is a list of arrays of shape (N, T) with N spike trains The multivariate distance is the instantaneous average over all the pairwise distances
Computes Schreiber similarity between two spike trains as described in [SS2003].
Parameters: |
|
---|
[SS2003] | Schreiber, S., et al. “A new correlation-based measure of spike timing reliability.” Neurocomputing 52 (2003): 925-931. |
Calculates the Van Rossum distance between spike trains as defined in [VR2001]. Note that the default parameters are optimized for inputs in units of seconds.
Parameters: |
|
---|
[VR2001] | van Rossum, Mark CW. “A novel spike distance.” Neural Computation 13.4 (2001): 751-763. |
d=spkd(tli,tlj,cost) calculates the “spike time” distance as defined [DA2003] for a single free parameter, the cost per unit of time to move a spike.
Parameters: |
|
---|---|
Returns: | spike distance metric |
Translated to Python by Nicolas Jimenez from Matlab code by Daniel Reich.
[DA2003] | Aronov, Dmitriy. “Fast algorithm for the metric-space analysis of simultaneous responses of multiple single neurons.” Journal of Neuroscience Methods 124.2 (2003): 175-179. |
Here, the distance is 1 because there is one extra spike to be deleted at the end of the the first spike train:
>>> spike_time([1,2,3,4],[1,2,3],cost=1)
1
Here the distance is 1 because we shift the first spike by 0.2, leave the second alone, and shift the third one by 0.2, adding up to 0.4:
>>> spike_time([1.2,2,3.2],[1,2,3],cost=1)
0.4
Here the third spike is adjusted by 0.5, but since the cost per unit time is 0.5, the distances comes out to 0.25:
>>> spike_time([1,2,3,4],[1,2,3,3.5],cost=0.5)
0.25