Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

correlograms with swapped indices are not mirrored versions of each other

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

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

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

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.

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

Dominant language
Python
Stars
855
Forks
280
Avg merge
3d 7h
Merged PRs (30d)
40

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from SpikeInterface/spikeinterface

All issues in SpikeInterface/spikeinterface

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.