diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2015-12-14 17:25:53 +0100 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2015-12-14 17:25:53 +0100 |
commit | f7b90618f01d4dbf015b3d21c6c06dec8d26bd9f (patch) | |
tree | 799a2fa0e0f7558ece400de15ca8d1358565c066 /pyspike/SpikeTrain.py | |
parent | d985f3a8de6ae840c8a127653b3d9affb1a8aa40 (diff) | |
parent | 9061f2a0c13134e53f937d730295a421fd671ea3 (diff) |
Merge pull request #20 from mariomulansky/develop
Develop merge for version 0.4
Diffstat (limited to 'pyspike/SpikeTrain.py')
-rw-r--r-- | pyspike/SpikeTrain.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/pyspike/SpikeTrain.py b/pyspike/SpikeTrain.py index 9127b60..4b59a5d 100644 --- a/pyspike/SpikeTrain.py +++ b/pyspike/SpikeTrain.py @@ -32,6 +32,21 @@ class SpikeTrain(object): self.t_start = 0.0 self.t_end = float(edges) + def __getitem__(self, index): + """ Returns the time of the spike given by index. + + :param index: Index of the spike. + :return: spike time. + """ + return self.spikes[index] + + def __len__(self): + """ Returns the number of spikes. + + :return: Number of spikes. + """ + return len(self.spikes) + def sort(self): """ Sorts the spike times of this spike train using `np.sort` """ |