-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alpha kernel is not starting at zero #107
Comments
found in if not trim:
r = r[kernel.median_index(t_arr):-(kernel(t_arr).size -
kernel.median_index(t_arr))] what is the reason for this line? |
This is an interesting use of instantaneous_rate with a non-symmetric kernel that I had not thought of. Indeed, this plot looks a bit strange at first. As you point out, the asymmetric kernel itself is not centered, but is 0 for x<0, and the centering is only performed by the In your example, I assume you would like to have the alpha kernel starting at the spike time, e.g., to obtain something like an EPSP after the spike? In this case, one could either introduce a parameter like |
No not really, just normal firing rate estimation, but I chose an asymmetric kernel starting at |
Ah, ok, now I get it. I have created a branch with a potential fix at I think that this works correctly for all combinations of True/False for import elephant as ele
import scipy as sp
import matplotlib.pyplot as plt
import quantities as pq
reload(elephant.statistics)
st = neo.SpikeTrain([3]*pq.s,t_start=0*pq.s,t_stop=10*pq.s)
kernel = ele.kernels.AlphaKernel(200*pq.ms)
fs = 0.1 * pq.ms
asig = ele.statistics.instantaneous_rate(st,t_start=st.t_start,t_stop=st.t_stop,sampling_period=fs,kernel=kernel,trim=True,center_kernel=True)
plt.plot(asig.times.rescale(pq.s),asig)
[plt.axvline(t) for t in st.times]
plt.show() Could you please have a look if this addresses your issue? If so, I would PR this to the main branch (and write a short unit test for it). |
This looks fine. Thank you very much! |
I just stumbled over this - again. And then I found my bug report from a few years ago. As it seems, it was fixed, but now I get
was this never merged into the main branch, and the bugfix got lost? |
I'd love to see the |
@jpgill86 very cool, thank you for posting this workaround |
I'll work on the issue in conjunction with #288. |
|
Contrary to the definition in the docs, the alpha kernel does not start with non-negative values only after
t = 0
in elephant0.4.1
.to demonstrate
produces
edit: which is almost the median (not exactly probably the kernel never decays back to zero). I looked at the
AlphaKernel
class inkernels.py
and it looks fine, is there some median centering of the kernel going on somewhere else, that might need to be disabled?The text was updated successfully, but these errors were encountered: