bids-standard / pybv

A lightweight I/O utility for the BrainVision data format, written in Python.

Home Page:https://pybv.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Currently no support for commas in channel names, event types, and event descriptions

sappelhoff opened this issue · comments

Looking at the first line of this code snippet, we see that "commas in channel names are coded as \1"

pybv/pybv/io.py

Lines 269 to 281 in 76e8bea

print(r'; Commas in channel names are coded as "\1".', file=fout)
nchan = len(ch_names)
# broadcast to nchan elements if necessary
resolutions = resolution * np.ones((nchan,))
units = [unit] * nchan
for i in range(nchan):
resolution, unit = _optimize_channel_unit(resolutions[i], units[i])
s = r'Ch{}={},,{:0.{precision}f},{}'
print(s.format(i + 1, ch_names[i], resolution, unit,
precision=max(0, int(np.log10(1 / resolution)))),
file=fout)

However, we do not perform this coding ... we simply take a list of channels and print them to the vhdr as they are.

This can lead to bugs and should be fixed.

We also need to fix this for event types and descriptions:

pybv/pybv/io.py

Line 194 in 54da125

print(r'; Commas in type or description text are coded as "\1".', file=fout) # noqa: E501