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
{{ message }}
Repository navigation
Numpy and Numba do not give exactly the same output in unit test environment #2990
they are very similar, but there are a few discrepancies. The implementations are a little different and are doing more than I anticipated, my from niave perspective I thought they would be cross-correlations of binarized data (1 x num samples per unit spiketrain) where 1 is a spike sample and 0 is a non-spike sample. I guess this would be extremely memory hungry as compared to these much more efficient implementations. @samuelgarcia@DradeAW should be able to comment further. Additionally, would it be possible to extend the docstrings in the correlograms.py, with an overview of what the algorithms are doing / why, and Parameters section that indicates the type / shape of the variables? It would be great as would make working with this modules much easier / faster.
The old implementation in numpy a modifiyed version from Cyril Rossant. This one is not totally accurate.
The one implementated in numba done by Aurelien is more accurate and faster but need numba this is why we kept the old one.
When refactoring theses 2 functions a while ago I really wanted then to give the exact same result but finally gave up because it is impossible The reason is corners cases and rounding around the central bin. I do not remember exactly the details.
This is why I think I commented out this test.
Activity
h-mayorquin commentedon Jun 6, 2024
Does this
assert np.all(correlograms == ref_correlograms)still fail if you use np.allclose like in the last line?JoeZiminski commentedon Jun 7, 2024
Unfortunately not, the values are integer (I guess performing cross-correlations on binary arrays where 1 indicates a spike). For example I get:
ref_correlogram:
vs correlogram:
they are very similar, but there are a few discrepancies. The implementations are a little different and are doing more than I anticipated, my from niave perspective I thought they would be cross-correlations of binarized data (1 x num samples per unit spiketrain) where 1 is a spike sample and 0 is a non-spike sample. I guess this would be extremely memory hungry as compared to these much more efficient implementations. @samuelgarcia @DradeAW should be able to comment further. Additionally, would it be possible to extend the docstrings in the
correlograms.py, with an overview of what the algorithms are doing / why, andParameterssection that indicates the type / shape of the variables? It would be great as would make working with this modules much easier / faster.samuelgarcia commentedon Jun 7, 2024
The old implementation in numpy a modifiyed version from Cyril Rossant. This one is not totally accurate.
The one implementated in numba done by Aurelien is more accurate and faster but need numba this is why we kept the old one.
When refactoring theses 2 functions a while ago I really wanted then to give the exact same result but finally gave up because it is impossible The reason is corners cases and rounding around the central bin. I do not remember exactly the details.
This is why I think I commented out this test.