Repository navigation
MRG ADD set_channels_type function RM parts from rename_channels - #1932
Conversation
1880943 to
4f64db5
Compare
|
does this break any existing code? |
|
partly. rename_channels is fine for the renaming, but I removed the tuple -teon On Tue, Apr 7, 2015 at 12:45 AM, Alexandre Gramfort <
|
|
yes we need to deprecate ...
this feature should end up in a FAQ soon...
|
5d92381 to
f9458e5
Compare
|
A proper deprecation warning is given and now it does not break any existing code. |
There was a problem hiding this comment.
Is this all we need? What about the units field? My gut feeling tells me this is incomplete.
There was a problem hiding this comment.
I can include it and any other fields. I just extracted the part of the
sensor type renaming that was part of the rename_channels. Can you think of
any other fields that might be useful to consider?
-teon
On Tue, Apr 7, 2015 at 2:55 PM, Denis A. Engemann [email protected]
wrote:
In mne/channels/channels.py
#1932 (comment):
'syst': FIFF.FIFFV_SYST_CH}
- ch_names = info['ch_names']
first check and assemble clean mappings of index and name
- for ch_name, ch_type in mapping.items():
if ch_name not in ch_names:raise ValueError("This channel name (%s) doesn't exist in info."% ch_name)
c_ind = ch_names.index(ch_name)if ch_type not in human2fiff:raise ValueError('This function cannot change to this ''channel type: %s.' % ch_type)Set sensor type
info['chs'][c_ind]['kind'] = human2fiff[ch_type]Is this all we need? What about the units field? My gut feeling tells me
this is incomplete.—
Reply to this email directly or view it on GitHub
https://github.com/mne-tools/mne-python/pull/1932/files#r27874459.
There was a problem hiding this comment.
I think that's it. We have a different function for setting positions.
There was a problem hiding this comment.
also, I went through and listed all possible ch types. I didn't see a
reason to restrict which one could be used.
-teon
On Tue, Apr 7, 2015 at 3:05 PM, Denis A. Engemann [email protected]
wrote:
In mne/channels/channels.py
#1932 (comment):
'syst': FIFF.FIFFV_SYST_CH}
- ch_names = info['ch_names']
first check and assemble clean mappings of index and name
- for ch_name, ch_type in mapping.items():
if ch_name not in ch_names:raise ValueError("This channel name (%s) doesn't exist in info."% ch_name)
c_ind = ch_names.index(ch_name)if ch_type not in human2fiff:raise ValueError('This function cannot change to this ''channel type: %s.' % ch_type)Set sensor type
info['chs'][c_ind]['kind'] = human2fiff[ch_type]I think that's it. We have a different function for setting positions.
—
Reply to this email directly or view it on GitHub
https://github.com/mne-tools/mne-python/pull/1932/files#r27875156.
There was a problem hiding this comment.
I'm not sure I can follow you. What do you mean?
There was a problem hiding this comment.
if you look at the human2fiff dict, I listed all the possible channel types. Before in the rename_channels, you weren't able to rename to EEG, now, you're able to change to any channel type.
There was a problem hiding this comment.
Ah ok yes! So we can also map those types to physical units. Then we're good I think.
8eff861 to
8f800f6
Compare
|
There will be a lot more to define as well. The coil geometry (plus how detailed it is: some coils have more precision to their geometry measurements, which MNE takes advantage of). It may be easier to break it into parts and add them one PR at a time. Like next add the ability for EEG adding to dig |
But this is all stored in lookup files, if you point the constants to the right system type the MNE internals will take care of the detailed mapping. I don't see this function as a way to setup new coil types from scratch. |
|
Why would you ever need to change the type of the sensors, it is in your file? Changing the type from a mag to a grad for example is crazy dangerous if you aren't going in and updating all those fields? In that case it isn't defining a sensor at all (read the name is wrong). |
|
I think the idea here is to have function for what we otherwise do manually in our source code, whenever we read in files from non Neuromag systems. |
|
Right, but then it should be some sort of lookup function for those data types, with safety checks. |
|
Maybe we should just keep this function private for now. |
|
it's useful for non-meg sensors. when reading eeg, everything is assumed -teon On Tue, Apr 7, 2015 at 6:06 PM, Denis A. Engemann [email protected]
|
|
@teonlamont then make a public restricted interface and a power ful private function that can replace and unify existing io conversion code. |
|
+1 -teon On Tue, Apr 7, 2015 at 6:16 PM, Denis A. Engemann [email protected]
|
|
@dengemann I will do the private interface in a separate pr. |
|
to me the common usecase is when:
- you mark an EOG as EEG or vice versa
- you mark an EOG as ECG or EEG or vice versa
- you mark an sEEG as EEG or vice versa
we should focus this + allowing to change the channel names.
The MEG channels are almost never badly marked as they never change.
my 2c
|
ENH define_sensor --> set_channel_type
109b19e to
ff9e391
Compare
5b904d0 to
f0ac262
Compare
|
I think it's ready now |
|
@teonlamont I actually have problems with |
|
FYI @teonlamont even with my |
|
I don't know if docs render properly, but they render okay. I'll open an issue. |
MRG ADD set_channels_type function RM parts from rename_channels
|
Thanks for your patience @teonlamont |
|
ah, I didn't realize you use the make command, I was using |
|
Weird, I don't know why |
|
here's the traceback I get: |
|
Ahh, so you get it from sphinx->pygments->pyface, I get it from Mayavi somehow. Bummer. |
|
I think I have the same error. If @teonlamont or @Eric89GXL figure out how to solve this, do let me know. |
Currently this removes the tuple ability to resign channel type from rename_channels.
This functionality has been moved to the
define_sensorsfunction.addresses issue #1909