# Problems using 'set\_montage' - fNIRS (Hitachi-raw data)

**URL:** <https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513>\
**Category:** Support & Discussions\
**Tags:** fnirs\
**Created:** [September 1, 2022, 5:49pm UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513 "2022-09-01T17:49:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rfahrn](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rfahrn/32/1862_2.png) [@rfahrn](https://mne.discourse.group/u/rfahrn)\
**Post date:** [September 1, 2022, 5:49pm UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/1 "2022-09-01T17:49:08Z")

</div>

Hi,  
I am student and just started working on my first fNIRS project. Unfortunately, my supervisors have never used MNE and can’t help me, so I really hope you can!

I am using the following version/system:

- MNE version: e.g. 1.0.3
- operating system: Windows 10

I instantiated objects (montage11=left and right hemi., montage11\_1=left hemi, montage11\_2= right hemi) of **DigMontage** instance. I then plottet the montage, see image.

 ![grafik](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/6/668ae1f0e7329e560d447536c88ba1101e494d36.png)

After that I tried to use the _ **set\_montage** _ method on the **raw Hitachi-raw object**. The left hemisphere worked perfectly, however I got no error on the _**right hemisphere (montage11\_2).**_

```python

montage11 = self_montage(file_path='Data/S11/0001.pos', csv_file='Data/S11/0001_edit.csv')

# left hemisphere (Probe 1)
montage11_1 = self_montage(file_path='Data/S11/0001.pos', csv_file='Data/S11/probe1_channel_montage.csv')
raw1.set_montage(montage11_1,match_case=True,match_alias=True,on_missing='ignore')

# right hemisphere (Probe 2)
montage11_2 = self_montage(file_path='Data/S11/0001.pos', csv_file='Data/S11/probe2_channel_montage.csv')

# mne.set_montage right hemisphere: raises Error - IndexError: index 44 is out of bounds for axis 0 with size 44
raw2.set_montage(montage11_2)

```

Do you know what the problem is and how I can make it work for both hemisphere?

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [September 2, 2022, 7:28am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/2 "2022-09-02T07:28:33Z")

</div>

do you have more channels in montage11\_1 than in your actual data?

Alex

---

<div class="post-metadata">

**Author:** ![rfahrn](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rfahrn/32/1862_2.png) [@rfahrn](https://mne.discourse.group/u/rfahrn)\
**Post date:** [September 2, 2022, 7:58am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/3 "2022-09-02T07:58:00Z")

</div>

Hi Alex,

I have 15 montage/coordinate points for each hemisphere (Source/Detector), I renamed them in the specific S/D form. The data-recording is then inbetween the 1-22, 23-44 points. Do I have to set them to be the channels? And if so how should I name them?

left hemisphere:

 ![left_hemi_channels](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/0/07cfbaa8ec4df7f89c844f8576e7a81506d2214f.png)

right hemisphere:

 ![right_hemi_channels](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/8/8d257bec0a2f9141295789dfdccb78894567e183.png)

Best,  
Rebecka

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [September 2, 2022, 8:17am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/4 "2022-09-02T08:17:04Z")

</div>

can you save your montage with the .save method and the info of your data with mne.io.write\_info and share it with us?

Alex

---

<div class="post-metadata">

**Author:** ![rfahrn](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rfahrn/32/1862_2.png) [@rfahrn](https://mne.discourse.group/u/rfahrn)\
**Post date:** [September 2, 2022, 8:31am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/5 "2022-09-02T08:31:19Z")

</div>

> [@agramfort](#):
>
> mne.io.write\_info

Thank you for your fast response and help! I tried to save/write\_info but the encoding (utf-8 etc.) seems to be wrong when I try to save it as a .txt file. 🤔  
Best, Rebi

---

<div class="post-metadata">

**Author:** ![rfahrn](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rfahrn/32/1862_2.png) [@rfahrn](https://mne.discourse.group/u/rfahrn)\
**Post date:** [September 2, 2022, 8:36am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/6 "2022-09-02T08:36:37Z")

</div>

I printed the raw1.info and raw2.info now, and get the following:

 ![info_raw1_raw2](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/b/bbf1f080fb718bc8748eb5044f56e5c23dbe595e.png)

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [September 2, 2022, 9:20am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/7 "2022-09-02T09:20:52Z")

</div>

mne.io.write\_info will write to a .fif file. So do

mne.io.write\_info(“debug-info.fif”, info)

this should work.

Alex

---

<div class="post-metadata">

**Author:** ![rfahrn](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rfahrn/32/1862_2.png) [@rfahrn](https://mne.discourse.group/u/rfahrn)\
**Post date:** [September 2, 2022, 9:43am UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/8 "2022-09-02T09:43:59Z")

</div>

Oh okay, thank you!  
All the infos - debug-info1/debug-info2.fif is in the folder **[00-info]**  
here is my github link:

> **[GitHub - rfahrn/fNIRS-project: BA-project fNIRS data anaysis](https://github.com/rfahrn/fNIRS-project/tree/main/)**
>
> main/

Best - Rebi

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [September 2, 2022, 3:31pm UTC](https://mne.discourse.group/t/problems-using-set-montage-fnirs-hitachi-raw-data/5513/9 "2022-09-02T15:31:28Z")

</div>

From office hours, this is a limitation with `read_raw_hitachi` where we should support multiple `csv` files, one per probe. @rfahrn will open a GitHub issue, and then hopefully we can fix it soon!
