INM-6 / python-neo

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
http://packages.python.org/neo/
BSD 3-Clause "New" or "Revised" License
3 stars 10 forks source link

Time Slice of AnalogSignal Array deals incorrectly with right (exclusive) border #16

Open mdenker opened 9 years ago

mdenker commented 9 years ago

In [3]: a=neo.AnalogSignalArray([1,2,3]*pq.mV,sampling_period=1*pq.ms)

In [4]: print a
[ 1.  2.  3.] mV

# This is correct
In [6]: a.time_slice(0*pq.ms,1*pq.ms)
Out[6]: 
AnalogSignalArray in 1.0 mV with 1 float64 values
channel index: None
sampling rate: 1.0 1/ms
time: 0.0 s to 0.001 s

# This is wrong: it should return an array of length 2 (for time points 0 ms and 1 ms)
In [7]: a.time_slice(0*pq.ms,1.1*pq.ms)
Out[7]: 
AnalogSignalArray in 1.0 mV with 1 float64 values
channel index: None
sampling rate: 1.0 1/ms
time: 0.0 s to 0.001 s

# This is correct
In [8]: a.time_slice(0*pq.ms,1.7*pq.ms)
Out[8]: 
AnalogSignalArray in 1.0 mV with 2 float64 values
channel index: None
sampling rate: 1.0 1/ms
time: 0.0 s to 0.002 s
mdenker commented 7 years ago

This is still an issue in Neo 0.5: It should be clarified how borders are defined.