Skip to content

Commit

Permalink
ENH: add microsecond format support in read_raw_snirf (mne-tools#11804)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel McCloy <[email protected]>
  • Loading branch information
Xiezhibin and drammock authored Jul 19, 2023
1 parent 1b4f6ff commit 9b3a4d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Bugs
- Fix bug that required curv.*h files to create Brain object (:gh:`11704` by :newcontrib:`Aaron Earle-Richardson`)
- Extended test to highlight bug in :func:`mne.stats.permutation_t_test` (:gh:`11575` by :newcontrib:`Joshua Calder-Travis`)
- Fix bug that used wrong indices for line/label styles (sometimes causing an ``IndexError``) in :meth:`mne.preprocessing.ICA.plot_sources` under certain conditions (:gh:`11808` by :newcontrib:`Joshua Calder-Travis`)
- Fix bug with :func:`~mne.io.read_raw_snirf` to handle files with measurement time containing milliseconds (:gh:`11804` by :newcontrib:`Daniel Tse`)
- Fix bug where :meth:`mne.viz.Brain.add_volume_labels` used an incorrect orientation (:gh:`11730` by `Alex Rockhill`_)
- Fix bug with :func:`mne.forward.restrict_forward_to_label` where cortical patch information was not adjusted (:gh:`11694` by `Eric Larson`_)
- Fix bug with PySide6 compatibility (:gh:`11721` by `Eric Larson`_)
Expand Down
2 changes: 2 additions & 0 deletions doc/changes/names.inc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@
.. _Daniel Strohmeier: https://github.com/joewalter
.. _Daniel Tse: https://github.com/Xiezhibin
.. _Darin Erat Sleiter: https://github.com/dsleiter
.. _David Haslacher: https://github.com/davidhaslacher
Expand Down
7 changes: 6 additions & 1 deletion mne/io/snirf/_snirf.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,12 @@ def natural_keys(text):
str_datetime = str_date + str_time

# Several formats have been observed so we try each in turn
for dt_code in ["%Y-%m-%d%H:%M:%SZ", "%Y-%m-%d%H:%M:%S"]:
for dt_code in [
"%Y-%m-%d%H:%M:%SZ",
"%Y-%m-%d%H:%M:%S",
"%Y-%m-%d%H:%M:%S.%f",
"%Y-%m-%d%H:%M:%S.%f%z",
]:
try:
meas_date = datetime.datetime.strptime(str_datetime, dt_code)
except ValueError:
Expand Down

0 comments on commit 9b3a4d3

Please sign in to comment.