mariomulansky / PySpike

Python implementation of spike distance metrics
http://mariomulansky.github.io/PySpike
Other
71 stars 30 forks source link

Incorrect integral for PieceWiseConstFunc with interval over "flat" values #33

Closed jonathanjouty closed 6 years ago

jonathanjouty commented 6 years ago

I think I found a bug in the PieceWiseConstFunc.integral implementation. This appears to happen when the interval is a "flat" region of the piece-wise constant function.

In the following screenshot, the plot is via get_plottable_data and profile is a PieceWiseConstFunc: screen shot 2018-05-10 at 15 35 04

As you can see the integrals over specific intervals add up correctly when done over part of the profile which is "not flat", though as soon as you take an interval over a "flat" part (~2300-2500 ms in this example) the total is wrong. Furthermore, from the graph you would expect the interval over that region to be ~24, but it gives ~77.

jonathanjouty commented 6 years ago

Should be fixed by #36.