""" Module containing the class representing spike trains for PySpike. Copyright 2015, Mario Mulansky Distributed under the BSD License """ import numpy as np class SpikeTrain(object): """ Class representing spike trains for the PySpike Module.""" def __init__(self, spike_times, edges): """ Constructs the SpikeTrain :param spike_times: ordered array of spike times. :param edges: The edges of the spike train. Given as a pair of floats (T0, T1) or a single float T1, where then T0=0 is assumed. """ # TODO: sanity checks self.spikes = np.array(spike_times, dtype=float) try: self.t_start = float(edges[0]) self.t_end = float(edges[1]) except: self.t_start = 0.0 self.t_end = float(edges)