ni 0.2 documentation

3. The ni.model.pointprocess Module

«  2. model Package   ::   Contents   ::   4. tools Package  »

3. The ni.model.pointprocess Module

class ni.model.pointprocess.PointProcess(dimensionality)[source]

A Point Process container.

Usually generated by loading from a file or via ni.model.pointprocess.createPoisson()

addSpike(t)[source]

adds a spike to the point process, if it falls in the allowed range.

getCounts()[source]

Gives a (in most cases binary) time series of the point process.

getProbability(t_from, t_to)[source]

Undocumented

plot(y=0, marker='|')[source]

Plots the pointprocess as points at line y.

marker determines the color and shape of the marker. Default is a vertical line ‘|’

plotGaussed(width)[source]

Plots the pointprocess as a smoothed time series

ni.model.pointprocess.PointProcessFromSpikeTimes(times)[source]
class ni.model.pointprocess.SimpleFiringRateModel[source]

Uses just the firing rate as a predictor

compare(Data, Prediction)[source]
fit(data)[source]
loglikelihood(Data, Prediction)[source]
predict(Data)[source]
ni.model.pointprocess.createPoisson(p, l)[source]

This generates a spike sequence of length l according to either a fixed firing rate p, or a repeated sequence of firing rates if type(p) == np.ndarray.

It creates a ni.model.pointprocess.PointProcess

Example 1:

p1 = ni.model.pointprocess.createPoisson(0.1,1000)
p1.plotGaussed(20)
plot(p1.frate)
_static/p1_out_smooth.png
p2 = ni.model.pointprocess.createPoisson(sin(numpy.array(range(0,200))*0.01)*0.5- 0.2,1000)
p2.plot()
p2.plotGaussed(10)
_static/p2_out.png
p2.plotGaussed(20)
plot(p2.frate)
_static/p2_out_smooth.png

Example with multiple channels:

frate = (numpy.array(range(0,200))*0.001)*0.2+0.01
channels = 9

dists = [ni.model.pointprocess.createPoisson(frate,1000) for i in range(0,channels)]
#for i in range(0,9): dists[i].plotGaussed(10)
import itertools
spks = np.array([dists[i].getCounts() for i in range(0,channels) for j in range(0,99) ])
imshow(-1*spks)
set_cmap('gray')

Will generate:

(A plot of spikes)
_static/multichannel_spike_plot.png
ni.model.pointprocess.plotGaussed(np.array([dists[i].getCounts() for i in range(0,channels)]).mean(axis=0),20)
plot(dists[0].frate)
_static/multichannel_sum_gaussed.png
ni.model.pointprocess.getBinary(spikes, min_length=1)[source]

Gives back a binary array from an array of spike times. The maximum for each bin is 1.

ni.model.pointprocess.getCounts(spikes)[source]

Gives back an array of spike counts from an array of spike times. If the output is suppsed to be a Binomial, use getBinary instead.

ni.model.pointprocess.interspike_interval(spikes_a, spikes_b=False)[source]
ni.model.pointprocess.plotGaussed(data, width)[source]
p2 = ni.model.pointprocess.createPoisson(sin(numpy.array(range(0,200))*0.01)*0.5- 0.2,1000)
p2.plot()
p2.plotGaussed(10)
_static/p2_out.png
ni.model.pointprocess.plotMultiSpikes(spikes)[source]
  • spikes is a binary 2d matrix

Generates something like:

_static/plotMultiSpikes.png
ni.model.pointprocess.reverse_correlation(spikes_a, spikes_b=False)[source]

«  2. model Package   ::   Contents   ::   4. tools Package  »