Topographic plots in MNE-NIRS

  • MNE-version: 1.6.1
  • MNE-NIRS version: e.g. 0.5.0
  • operating system: Windows 11

Why are my topographic plots coming outside the head and zoomed out so much? When i load my nirx data that is basically a folder contain some files and two .wl files, it is showing the topographic plots like this.

Here is my code where i loaded the dataset and ran a glm model over it on jupyter notebook:

import mne
import mne_nirs 

#For ignoring depreciations
import warnings
from cryptography.utils import CryptographyDeprecationWarning
warnings.filterwarnings(action='ignore', category=CryptographyDeprecationWarning)
#Import required libraries - os for interacting with the os and matplotlib for visualizations
import os 
import matplotlib.pyplot as plt
# %matplotlib notebook
%matplotlib qt

#Loading the directory or folder
raw_intensity =, preload=True, verbose=None)

print("\nYour dataset has been loaded! Here is the visualization for it:")
plt.rcParams["figure.figsize"]= (6,6) #w,h
# raw_intensity.plot_sensors()

#Code for GLM

import numpy as np
from mne_nirs.experimental_design import make_first_level_design_matrix
from mne_nirs.statistics import run_glm
from mne_nirs.channels import (get_long_channels,
from nilearn.plotting import plot_design_matrix

#Cleaning up annotations
#raw_intensity.annotations.rename({'0': 'Rest', '1': 'Walking'})
raw_intensity.annotations.rename({'2.0': 'Rest',
                                  '3.0': 'Thumb',
                                  '4.0': 'Index',
                                  '5.0': 'Middle',
                                  '6.0': 'Ring',
                                  '7.0': 'Little',
                                  '8.0': 'Final Rest'
unwanted = np.nonzero(raw_intensity.annotations.description == '1.0')

montage = mne.channels.make_standard_montage('standard_1005')

# View the position of optodes in 2D to confirm the positions are correct.

#Converting the raw density to optical density
raw_od = mne.preprocessing.nirs.optical_density(raw_intensity)

plt.rcParams["figure.figsize"]= (6,6) #w,h
print("Converting to optical densities:")

#Converting the optical densities to concentrations
from mne.preprocessing.nirs import beer_lambert_law
print("Now converting the optical densities into concentration with the help of Modified Beer-Lambert's Law")

#Using beer_lambert_law for converting into haemoglobin conentrations
raw_haemo = mne.preprocessing.nirs.beer_lambert_law(raw_od) 

print("Converting to the haemoglobin concentrations:")
#return raw_haemo

#Selecting short channels and long channels
#short_chs = get_short_channels(raw_haemo)
raw_haemo = get_long_channels(raw_haemo)

design_matrix = make_first_level_design_matrix(raw_haemo,
                                   high_pass=0.005,  # Must be specified per experiment

channels_of_interest = ['S1_D1 hbo', 'S1_D1 hbr', 'S8_D6 hbo', 'S8_D6 hbr'] 
data_subset = raw_haemo.copy().pick(picks=channels_of_interest)
glm_est = run_glm(data_subset, design_matrix)

#Fitting glm to all data and viewing topographic distribution
glm_est = run_glm(raw_haemo, design_matrix)
glm_est.plot_topo(conditions=['Rest', 'Thumb'])

Please help me if you can, I need to know how to get the topographic views inside and more zoomed in. I tried with the sphere parameter inside the plot_topo function , it doesnt work. Anybody who knows how to solve it, would really appreciate your help.

Thanks in advance,

@rob-luke is the fNIRS expert around here :slight_smile: Maybe he has some thoughts!