Coder Social home page Coder Social logo

Mouse Offset in Brain Plot about mne-python HOT 14 CLOSED

gedwald avatar gedwald commented on August 15, 2024
Mouse Offset in Brain Plot

from mne-python.

Comments (14)

welcome avatar welcome commented on August 15, 2024

Hello! πŸ‘‹ Thanks for opening your first issue here! ❀️ We will try to get back to you soon. 🚴

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

What is your mne sys_info? It's possible this is a bug with PyQt5 and HiDPI (though it's more common on macOS than Linux)

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

Thank you for the query; these are my two environments:

::: MacOS :::

Platform macOS-14.4.1-arm64-arm-64bit
Python 3.9.6 (default, Feb 3 2024, 15:58:27) [Clang 15.0.0 (clang-1500.3.9.4)]
Executable /Users/edwald/python_venvs/mne/bin/python3
CPU arm (8 cores)
Memory 16.0 GB

Core
β”œβ˜‘ mne 1.6.1 (latest release)
β”œβ˜‘ numpy 1.26.4 (OpenBLAS 0.3.23.dev with 8 threads)
β”œβ˜‘ scipy 1.12.0
β”œβ˜‘ matplotlib 3.8.3 (backend=module://matplotlib_inline.backend_inline)
β”œβ˜‘ pooch 1.8.0
β””β˜‘ jinja2 3.1.3

Numerical (optional)
β”œβ˜‘ sklearn 1.4.1.post1
β”œβ˜‘ nibabel 5.2.0
β”œβ˜‘ nilearn 0.10.3
β”œβ˜‘ pandas 2.2.0
β””β˜ unavailable numba, dipy, openmeeg, cupy

Visualization (optional)
β”œβ˜‘ pyvista 0.43.3 (OpenGL 4.1 Metal - 88 via Apple M1)
β”œβ˜‘ pyvistaqt 0.11.0
β”œβ˜‘ vtk 9.3.0
β”œβ˜‘ qtpy 2.4.1 (PyQt6=6.6.1)
β”œβ˜‘ pyqtgraph 0.13.4
β”œβ˜‘ mne-qt-browser 0.6.2
β”œβ˜‘ ipywidgets 8.1.2
β””β˜ unavailable ipympl, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
β””β˜ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline

::: Ubuntu 22.04 :::

mne.sys_info()
Platform Linux-6.5.0-25-generic-x86_64-with-glibc2.35
Python 3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0]
Executable /home/edwaldt20ni/VirtualEnvs/neweeg/bin/python
CPU x86_64 (12 cores)
Memory 62.6 GB

Core
β”œβ˜‘ mne 1.6.1 (latest release)
β”œβ˜‘ numpy 1.26.4 (OpenBLAS 0.3.23.dev with 12 threads)
β”œβ˜‘ scipy 1.12.0
β”œβ˜‘ matplotlib 3.8.3 (backend=QtAgg)
β”œβ˜‘ pooch 1.8.1
β””β˜‘ jinja2 3.1.3

Numerical (optional)
β”œβ˜‘ sklearn 1.4.1.post1
β”œβ˜‘ nibabel 5.2.0
β”œβ˜‘ nilearn 0.10.3
β”œβ˜‘ pandas 2.2.0
β””β˜ unavailable numba, dipy, openmeeg, cupy

Visualization (optional)
β”œβ˜‘ pyvista 0.43.3 (OpenGL 4.5 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2 via llvmpipe (LLVM 15.0.7, 256 bits))
β”œβ˜‘ pyvistaqt 0.11.0
β”œβ˜‘ vtk 9.2.6
β”œβ˜‘ qtpy 2.4.1 (PyQt6=6.6.1)
β”œβ˜‘ pyqtgraph 0.13.3
β”œβ˜‘ mne-qt-browser 0.6.1
β”œβ˜‘ ipywidgets 8.1.2
β””β˜ unavailable ipympl, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
β””β˜ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

If deemed helpful, I'll find a way to reduce the data and repeat the process with a smaller set of epochs

Can you try with this snippet (will download ~1.5GB):

import mne
data_path = mne.datasets.sample.data_path(verbose=True)
stc = mne.read_source_estimate(data_path / "MEG" / "sample" / "sample_audvis-meg-eeg-lh.stc", subject="sample")
stc.plot(subjects_dir=data_path / "subjects")

For me it produces something that interacts as expected, does it work for you?

image

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

Not quite:
I haven’t had opportunity to test this on the Ubuntu box, but here’s what happens on the Mac.
I don’t know why it’s looking for an -fsaverage- file

(mne) edwald@temmi ~ % python
Python 3.9.6 (default, Feb 3 2024, 15:58:27)
[Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

import mne
data_path=mne.datasets.sample.data_path(verbose=True)
Downloading file 'MNE-sample-data-processed.tar.gz' from 'https://osf.io/86qa2/download?version=6' to '/Users/edwald/mne_data'.
/Users/edwald/python_venvs/mne/lib/python3.9/site-packages/urllib3/init.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: urllib3/urllib3#3020
warnings.warn(
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.65G/1.65G [00:00<00:00, 23.3TB/s]
Untarring contents of '/Users/edwald/mne_data/MNE-sample-data-processed.tar.gz' to '/Users/edwald/mne_data'
Download complete in 01m19s (1576.2 MB)
stc=mne.read_source_estimate(data_path / "MEG" / "sample" / "sample_audvis-meg-eeg-lh.stc", subject="sample")
stc.plot()
Traceback (most recent call last):
File "", line 1, in
File "/Users/edwald/python_venvs/mne/lib/python3.9/site-packages/mne/source_estimate.py", line 743, in plot
brain = plot_source_estimates(
File "", line 12, in plot_source_estimates
File "/Users/edwald/python_venvs/mne/lib/python3.9/site-packages/mne/viz/_3d.py", line 2398, in plot_source_estimates
subjects_dir = get_subjects_dir(subjects_dir=subjects_dir, raise_error=True)
File "/Users/edwald/python_venvs/mne/lib/python3.9/site-packages/mne/utils/config.py", line 475, in get_subjects_dir
subjects_dir = _check_fname(
File "", line 12, in _check_fname
File "/Users/edwald/python_venvs/mne/lib/python3.9/site-packages/mne/utils/check.py", line 263, in _check_fname
raise FileNotFoundError(f'{name} does not exist: "{fname}"')
FileNotFoundError: subjects_dir does not exist: "/Users/edwald/mne_data/MNE-fsaverage-data"
data_path
PosixPath('/Users/edwald/mne_data/MNE-sample-data')

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

Argh sorry that last line in the MWE should be:

>>> stc.plot(subjects_dir=data_path / "subjects")

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

Thank you -
the plot appears, but I can only get new dipole bubbles on the brain if I click the mouse on the extreme right edge
Ie. the V1 area and further up the edge. Then I get the bubbles on the lower edge of the brain. Any clicks further inwards on the brain do not visibly produce anything, probably because the bubble falls off the left edge of the brain plot. ( I have not rotated the plot at all).

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

Okay I was able to replicate on my macOS machine -- can you see if being on this branch of PyVistaQt fixes things for you on mac at least?

pyvista/pyvistaqt#565

And maybe we'll get lucky and it'll also fix things on Linux.

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

You should be able to do pip install git+https://github.com/larsoner/pyvistaqt.git@pyqt6 to install my branch

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

This WORKS! Or, at least- the dipole bubble now appears exactly where I click with the mouse.
Thank you very much for this wizardry. Brilliant!
Tomorrow I will have the opportunity to test this on Ubuntu as well, or anything else I can contribute.

from mne-python.

gedwald avatar gedwald commented on August 15, 2024

The code works correctly on Ubuntu as well, with your fix.
Both my own code and your example above.
Many thanks.

from mne-python.

larsoner avatar larsoner commented on August 15, 2024

Great to hear!

from mne-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.