Skip to content

Commit fee1537

Browse files
authored
Merge branch 'master' into add_signal_buffer_id
2 parents a3bac2a + 293f35a commit fee1537

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ grant agreement FETPI-015879 (FACETS), by the European Union Seventh Framework P
6464
under grant agreements no. 269921 (BrainScaleS) and no. 604102 (HBP),
6565
and by the European Union’s Horizon 2020 Framework Programme for
6666
Research and Innovation under the Specific Grant Agreements No. 720270 (Human Brain Project SGA1),
67-
No. 785907 (Human Brain Project SGA2) and No. 945539 (Human Brain Project SGA3).
67+
No. 785907 (Human Brain Project SGA2) and No. 945539 (Human Brain Project SGA3),
68+
and by the European Union's Research and Innovation Program Horizon Europe Grant Agreement No. 101147319 (EBRAINS 2.0).
6869

6970
.. _OpenElectrophy: https://github.com/OpenElectrophy/OpenElectrophy
7071
.. _Elephant: http://neuralensemble.org/elephant

neo/io/igorproio.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,24 @@ def _wave_to_analogsignal(self, content, dirpath):
133133
header = content["wave_header"]
134134
name = str(header["bname"].decode("utf-8"))
135135
units = "".join([x.decode() for x in header["dataUnits"]])
136-
time_units = "".join([x.decode() for x in header["xUnits"]])
136+
if "xUnits" in header:
137+
# "xUnits" is used in Versions 1, 2, 3 of .pxp files
138+
time_units = "".join([x.decode() for x in header["xUnits"]])
139+
elif "dimUnits" in header:
140+
# Version 5 uses "dimUnits"
141+
# see https://github.com/AFM-analysis/igor2/blob/43fccf51714661fb96372e8119c59e17ce01f683/igor2/binarywave.py#L501
142+
_time_unit_structure = header["dimUnits"].ravel()
143+
# For the files we've seen so far, the first element of _time_unit_structure contains the units.
144+
# If someone has a file for which this assumption does not hold an Exception will be raised.
145+
if not all([element == b'' for element in _time_unit_structure[1:]]):
146+
raise Exception(
147+
"Neo cannot yet handle the units in this file. "
148+
"Please create a new issue in the Neo issue tracker at "
149+
"https://github.com/NeuralEnsemble/python-neo/issues/new/choose"
150+
)
151+
time_units = _time_unit_structure[0].decode()
152+
else:
153+
time_units = ""
137154
if len(time_units) == 0:
138155
time_units = "s"
139156
try:

0 commit comments

Comments
 (0)