# Conforming to Montage Deprecations

**URL:** <https://mne.discourse.group/t/conforming-to-montage-deprecations/2034>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [December 27, 2019, 3:33am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034 "2019-12-27T03:33:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 27, 2019, 3:33am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/1 "2019-12-27T03:33:48Z")

</div>

External Email - Use Caution

Happy Holidays MNE Team,

I am trying to conform to the new deprecation that has occurred in developer version 0.19 concerning the montage. My input file is a Neuroscan (.cnt) file extension type and thus my script previously read `mne.io.read_raw_cnt(fname, montage=?standard_1020?, etc ?)`. However, I have migrated this to a separate command `mne.channels.make_standard_montage(kind=?standard_1020)`. When doing this it skews my X,Y,Z locations. For example, when I pass `print(raw.info[?chs?])` my FP1 EEG electrode location is skewed from

`?loc?: array([-0.0294367, 0.0839171, -0.00699, 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0. , 0.])`

to

`?loc?: array([-0.20257819, 0.21764863, 0.95477283, nan, nan,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan, nan, nan, nan, nan,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan, nan]).

Furthermore, when I input `print(raw.info)` the previous code output under `dig : list | 26 items (3 cardinal, 23 EEG)` while the latter code displays NoneType in the `dig`. While this seems like it would be a straight-forward change, it is definitely not as easy in practice. Is there any reason that it is not reading my montage as a standard\_1020 anymore?

Thank you for any assistance provided,  
Bianca Islas  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20191226/1be65c34/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191226/1be65c34/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 27, 2019, 7:35am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/2 "2019-12-27T07:35:05Z")

</div>

External Email - Use Caution

hi Bianca,

are you doing:

raw = mne.io.read\_raw\_cnt(fname)  
montage = mne.channels.make\_standard\_montage(kind=?standard\_1020)  
raw.set\_montage(montage)

?

this should set the chs and the dig.

the reason we have changed this is that we want to make sure that the channel  
locations are can considered to be in head coordinate system so you can relate  
them to fsaverage for example. Is the shrinking problematic for you?

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 27, 2019, 7:58am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/3 "2019-12-27T07:58:01Z")

</div>

External Email - Use Caution

When I implement the changes this way, I get a ValueError that reads:  
?DigMontage is a only a subset of info. There are 7 channel positions not present it the DigMontage. The required channels are: {'FP1', 'OZ', 'FZ', 'FP2', 'PZ', 'CZ', 'FPZ'}. You can use `raise_if_subset=False` in `set_montage` to avoid this ValueError and get a DeprecationWarning instead.?

If I do as suggested above I do not get an error I get an output of what which channels will be ignored and a warning that reads:  
?Reading 0 ... 2552079 = 0.000 ... 1276.040 secs...

\<ipython-input-12-e47b0d549095\>:8: RuntimeWarning: Could not parse meas date from the header. Setting to None.  
&nbsp;&nbsp;data\_format='int32', date\_format='mm/dd/yy', preload=True, verbose='debug')

DigMontage is a superset of info. 78 in DigMontage will be ignored. The ignored channels are: {'T5', 'Oz', 'C5', 'PO9', 'AF1', 'PO3', 'AF4', 'F1', 'FC4', 'CP3', 'AF6', 'FC6', 'Fz', 'Cz', 'CP5', 'TP7', 'FC3', 'AF8', 'T10', 'P10', 'FT7', 'P6', 'T3', 'TP10', 'PO1', 'AF5', 'P5', 'Iz', 'FC5', 'TP9', 'POz', 'FC2', 'PO8', 'AF3', 'AF10', 'CP2', 'T9', 'PO4', 'PO2', 'FT10', 'P2', 'T6', 'AF7', 'AF9', 'C6', 'A2', 'PO5', 'PO6', 'F6', 'A1', 'P1', 'F10', 'Fp2', 'C2', 'FT8', 'F5', 'AF2', 'P9', 'FCz', 'O9', 'CP4', 'Fp1', 'PO7', 'PO10', 'C1', 'F9', 'CP1', 'O10', 'FT9', 'CP6', 'TP8', 'F2', 'T4', 'CPz', 'Pz', 'AFz', 'Fpz', 'FC1'}

\<ipython-input-12-e47b0d549095\>:13: RuntimeWarning: DigMontage is a only a subset of info. Did not set 7 channel positions:  
FP1, OZ, FZ, FP2, PZ, CZ, FPZ  
&nbsp;&nbsp;raw.set\_montage(montage, raise\_if\_subset=False)

Out[12]:  
\<RawCNT | st003\_PAMR\_s1079\_20080319.cnt, n\_channels x n\_times : 38 x 2552080 (1276.0 sec), ~740.0 MB, data loaded\>?

This is very problematic as I am only supposed to have 23 EEG, 5 EMG, 2 EOG, 1ECG, 2 MISC (skin conductance), and 1 Stim channel.

- Bianca

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 28, 2019, 3:37am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/4 "2019-12-28T03:37:51Z")

</div>

External Email - Use Caution

It looks like our standard\_1020 names follow a different capitalization  
pattern:

[https://github.com/mne-tools/mne-python/blob/master/mne/channels/data/montages/standard\_1020.elc#L107](https://github.com/mne-tools/mne-python/blob/master/mne/channels/data/montages/standard_1020.elc#L107)

So if you do something like:

raw.rename\_channels(lambda x: x.lower().capitalize())

Or go the direct dictionary route:

raw.rename\_channels(dict(FP1='Fp1', OZ='Oz', FZ='Fz', FP2='Fp2', PZ='Pz',  
CZ='Cz', FPZ='Fpz'))

Some variant like this should allow not having the warning without needing  
to pass `raise_if_subset=False`. And if you have channels that are actually  
not EEG, make sure to do raw.set\_channel\_types  
\<[https://mne.tools/dev/generated/mne.io.Raw.html#mne.io.Raw.set\_channel\_types](https://mne.tools/dev/generated/mne.io.Raw.html#mne.io.Raw.set_channel_types)\>  
to set them to the correct channel types.

As for the channel count mismatch, what extra channels are in raw.ch\_names  
that you don't expect to be there? Does raw.plot() look reasonable?

Eric

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 28, 2019, 5:19am UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/5 "2019-12-28T05:19:28Z")

</div>

External Email - Use Caution

When I input `print(raw.ch_names)` before I would get the right channels regardless of capitalization, oddly enough. Although further on in the script it now makes sense that when I would try to do averaging it was telling me that it did not recognize ?FP1? as a channel. So, thank you very much Eric, for pointing this difference out. After migrating the code to the suggested commands the montage went from this:

To this:

The channel count is accurate now, and the raw.plot output looks exactly as it did before. As for the specifics, when I print(raw.info[?chs?]) to troubleshoot location it is still off but only by thousandths for the y-axis and hundredths in the y and z axes. Is this a by-product of the aforementioned ?shrinking? mentioned before?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [December 28, 2019, 9:33pm UTC](https://mne.discourse.group/t/conforming-to-montage-deprecations/2034/6 "2019-12-28T21:33:38Z")

</div>

External Email - Use Caution

The channel positions might differ a bit because of a slightly different  
`head_size` parameter of make\_standard\_montage, or because we now properly  
transform the channel positions to head coordinates (defined by LPA,  
Nasion, and RPA).

Eric

> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution
> 
> When I input `print(raw.ch_names)` before I would get the right channels  
> regardless of capitalization, oddly enough. Although further on in the  
> script it now makes sense that when I would try to do averaging it was  
> telling me that it did not recognize ?FP1? as a channel. So, thank you  
> very much Eric, for pointing this difference out. After migrating the code  
> to the suggested commands the montage went from this:
> 
> To this:
> 
> The channel count is accurate now, and the raw.plot output looks exactly  
> as it did before. As for the specifics, when I print(raw.info[?chs?]) to  
> troubleshoot location it is still off but only by thousandths for the  
> y-axis and hundredths in the y and z axes. Is this a by-product of the  
> aforementioned ?shrinking? mentioned before?
> 
> \*From: \*Eric Larson \<larson.eric.d at gmail.com\>  
> \*Sent: \*Friday, December 27, 2019 7:38 PM  
> \*Subject: \*Re: [Mne\_analysis] Conforming to Montage Deprecations
> 
> \* External Email - Use Caution \*
> 
> It looks like our standard\_1020 names follow a different capitalization  
> pattern:
> 
> [https://github.com/mne-tools/mne-python/blob/master/mne/channels/data/montages/standard\_1020.elc#L107](https://github.com/mne-tools/mne-python/blob/master/mne/channels/data/montages/standard_1020.elc#L107)
> 
> So if you do something like:
> 
> raw.rename\_channels(lambda x: x.lower().capitalize())
> 
> Or go the direct dictionary route:
> 
> raw.rename\_channels(dict(FP1='Fp1', OZ='Oz', FZ='Fz', FP2='Fp2', PZ='Pz',  
> CZ='Cz', FPZ='Fpz'))
> 
> Some variant like this should allow not having the warning without needing  
> to pass `raise_if_subset=False`. And if you have channels that are actually  
> not EEG, make sure to do raw.set\_channel\_types  
> \<[mne.io.Raw — MNE 1.7.0.dev17+g20174f448 documentation](https://mne.tools/dev/generated/mne.io.Raw.html#mne.io.Raw.set_channel_types&gt);  
> to set them to the correct channel types.
> 
> As for the channel count mismatch, what extra channels are in raw.ch\_names  
> that you don't expect to be there? Does raw.plot() look reasonable?
> 
> Eric
> 
> \* External Email - Use Caution \*
> 
> When I implement the changes this way, I get a ValueError that reads:
> 
> ?DigMontage is a only a subset of info. There are 7 channel positions not  
> present it the DigMontage. The required channels are: {'FP1', 'OZ', 'FZ',  
> 'FP2', 'PZ', 'CZ', 'FPZ'}. You can use `raise_if_subset=False` in  
> `set_montage` to avoid this ValueError and get a DeprecationWarning  
> instead.?
> 
> If I do as suggested above I do not get an error I get an output of what  
> which channels will be ignored and a warning that reads:
> 
> ?Reading 0 ... 2552079 = 0.000 ... 1276.040 secs...
> 
> \<ipython-input-12-e47b0d549095\>:8: RuntimeWarning: Could not parse meas  
> date from the header. Setting to None.
> 
> &nbsp;&nbsp;data\_format='int32', date\_format='mm/dd/yy', preload=True,  
> verbose='debug')
> 
> DigMontage is a superset of info. 78 in DigMontage will be ignored. The  
> ignored channels are: {'T5', 'Oz', 'C5', 'PO9', 'AF1', 'PO3', 'AF4', 'F1',  
> 'FC4', 'CP3', 'AF6', 'FC6', 'Fz', 'Cz', 'CP5', 'TP7', 'FC3', 'AF8', 'T10',  
> 'P10', 'FT7', 'P6', 'T3', 'TP10', 'PO1', 'AF5', 'P5', 'Iz', 'FC5', 'TP9',  
> 'POz', 'FC2', 'PO8', 'AF3', 'AF10', 'CP2', 'T9', 'PO4', 'PO2', 'FT10',  
> 'P2', 'T6', 'AF7', 'AF9', 'C6', 'A2', 'PO5', 'PO6', 'F6', 'A1', 'P1',  
> 'F10', 'Fp2', 'C2', 'FT8', 'F5', 'AF2', 'P9', 'FCz', 'O9', 'CP4', 'Fp1',  
> 'PO7', 'PO10', 'C1', 'F9', 'CP1', 'O10', 'FT9', 'CP6', 'TP8', 'F2', 'T4',  
> 'CPz', 'Pz', 'AFz', 'Fpz', 'FC1'}
> 
> \<ipython-input-12-e47b0d549095\>:13: RuntimeWarning: DigMontage is a only a  
> subset of info. Did not set 7 channel positions:
> 
> FP1, OZ, FZ, FP2, PZ, CZ, FPZ
> 
> &nbsp;&nbsp;raw.set\_montage(montage, raise\_if\_subset=False)
> 
> Out[12]:
> 
> \<RawCNT | st003\_PAMR\_s1079\_20080319.cnt, n\_channels x n\_times : 38 x  
> 2552080 (1276.0 sec), ~740.0 MB, data loaded\>?
> 
> This is very problematic as I am only supposed to have 23 EEG, 5 EMG, 2  
> EOG, 1ECG, 2 MISC (skin conductance), and 1 Stim channel.
> 
> &nbsp;&nbsp;&nbsp;- Bianca
> 
> \*From: \*Alexandre Gramfort \<alexandre.gramfort at inria.fr\>  
> \*Sent: \*Thursday, December 26, 2019 11:35 PM  
> \*To: \*Discussion and support forum for the users of MNE Software  
> \<mne\_analysis at nmr.mgh.harvard.edu\>  
> \*Subject: \*Re: [Mne\_analysis] Conforming to Montage Deprecations
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;External Email - Use Caution
> 
> hi Bianca,
> 
> are you doing:
> 
> raw = mne.io.read\_raw\_cnt(fname)
> 
> montage = mne.channels.make\_standard\_montage(kind=?standard\_1020)
> 
> raw.set\_montage(montage)
> 
> ?
> 
> this should set the chs and the dig.
> 
> the reason we have changed this is that we want to make sure that the  
> channel
> 
> locations are can considered to be in head coordinate system so you can  
> relate
> 
> them to fsaverage for example. Is the shrinking problematic for you?
> 
> Alex
> 
> \>
> 
> \> External Email - Use Caution
> 
> \>
> 
> \> Happy Holidays MNE Team,
> 
> \>
> 
> \>
> 
> \>
> 
> \> I am trying to conform to the new deprecation that has occurred in  
> developer version 0.19 concerning the montage. My input file is a  
> Neuroscan (.cnt) file extension type and thus my script previously read  
> `mne.io.read_raw_cnt(fname, montage=?standard_1020?, etc ?)`. However, I  
> have migrated this to a separate command  
> `mne.channels.make_standard_montage(kind=?standard_1020)`. When doing this  
> it skews my X,Y,Z locations. For example, when I pass `print(raw.info[?chs?])`  
> my FP1 EEG electrode location is skewed from
> 
> \>
> 
> \>
> 
> \>
> 
> \> `?loc?: array([-0.0294367, 0.0839171, -0.00699, 0. ,  
> 0. , 0. , 0. , 0. , 0. ,  
> 0. , 0. , 0. ])`
> 
> \>
> 
> \>
> 
> \>
> 
> \> to
> 
> \>
> 
> \>
> 
> \>
> 
> \> `?loc?: array([-0.20257819, 0.21764863, 0.95477283, nan,  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nan,
> 
> \>
> 
> \> nan, nan, nan, nan, nan,
> 
> \>
> 
> \> nan, nan]).
> 
> \>
> 
> \>
> 
> \>
> 
> \> Furthermore, when I input `print(raw.info)` the previous code output  
> under `dig : list | 26 items (3 cardinal, 23 EEG)` while the latter code  
> displays NoneType in the `dig`. While this seems like it would be a  
> straight-forward change, it is definitely not as easy in practice. Is  
> there any reason that it is not reading my montage as a standard\_1020  
> anymore?
> 
> \>
> 
> \>
> 
> \>
> 
> \> Thank you for any assistance provided,
> 
> \>
> 
> \> Bianca Islas
> 
> \>
> 
> \> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> \> Mne\_analysis mailing list
> 
> \> Mne\_analysis at nmr.mgh.harvard.edu
> 
> \> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
> 
> Mne\_analysis mailing list
> 
> Mne\_analysis at nmr.mgh.harvard.edu
> 
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20191228/6acde8ee/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191228/6acde8ee/attachment-0001.html)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: E8EF3AA34FD34BECAA14BA0209485DF1.png  
Type: image/png  
Size: 16647 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20191228/6acde8ee/attachment-0002.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191228/6acde8ee/attachment-0002.png)  
-------------- next part --------------  
A non-text attachment was scrubbed...  
Name: 131233DD1F6F4D62AE4389D7FD5076F4.png  
Type: image/png  
Size: 20761 bytes  
Desc: not available  
Url : [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20191228/6acde8ee/attachment-0003.png](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191228/6acde8ee/attachment-0003.png)
