Add the ProbeGroup._global_contact_order concept.#446
Conversation
|
Thanks camarade. Can you fix tests? |
…into group_order # Conflicts: # src/probeinterface/probegroup.py
for more information, see https://pre-commit.ci
Co-authored-by: Alessio Buccino <alejoe9187@gmail.com>
|
A clarification. I don't think my PR #425 here in probeinterface is superseded by this. Not that I am attached to keeping it, but to be clear: that PR is about providing a small dense representation so people can index on it in an array-like way to fetch properties. That is the full goal of it. In a nutshell, the full numpy representation is too much; let's provide a small surface area, commensurate with what SpikeInterface needs, that achieves that goal. Now regarding this PR. The idea of having a way of preserving the order through Some small comments:
One big problem that I would like to point out: To avoid the pattern above, |
#416 added a get_slices() at ProbeGroup level but this PR has enhanced after long debates and discussions the fact that the ProbeGroup has a strong problem : the order of contact with to_numpy()/from_numpy() or to_dict()/form_dict() can be lost!
This can append when contact of sevral Probe are interleaved. This was not possible before but given the
Probegrorup.get_slice()contacts of several can be interleaved!This PR add the hidden concept of
ProbeGroup._global_contact_order.pg2 = ProbeGroup.from_numpy(pg1.to_numpy(complete=True))to maintain any abritory orderpg2 = ProbeGroup.from_dict(pg1.to_dict())to maintain any abritory orderThe get_slice is now on top of to_numpy() after the ordering.
This PR is validated:
and garanty fancy ordering.
Important note: the
_global_contact_orderis NOT theglobal_device_channel_indices. It can be any order.(Even if the main use case is to order by global_device_channel_indices on spikeinterface side).
In short, this PR garanty the order after the json write/read.
@alejoe91 @chrishalcrow @h-mayorquin
Test need to be done after validation.