-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Don't require specific order for fNIRS #10642
Conversation
Okay @rob-luke I think this one is ready. I still think we could do some better refactoring of |
Wow!! That was quick @larsoner I'm currently in transit to the US and won't be able to review this for a few days. When's the 1.1 release scheduled for? I'd love to review, but will I be holding things up? |
Tentatively the end of the month but we haven't really discussed it, so this week or next should work! |
Argh I removed a bunch of the |
@rob-luke this one is good to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is amazing @larsoner, thanks for tackling this.
Something we will want to support in the future is NIRS data with more than two frequencies of light. This is beyond the scope of this PR. But I wanted to raise it in advance incase it would change any of your design decisions here. I read the code with this in mind and nothing appears to block future extension.
With this PR can we now remove the following documentation?
mne-python/tutorials/io/30_reading_fnirs_data.py
Lines 28 to 35 in 5bddef8
.. note:: To provide a consistent interface across different measurement | |
devices and file types, MNE-Python uses a standard ordering of | |
channels. MNE-Python internally orders channels by ascending source | |
number. When there are multiple channels with the same source number, | |
they are ordered by ascending detector number. The ordering of | |
channels is done automatically when data is imported. Therefore, | |
the ordering of channels within MNE-Python may be different to what | |
was provided by the hardware vendor. |
mne-python/tutorials/io/30_reading_fnirs_data.py
Lines 189 to 197 in 5bddef8
# .. warning:: The channels must be ordered in haemoglobin pairs, such that for | |
# a single channel all the types are in subsequent indices. The | |
# type order must be 'hbo' then 'hbr'. | |
# The data below is already in the correct order and may be | |
# used as a template for how data must be stored. | |
# If the order that your data is stored is different to the | |
# mandatory formatting, then you must first read the data with | |
# channel naming according to the data structure, then reorder | |
# the channels to match the required format. |
mne/preprocessing/nirs/nirs.py
Outdated
@@ -59,19 +59,16 @@ def short_channels(info, threshold=0.01): | |||
return source_detector_distances(info) < threshold | |||
|
|||
|
|||
def _channel_frequencies(info, nominal=False): | |||
def _channel_frequencies(info, *, throw_errors=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This argument is introduced but not used. I assume it is from an earlier implementation version and should be removed?
def _channel_frequencies(info, *, throw_errors=True): | |
def _channel_frequencies(info, *): |
I think in the long term we should abandon the channel-name-based stuff altogether. It occurred to me while making this PR that we currently only use 9 entries in But yes I think this is future compatible in the sense that this moves us toward one centralized place where pairings are identified and returned in a way that you can just operate on I'll push a commit to hopefully take care of the above comments then merge when green! |
Not enough sleep this weekend apparently... we already store the frequency, so maybe my next PR should be this automatic pairing based on |
In it goes, thanks for the quick review @rob-luke ! There might be some adjustments necessary at the MNE-NIRS end, do you have time to look there? |
I do, will do today. On another note @larsoner, NIRx have changed the way they store triggers in their latest software version. I have been sent a file with their new format. I will open a PR today for this too, so that we can get this in for 1.1. |
zip(picks[::2], picks[1::2])
_check_channels_ordered
to returnpicks
even if they aren't in matched pairscc @rob-luke I'll ping you when this is ready to go