Bases: object
Class representing spike trains for the PySpike Module.
Constructs the SpikeTrain.
Parameters: |
|
---|
Returns a copy of this spike train. Use this function if you want to create a real (deep) copy of this spike train. Simple assignment t2 = t1 does not create a copy of the spike train data, but a reference as numpy.array is used for storing the data.
Returns: | SpikeTrain copy of this spike train. |
---|
Bases: object
A class representing a piece-wise constant function.
Constructs the piece-wise const function.
Parameters: |
|
---|
Adds another PieceWiseConst function to this function. Note: only functions defined on the same interval can be summed.
Parameters: | f – PieceWiseConstFunc function to be added. |
---|---|
Return type: | None |
Checks if the function is equal to another function up to decimal precision.
Parameters: | other – another PieceWiseConstFunc |
---|---|
Returns: | True if the two functions are equal up to decimal decimals, False otherwise |
Return type: | bool |
Computes the average of the piece-wise const function: \(a = 1/T \int_0^T f(x) dx\) where T is the length of the interval.
Parameters: | interval (Pair, sequence of pairs, or None.) – averaging interval given as a pair of floats, a sequence of pairs for averaging multiple intervals, or None, if None the average over the whole function is computed. |
---|---|
Returns: | the average a. |
Return type: | float |
Returns a copy of itself
Return type: | PieceWiseConstFunc |
---|
Returns two arrays containing x- and y-coordinates for immeditate plotting of the piece-wise function.
Returns: | (x_plot, y_plot) containing plottable data |
---|---|
Return type: | pair of np.array |
Example:
x, y = f.get_plottable_data()
plt.plot(x, y, '-o', label="Piece-wise const function")
A class representing a piece-wise linear function.
Constructs the piece-wise linear function.
Parameters: |
|
---|
Adds another PieceWiseLin function to this function. Note: only functions defined on the same interval can be summed.
Parameters: | f – PieceWiseLinFunc function to be added. |
---|---|
Return type: | None |
Checks if the function is equal to another function up to decimal precision.
Parameters: | other – another PieceWiseLinFunc |
---|---|
Returns: | True if the two functions are equal up to decimal decimals, False otherwise |
Return type: | bool |
Computes the average of the piece-wise linear function: \(a = 1/T \int_0^T f(x) dx\) where T is the interval length.
Parameters: | interval (Pair, sequence of pairs, or None.) – averaging interval given as a pair of floats, a sequence of pairs for averaging multiple intervals, or None, if None the average over the whole function is computed. |
---|---|
Returns: | the average a. |
Return type: | float |
Returns a copy of itself
Return type: | PieceWiseLinFunc |
---|
Returns two arrays containing x- and y-coordinates for immeditate plotting of the piece-wise function.
Returns: | (x_plot, y_plot) containing plottable data |
---|---|
Return type: | pair of np.array |
Example:
x, y = f.get_plottable_data()
plt.plot(x, y, '-o', label="Piece-wise const function")
Bases: object
A class representing values defined on a discrete set of points.
Constructs the discrete function.
Parameters: |
|
---|
Adds another DiscreteFunc function to this function. Note: only functions defined on the same interval can be summed.
Parameters: | f – DiscreteFunc function to be added. |
---|---|
Return type: | None |
Checks if the function is equal to another function up to decimal precision.
Parameters: | other – another DiscreteFunc |
---|---|
Returns: | True if the two functions are equal up to decimal decimals, False otherwise |
Return type: | bool |
Computes the average of the interval sequence: \(a = 1/N \sum f_n\) where N is the number of intervals.
Parameters: | interval (Pair, sequence of pairs, or None.) – averaging interval given as a pair of floats, a sequence of pairs for averaging multiple intervals, or None, if None the average over the whole function is computed. |
---|---|
Returns: | the average a. |
Return type: | float |
Returns a copy of itself
Return type: | DiscreteFunc |
---|
Returns two arrays containing x- and y-coordinates for plotting the interval sequence. The optional parameter averaging_window_size determines the size of an averaging window to smoothen the profile. If this value is 0, no averaging is performed.
Parameters: | averaging_window_size – size of the averaging window, default=0. |
---|---|
Returns: | (x_plot, y_plot) containing plottable data |
Return type: | pair of np.array |
Example:
x, y = f.get_plottable_data()
plt.plot(x, y, '-o', label="Discrete function")
Returns the integral over the given interval. For the discrete function, this amounts to two values: the sum over all values and the sum over all multiplicities.
Parameters: | interval (Pair, sequence of pairs, or None.) – integration interval given as a pair of floats, or a sequence of pairs in case of multiple intervals, if None the integral over the whole function is computed. |
---|---|
Returns: | the summed values and the summed multiplicity |
Return type: | pair of float |
Computes the average profile from the given ISI- or SPIKE-profiles.
Parameters: | profiles – list of PieceWiseConstFunc or PieceWiseLinFunc representing ISI- or SPIKE-profiles to be averaged. |
---|---|
Returns: | the averages profile \(<S_{isi}>\) or \(<S_{spike}>\). |
Return type: | PieceWiseConstFunc or PieceWiseLinFunc |
Computes the ISI-distance \(D_I\) of the given spike trains. The isi-distance is the integral over the isi distance profile \(I(t)\):
Parameters: |
|
---|---|
Returns: | The isi-distance \(D_I\). |
Return type: | double |
Computes the time averaged isi-distance of all pairs of spike-trains.
Parameters: |
|
---|---|
Returns: | 2D array with the pair wise time average isi distances \(D_{I}^{ij}\) |
Return type: | np.array |
computes the multi-variate isi-distance for a set of spike-trains. That is the time average of the multi-variate spike profile:
where the sum goes over all pairs <i,j>
Parameters: |
|
---|---|
Returns: | The time-averaged multivariate ISI distance \(D_I\) |
Return type: | double |
Computes the isi-distance profile \(I(t)\) of the two given spike trains. Retruns the profile as a PieceWiseConstFunc object. The ISI-values are defined positive \(I(t)>=0\).
Parameters: |
|
---|---|
Returns: | The isi-distance profile \(I(t)\) |
Return type: |
computes the multi-variate isi distance profile for a set of spike trains. That is the average isi-distance of all pairs of spike-trains:
where the sum goes over all pairs <i,j>
Parameters: |
|
---|---|
Returns: | The averaged isi profile \(<I(t)>\) |
Return type: |
Computes the spike-distance \(D_S\) of the given spike trains. The spike-distance is the integral over the spike distance profile \(S(t)\):
Parameters: |
|
---|---|
Returns: | The spike-distance. |
Return type: | double |
Computes the time averaged spike-distance of all pairs of spike-trains.
Parameters: |
|
---|---|
Returns: | 2D array with the pair wise time average spike distances \(D_S^{ij}\) |
Return type: | np.array |
Computes the multi-variate spike distance for a set of spike trains. That is the time average of the multi-variate spike profile:
where the sum goes over all pairs <i,j>
Parameters: |
|
---|---|
Returns: | The averaged multi-variate spike distance \(D_S\). |
Return type: | double |
Computes the spike-distance profile \(S(t)\) of the two given spike trains. Returns the profile as a PieceWiseLinFunc object. The SPIKE-values are defined positive \(S(t)>=0\).
Parameters: |
|
---|---|
Returns: | The spike-distance profile \(S(t)\). |
Return type: |
Computes the multi-variate spike distance profile for a set of spike trains. That is the average spike-distance of all pairs of spike-trains:
where the sum goes over all pairs <i,j>
Parameters: |
|
---|---|
Returns: | The averaged spike profile \(<S>(t)\) |
Return type: |
Computes the spike synchronization value SYNC of the given spike trains. The spike synchronization value is the computed as the total number of coincidences divided by the total number of spikes:
Parameters: |
|
---|---|
Returns: | The spike synchronization value. |
Return type: | double |
Computes the overall spike-synchronization value of all pairs of spike-trains.
Parameters: |
|
---|---|
Returns: | 2D array with the pair wise time spike synchronization values \(SYNC_{ij}\) |
Return type: | np.array |
Computes the multi-variate spike synchronization value for a set of spike trains.
Parameters: |
|
---|---|
Returns: | The multi-variate spike synchronization value SYNC. |
Return type: | double |
Computes the spike-synchronization profile S_sync(t) of the two given spike trains. Returns the profile as a DiscreteFunction object. The S_sync values are either 1 or 0, indicating the presence or absence of a coincidence.
Parameters: |
|
---|---|
Returns: | The spike-distance profile \(S_{sync}(t)\). |
Return type: | pyspike.function.DiscreteFunction |
Computes the multi-variate spike synchronization profile for a set of spike trains. For each spike in the set of spike trains, the multi-variate profile is defined as the number of coincidences divided by the number of spike trains pairs involving the spike train of containing this spike, which is the number of spike trains minus one (N-1).
Parameters: |
|
---|---|
Returns: | The multi-variate spike sync profile \(<S_{sync}>(t)\) |
Return type: | pyspike.function.DiscreteFunction |
Computes the peri-stimulus time histogram of a set of SpikeTrain. The PSTH is simply the histogram of merged spike events. The bin_size defines the width of the histogram bins.
Parameters: |
|
---|---|
Returns: | The PSTH as a PieceWiseConstFunc |
Generates a Poisson spike train with the given rate in the given time interval
Parameters: |
|
---|---|
Returns: | Poisson spike train as a SpikeTrain |
Loads a number of spike trains from a text file. Each line of the text file should contain one spike train as a sequence of spike times separated by separator. Empty lines as well as lines starting with comment are neglected. The edges represents the start and the end of the spike trains.
Parameters: |
|
---|---|
Returns: | list of SpikeTrain |
Merges a number of spike trains into a single spike train.
Parameters: | spike_trains – list of SpikeTrain |
---|---|
Returns: | spike train with the merged spike times |
Converts a string of times into a SpikeTrain.
Parameters: |
|
---|---|
Returns: |