mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.72k stars 1.32k forks source link

Allow blocking execution of plot_alignment() and stc.plot() #10221

Open hoechenberger opened 2 years ago

hoechenberger commented 2 years ago

The alignment and the Brain plots are both used in interactive exploration and in non-interactive scripts.

A common annoying issue that I and other users regularly run into is that we write a short script that displays the sensor alignment or a SourceEstimate, run it (e.g. via the Run button in VS Code), the window pops up – and immediately disappears. So one then needs to run the script again -- this time, with python -i or after inserting some blocking call like input().

It would be great if there was an easier way to ensure a blocking behavior.

cc @GuillaumeFavelier

GuillaumeFavelier commented 2 years ago

In the coreg app, we have a standalone parameter which control that. We could add the same to Brain? But adding yet another one to plot_alignment might be too much.

hoechenberger commented 2 years ago

I was more thinking of something like block, which we have for our matplotlib plotting functions too

GuillaumeFavelier commented 2 years ago

I do not mind changing the name if it does the same thing.

hoechenberger commented 2 years ago

standalone is fine for Coreg, I think. Just for the others – if we add this functionality, I think it should be block. :)

GuillaumeFavelier commented 2 years ago

Why keeping coreg as the only exception?

hoechenberger commented 2 years ago

Why keeping coreg as the only exception?

To avoid discussions about backward-compat ;) I don't care enough about this one to discuss 😅😅😅😅😅

GuillaumeFavelier commented 2 years ago

backward-compat... Honestly, the new version of coreg has not been around for so long, I don't know if people had really the time to play around with the standalone parameter. I still think the change is worth it for consistency (just a rename in practice). But I understand your point.

hoechenberger commented 2 years ago

Ah ok! Thought we'd always had this param. In that case – let's block it 😁👌

GuillaumeFavelier commented 2 years ago

10222 is merged but the case of plot_alignment is still open.