NeuralEnsemble / python-neo

Neo is a package for representing electrophysiology data in Python, together with support for reading a wide range of neurophysiology file formats
http://neo.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
323 stars 248 forks source link

Why is the event channels header dtype is in bytes? #1525

Closed h-mayorquin closed 1 month ago

h-mayorquin commented 2 months ago

So here:

_event_channel_dtype = [
    ("name", "U64"),
    ("id", "U64"),
    ("type", "S5"),  <---- HERE ATTENTION THIS IS BYTES
]

https://github.com/NeuralEnsemble/python-neo/blob/315f485eb24c8d17aaebc5d6b56a336840913b66/neo/rawio/baserawio.py#L123-L127

I think this might bring problems down the line. Is this intentional? it seems to me that it should be strings and in fact in Plexon is extracted as a string and implicitly converted to bytes when the header is built.

zm711 commented 2 months ago

I think @samuelgarcia or maybe @JuliaSprenger would know. I'll also tag @apdavison in case he does. I have no clue why that would be the case...

samuelgarcia commented 2 months ago

I guess this is me but I do not remember. I need to read it again to refresh. Give a couple of days.

zm711 commented 1 month ago

Sam will comment on this shortly.

h-mayorquin commented 1 month ago

Ok, after personal discussion it seems it is unclear why it is this way. It seems that it was bytes so it could be generalized if the need arose.

We should be watchful because I think the assumption that people make is that those properties are strings or numeric types and it would not play as expected when writing it to other format (like json or nwb).

h-mayorquin commented 1 month ago

This for example, was changed in probeinterface because we could not serialize the bytes to json:

https://github.com/SpikeInterface/probeinterface/pull/159