Seeing double (displaying figures twice)

  • MNE version: 1.11.0
  • MNE-NIRS version: 0.7.3
  • operating system: macOS Tahoe 26.3
  • environment: DataSpell 2025.3.2

Hello!
I am just starting my adventure with fNIRS and MNE. I wanted to use a similar analysis pipeline for correlating behavioural and fNIRS time-series as this paper:

https://doi.org/10.1177/0956797619878698

My first step is trying to setup a pipeline to inspect and preprocess data.

I have ran into a strange behaviour of the MNE package and I am not sure how to resolve these.

When I try to inspect the data, be it montage configuration or the od_plot, the psd plot, or anything else, all the figures appear twice (double exactly the same figure).

My details:

The code I used is just the code from the tutorial:

import matplotlib.pyplot as plt
import seaborn as sns

import mne

from mne.preprocessing.nirs import (
    optical_density,
)

# raw_intensity = mne.io.read_raw_nirx(fnirs_cw_amplitude_dir, verbose=False)
raw_intensity = mne.io.read_raw_snirf('***path to snirf file***', verbose=True)
raw_intensity.load_data().resample(3, npad="auto")
raw_od = optical_density(raw_intensity)

raw_od.plot(n_channels=32, duration=40, show_scrollbars=False,
            scalings=5e-2,
            )
raw_od.plot_sensors(show_names=True)
raw_od.compute_psd().plot(average=True)
  1. Has anyone encountered this behaviour?
  2. Does it affect anything else other than the visualisation output? Can I trust the numbers I get nevertheless?

Best,

Alicja

P.S. Outputs from other packages, matplotlib for example, appear normally.

Hi @alice-in-coderland, welcome to the MNE community!

MNE’s plotting functions return a “figure object.” In an interactive cell, DataSpell automatically captures and displays any object returned at the end of a line.

Maybe, this will work cuz ‘;’ will suppress the “return” output

raw_od.plot(n_channels=32, duration=40, show_scrollbars=False);

You can 100% trust your numbers! This is purely a visualization artifact of the IDE and doesn’t affect the underlying data, the resampling, or the optical density calculations at all.

Good luck with your fNIRS pipeline!

Thank you @PragnyaKhandelwal , that worked!