Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 31 2019 22:33
    codecov[bot] commented #5895
  • Jan 31 2019 22:32
    larsoner synchronize #5895
  • Jan 31 2019 21:16
    codecov[bot] commented #5895
  • Jan 31 2019 21:16
    larsoner synchronize #5895
  • Jan 31 2019 20:23
    agramfort commented #5768
  • Jan 31 2019 18:31
    larsoner opened #5895
  • Jan 31 2019 18:31
    larsoner milestoned #5895
  • Jan 31 2019 17:58
    codecov[bot] commented #5822
  • Jan 31 2019 17:16
    GuillaumeFavelier commented #5822
  • Jan 31 2019 17:13
    codecov[bot] commented #5822
  • Jan 31 2019 17:13
    GuillaumeFavelier synchronize #5822
  • Jan 31 2019 17:01
    jshanna100 commented #5807
  • Jan 31 2019 16:11
    larsoner commented #5807
  • Jan 31 2019 15:36
    jshanna100 commented #5807
  • Jan 31 2019 15:19
    codecov[bot] commented #5807
  • Jan 31 2019 15:07
    GuillaumeFavelier commented #5822
  • Jan 31 2019 14:18
    codecov[bot] commented #5768
  • Jan 31 2019 14:01
    codecov[bot] commented #5807
  • Jan 31 2019 14:01
    jshanna100 synchronize #5807
  • Jan 31 2019 13:45
    GuillaumeFavelier synchronize #5822
Eric Larson
@larsoner
whoops that last one was meant for @AaronAngJW
@mice-exp maybe you meant to pass 'GC.gdf' as the filename? you can use os.listdir(r'C:\Users\Public\Desktop\data\') to see what files you have there, see if your .gdf exisnts
14 replies
piapiabri
@piapiabri
Dear all, I am new to mne and working on my first script. I want to first add the online reference as a flat channel using mne.add_reference_channels(), afterwards I want to re-reference to the averaged TP9/TP10 electrodes using raw.set_eeg_reference(ref_channels = ['TP9', 'TP10']). However, when I use add_reference_channels I see in my console 'EEG channel type selected for re-referencing Applying a custom EEG reference.' Why is it re-referencing - I thought it only adds channels consisting of all zeros as stated in the doc? Any help is highly appreciated. Have a nice day and stay safe, Pia
Stefan Appelhoff
@sappelhoff

@piapiabri That is because through "add_reference_channels" you are telling the data what the original references were (that was potentially unknown prior to the add_reference_channels call). see: https://github.com/mne-tools/mne-python/blob/4eb2997d932453a4aea4278bef1cd878aa47f085/mne/io/reference.py#L241

Note that your data are not changed by this, although it may seem like that from the logging statement (feel free to verify this using np.array_equal or similar)

Perhaps the confusing log message should be silenced by changing the line I linked above to: set_eeg_reference(inst, ref_channels=ref_channels, copy=False, verbose=False) in a PR to mne-python

刘政(Barry Liu)
@BarryLiu-97
It seems that plot_seeg.py is not finished yet, right?
piapiabri
@piapiabri
Thank you for clarification @sappelhoff
刘政(Barry Liu)
@BarryLiu-97
@larsoner
刘政(Barry Liu)
@BarryLiu-97
And maybe 0.21.0 should be checked about mne.viz.Brain for I really can't use it in 0.21.0.
but it works well in dev
Eric Larson
@larsoner
@BarryLiu-97 you're right, it will be public in 0.21.1 which we should release soon (has some bugfixes). And yes the sEEG example is still in progress, feel free to comment if it's not clear
刘政(Barry Liu)
@BarryLiu-97
@larsoner All right! Looking forward to it.
As we know, iEEG becomes more and more popular.
刘政(Barry Liu)
@BarryLiu-97
Hi ,why is this brain you rendered is so different to the brain in plot_ecog?mne-tools/mne-python#8402
It looks like being smmothed.
As I know, the brain model should be see-through for the contact of every depth electrodes is inside the brain.
@larsoner
Stefan Appelhoff
@sappelhoff
image.png

I want to plot EEG data without using the MNE functions (I need more flexibility and control), however I do want a nice small inset plot showing the montage and which sensors were used for the plots.

like in this image above ☝️

I figured out a way to do this, see this minimal working example:

import matplotlib.pyplot as plt
import mne
from mne.datasets import sample

# load data
data_path = sample.data_path()
fname = data_path + "/MEG/sample/sample_audvis_raw.fif"
raw = mne.io.read_raw_fif(fname)

# which channels do we want to plot
to_plot = [f"EEG {i:03}" for i in range(5)]

# make a figure
fig, ax = plt.subplots()

# plot some fake EEG data
ax.plot(np.arange(10))

# now plot an inset axes showing the sensors from which we plotted
axins = inset_axes(ax, width="30%", height="30%", loc=2)
raw.copy().pick_types(meg=False, eeg=True).pick_channels(to_plot).plot_sensors(
    title="", axes=axins
)

fig

which produces the following:

image.png

my issue is, that the scatter dots are way too big, and I cannot find a way how to customize them.

--> Does somebody have a good idea to help me?

Eric Larson
@larsoner

It looks like being smmothed.

This is going to depend on the distance parameter as well as the volume source space used (the example one is 5mm). You might be looking for the sensors themselves to be shown, which is not implemented yet, see mne-tools/mne-python#8382

and I cannot find a way how to customize them.

MNE just uses matplotlib objects. If you inspect ax you should find something in ax.lines, ax.collections, ax.patches, or something similar that contains the artist that's drawing those dots. Once you find it there should be a set_markersize or something similar that you can use to change it. Internally our code appears to use ax.scatter, and the MPL docs suggests this returns a PathCollection, so hopefully you can look at ax.collections, find it, and use the appropriate PathCollection method

mice-exp
@mice-exp

Hello, I'm getting the error:
File "C:\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 126, in _read_segment_file
self._raw_extras[fi], self.info['chs'],

AttributeError: '_ReadSegmentFileProtector' object has no attribute 'info'

when trying to work with a gdf file and even with an example dataset: eegbci from mne.datasets, which should contain the experiment info attribute
Does someone know how I can solve this? I really appreciate any help you can provide.

Stefan Appelhoff
@sappelhoff
thanks @larsoner that was the solution: axins.collections[0].set_sizes([1])
Eric Larson
@larsoner
@sappelhoff in exchange can I ask you to start a new MNE tutorial "Customizing MNE visualizations" that talks about how to leverage some of these functions? It can start out just with your example (and feel free to take what I wrote above as introductory text) and others can add things. We should cross-link it to the "creating publication figures" example but it's sufficiently different I think it's worth having a separate example -- the publication one is really about publication-relevant tweaks, the customizing tutorial is really about doing stuff like what you're doing. Or if you think they're sufficiently similar let's just add to the publication tutorial...
Stefan Appelhoff
@sappelhoff
I'll give it a start!
1 reply
刘政(Barry Liu)
@BarryLiu-97
Hi, is plot_seeg.py finished? It seems that it's almost OK.
BaggioMarco
@BaggioMarco
Hi, do we have in MNE an alternative method to the ICA that does not require to manually remove the components?
Or a variation of the ICA that detect automatically the components to be removed?
Some ideas would be really appreciated, thank you!
Clemens Brunner
@cbrnr
@agramfort @larsoner I added MNE-Python to the GitHub Discussions beta program, because I think this will be a much more efficient place for usage questions. Could you give me repo permissions so that I can add that feature and we can test it?
Masataka_Wada
@masataka-wada
@larsoner Thank you for giving me critical advice. I have overcome the problem!!
Clemens Brunner
@cbrnr
Let's try and see if this can replace Gitter
Clemens Brunner
@cbrnr
where do we direct people to use gitter or the mailing list for usage questions? we should add GitHub Discussions, preferably as the first option.
4 replies
刘政(Barry Liu)
@BarryLiu-97
Hi, I was practicing this tutorial:https://mne.tools/dev/auto_tutorials/source-modeling/plot_background_freesurfer.html. Unfortunately, when I plot the brain, it seemed that python got stuck, is that because my core graphics in intel i7-6700 is not good enough? For it works well in plot_ecog.py, I am confused.
Clemens Brunner
@cbrnr
GitHub Discussions PR: mne-tools/mne-python#8429
Peer Herholz
@PeerHerholz
@cbrnr (and everyone), sorry if this was discussed before, but I wondered about the possibility of adding neurostars.org as an option for questions, etc.?
Eric Larson
@larsoner
@PeerHerholz can you mention this in mne-tools/mne-python#8429 ? We are actively discussing this sort of thing
Peer Herholz
@PeerHerholz
@larsoner thx for the quick response! yeah, sure thing, I'll post there
SebastianSpeer
@SebastianSpeer
Dear MNE team, I've got a problem where when I use plot_tfr_topomap the colorbar is huge in comparison to the topomap. Changing the paramters of the function does not seem to change anything. Do you have suggestions for a solution? (I'm using MNE in Jupyter lab)
image.png
Eric Larson
@larsoner
@SebastianSpeer this seems to actually be a problem with the figure size being incorrect. The axes for the topomap have to have equal aspect ratio but the colorbar is allowed to grow. Changing the figure size to something more square or even a bit wider than tall should fix it. Did you create the figure and pass axes or did MNE-Python create it internally?
11 replies
Juan Jesús Torre Tresols
@Hororohoruru

Hello fellow MNE users! I come to ask an usage question about filtering EEG data.

I would like to apply a narrow band-pass filter to the data, so only one frequency (e.g., 15Hz) remains, while all the others are attenuated. I tried specifying the l_freq and h_freq of the filter method of my raw data to be the same, but I got the error msg saying that the bands are not sufficiently separated. Is there a way of implementing this kind of filter with MNE?

Adam Li
@adam2392

Is there a way to update / set fiducials on a montage after you already have a montage?

Currently the only way I can find that gets a montage is either you make it from scratch make_dig_montage or you get it from raw using raw.get_montage. But if you say already have an existing montage via raw.get_montage() it seems you would have to hack out the channel positions and then call make_dig_montage again? Since there is no public API for getting the channel positions, I wonder if there's an easier way around this?

Eric Larson
@larsoner

Since there is no public API for getting the channel positions, I wonder if there's an easier way around this?

Perhaps we should add a montage.get_ch_positions() or something. Then you could easily call make_dig_montage again

3 replies
mehdikuchi
@mehdikuchi
Hello all, When I apply threshold to my data to remove artifacts and set the values of the artefactual data to nan; plotting do not show anything while there is even one nan sample within the window under view. Is this a bug or there is a workaround I have missed?
AaronAngJW
@AaronAngJW
image.png
Sorry, this might not be a mne question but I think someone might be able to help answer this - what does it mean when the EOG signal (as shown above) is inverted to a downwards peak rather than upward? Is this a sensor placement issue? How can a blink EOG signal be below baseline EOG activity?
2 replies
Adam Li
@adam2392

I'm wondering if the API for events_from_annotations and annotations_from_events are intentionally have flip-flopped event_mapping arguments?

E.g. In events_from_annotations, you get event_id which has key/values as description: ID

In annotations_from_events, you must pass in key/values as ID: description.

I had a use-case where I ended up needing to call them in sequence to create a new Annotations object and realized I can't just pass them into each other. I have to invert the event_id I get out of events_from_annotations. If this is undesirable, I can file an issue.

If it is intended, I might be just be overthinking this then.

Eric Larson
@larsoner
@adam2392 I'm not sure if it's intended or not -- it might have been -- but either way it's probably not worth an API deprecation cycle to change either function. Instead I'd recommend a .. note:: in one of them (probably annotations_from_events since it's used less?) noting the difference and suggesting that people can just use {v: k for k, v in event_id.items()} if they need to reverse it