Skip to content
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

binningMode = 'SUM' does not work as it's supposed to #95

Open
ronichester opened this issue Jan 19, 2023 · 1 comment
Open

binningMode = 'SUM' does not work as it's supposed to #95

ronichester opened this issue Jan 19, 2023 · 1 comment

Comments

@ronichester
Copy link

in spikeFileIO.py, the following lines have the same effect as binningMode = 'OR' :

elif binningMode.upper() == 'SUM':
				emptyTensor[pEvent[validInd], 
							yEvent[validInd],
							xEvent[validInd],
							tEvent[validInd]] += 1/samplingTime

That is because += 1 in this case does not work, I believe it's a bug in your code.
The idea is to sum the number of spikes on the same pixel in the same time window, but the way it's written it does not sum; i did many tests myself.
In order to work as expected, the code should be something like this:

elif binningMode.upper() == 'SUM':
    for p,y,x,t in zip(pEvent[validInd], yEvent[validInd], xEvent[validInd], tEvent[validInd]):
                    emptyTensor[p,y,x,t] += 1/samplingTime

This implementation is terribly NOT efficient (up to the point it is unfeasible) but it works as expected.
I can't think of a clever way to use the np.array characteristics to make it work efficiently; any ideas?

The point is, in my opinion, the way the code is written now, binning mode OR = binning mode SUM, and I am sure it was not supposed to be this way.

Cheers,

@bamsumit
Copy link
Owner

Hi @ronichester, yes it looks like a bug. Your snippet is correct. Will you be willing to issue a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants