Skip to content

correlograms with swapped indices are not mirrored versions of each other #4576

@saikoukunt

Description

@saikoukunt

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions