You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behavior when rescaling a SpikeTrain changed in 0.7.0 proposed, and is now very counter-intuitive. The change surfaces in a number of tests in Elephant.
Behavior 0.5.2 (t_start and t_stop are rescaled accordingly):
In [1]: import quantities as pq
In [2]: import neo
In [3]: a=neo.SpikeTrain([1,2,3]*pq.ms,t_start=0*pq.s,t_stop=10*pq.h)
In [4]: b=a.rescale(pq.s)
In [5]: print b
[0.001 0.002 0.003] s
In [6]: print b.t_start
0.0 s
In [7]: print b.t_stop
36000.0 s
Behavior 0.7.0 (t_start and t_stop are rescaled to millisecond):
In [1]: import quantities as pq
In [2]: import neo
In [3]: a=neo.SpikeTrain([1,2,3]*pq.ms,t_start=0*pq.s,t_stop=10*pq.h)
In [4]: b=a.rescale(pq.s)
In [5]: print b
[0.001 0.002 0.003] s
In [6]: print b.t_start
0.0 ms
In [7]: print b.t_stop
36000000.0 ms
Further investigation yields that in 0.7 when rescaling the spiketrain, this calls the __new__ of a new Spiketrain instance, which in turn uses the dimensionality of the times property of the original object to set that of t_start and t_stop, i.e., if the spike train a above would have times in hourse, t_start in the new object would be in hours.
In 0.5.2, the rescale() method of Spiketrains has this code
Activity
mdenker commentedon Nov 27, 2018
Related to NeuralEnsemble/elephant#189
Fix and associated test for NeuralEnsemble#613
mdenker commentedon Nov 27, 2018
Further investigation yields that in 0.7 when rescaling the spiketrain, this calls the
__new__of a new Spiketrain instance, which in turn uses the dimensionality of thetimesproperty of the original object to set that oft_startandt_stop, i.e., if the spike trainaabove would have times in hourse,t_startin the new object would be in hours.In 0.5.2, the
rescale()method of Spiketrains has this codethat is replaced in 0.7.0 by
The 0.7.0 version is simpler and nicer, but there must be something in the 0.5.2 version we should put back in -- I just don't see what yet...
apdavison commentedon Nov 27, 2018
see #614
mdenker commentedon Nov 27, 2018
@apdavison Great, that is a simple solution to solve the issue, and also helps with Elephant's unit tests
Merge pull request #614 from apdavison/issue613
samuelgarcia commentedon Nov 27, 2018
close by #614