Skip to content

Commit

Permalink
Merge branch 'master' into add_signal_buffer_id
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 authored Oct 11, 2024
2 parents a3bac2a + 293f35a commit fee1537
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ grant agreement FETPI-015879 (FACETS), by the European Union Seventh Framework P
under grant agreements no. 269921 (BrainScaleS) and no. 604102 (HBP),
and by the European Union’s Horizon 2020 Framework Programme for
Research and Innovation under the Specific Grant Agreements No. 720270 (Human Brain Project SGA1),
No. 785907 (Human Brain Project SGA2) and No. 945539 (Human Brain Project SGA3).
No. 785907 (Human Brain Project SGA2) and No. 945539 (Human Brain Project SGA3),
and by the European Union's Research and Innovation Program Horizon Europe Grant Agreement No. 101147319 (EBRAINS 2.0).

.. _OpenElectrophy: https://github.com/OpenElectrophy/OpenElectrophy
.. _Elephant: http://neuralensemble.org/elephant
Expand Down
19 changes: 18 additions & 1 deletion neo/io/igorproio.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,24 @@ def _wave_to_analogsignal(self, content, dirpath):
header = content["wave_header"]
name = str(header["bname"].decode("utf-8"))
units = "".join([x.decode() for x in header["dataUnits"]])
time_units = "".join([x.decode() for x in header["xUnits"]])
if "xUnits" in header:
# "xUnits" is used in Versions 1, 2, 3 of .pxp files
time_units = "".join([x.decode() for x in header["xUnits"]])
elif "dimUnits" in header:
# Version 5 uses "dimUnits"
# see https://github.com/AFM-analysis/igor2/blob/43fccf51714661fb96372e8119c59e17ce01f683/igor2/binarywave.py#L501
_time_unit_structure = header["dimUnits"].ravel()
# For the files we've seen so far, the first element of _time_unit_structure contains the units.
# If someone has a file for which this assumption does not hold an Exception will be raised.
if not all([element == b'' for element in _time_unit_structure[1:]]):
raise Exception(
"Neo cannot yet handle the units in this file. "
"Please create a new issue in the Neo issue tracker at "
"https://github.com/NeuralEnsemble/python-neo/issues/new/choose"
)
time_units = _time_unit_structure[0].decode()
else:
time_units = ""
if len(time_units) == 0:
time_units = "s"
try:
Expand Down

0 comments on commit fee1537

Please sign in to comment.