SpikeInterface / SpikeInterface/spikeinterface

correlograms with swapped indices are not mirrored versions of each other

Open
#4,576 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
847
Forks
280
Avg merge
3d 9h
Merged PRs (30d)
29

Description

For correlograms computed with either sorting_analyzer.compute("correlograms") or postprocessing.compute_correlograms, correlograms[i, j, :] != correlograms[j, i, ::-1]. For both functions, ccgs were recomputed on saved SortingAnalyzers with SpikeInterface 0.104.0.

I assume this is some sort of artifact of how ccg events are assigned to bins, but the documentation for the compute_correlograms function says that the equality should be satisfied. I used the code below to test both functions with 4 different recordings, for all recordings 90+% of cross-correlograms were not perfect mirrors.

count = 0
max_diff = 0
max_diff_inds = None
for i in range(correlograms.shape[0]):
    for j in range(i, correlograms.shape[0]):
        if not (np.array_equal(correlograms[i, j],correlograms[j, i, ::-1])):
            print(i, j, np.abs(correlograms[i, j] - correlograms[j, i, ::-1]).max())
            count += 1
            if max_diff <  np.abs(correlograms[i, j] - correlograms[j, i, ::-1]).max():
                max_diff_inds = (i, j)
                max_diff = np.abs(correlograms[i, j] - correlograms[j, i, ::-1]).max()


print(count/(correlograms.shape[0]*(correlograms.shape[0]-1)/2))
print(max_diff, max_diff_inds)

Most of the differences are small (1-5 maximum difference between bins across a ccg), but for some unit pairs it can be quite large (see below)

correlograms[71, 97]
Image

correlograms[97, 71]
Image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the sorting_analyzer.compute("correlograms") and postprocessing.compute_correlograms entry points, then reproduce the supplied symmetry check on a saved SortingAnalyzer with SpikeInterface 0.104.0. Inspect how CCG events are assigned to bins and compare swapped-index results. Done means the documented mirrored relationship holds, or the documentation accurately describes the observed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.