In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces how to use Epochs to achieve data visualization in Python, the content is very detailed, interested friends can use for reference, I hope it can be helpful to you.
Mne.Epochs.plot () provides an interactive browser that allows manual rejection when used in conjunction with the keyword block = True. This will prevent the script from executing until the browser window is closed.
# load the toolkit import os.path as opimport mneimport matplotlib.pyplot as plt
Load data
"" load data If the data is not available locally, download "" data_path = op.join (mne.datasets.sample.data_path (), 'MEG',' sample') raw = mne.io.read_raw_fif (op.join (data_path, 'sample_audvis_filt-0-40roomraw.fif'), preload=True) # set event IDevent_id = {' auditory/left': 1, 'auditory/right': 2,' visual/left': 3 'visual/right': 4,' smiley': 5, 'button': 32} events = mne.find_events (raw) epochs = mne.Epochs (raw, events, event_id=event_id, tmin=-0.2, tmax=.5, preload=True) del raw
# draw epochsepochs.plot (block=True) plt.show ()
The number at the top represents the event id for epoch. The number at the bottom is the running number of each epoch.
Because there is no artificial artifact correction or elimination, some epoch data are contaminated by blinking and scanning. For example, epoch 1 seems to be contaminated with a blink (scroll to the bottom to see the EOG channel). Click on the top of the browser window to mark the epoch as culled. When clicked, the epoch should turn red. This means that when the browser window closes, it will be deleted.
Event markers can be drawn on epochs data by passing the events keyword to the epoched drawing. These events are drawn as vertical bars, and they follow the same shading scheme as mvc.viz.plot_events (). Because of the same color, the event plotter can also be used as a legend for epochs plotter events. You can also pass your own color through the event_colors keyword. Here, we can draw the reaction time between seeing the smiley face and pressing the button (event 32).
When passing events, the bottom epoch number is turned off by default to avoid overlap. You can reopen it by pressing the o key in the settings dialog box.
# drawing eventsevents = mne.pick_events (events, include= [5,32]) mne.viz.plot_events (events)
# plot smiley's epochsepochs ['smiley'] .plot (events=events) plt.show ()
To see all the epoch at a glance, you can use the function mne.epoch.plot_image () to draw each channel as an image. It can show the amplitude of the signal at all time points, plus the average of activation (evoked response).
Explicitly set the interactive colorbar to on (also on by default to draw functions using colorbar other than topo drawing). In interactive mode, you can zoom and change the color map by scrolling the mouse and the up and down arrow keys. You can also drag the color bar left or right with the mouse. Pressing the spacebar resets the scale.
Epochs.plot_image, cmap='interactive', sigma=1., vmin=-250, vmax=250) 319 matching events foundNo baseline correction appliedNot setting metadata0 projection items activated0 bad epochs dropped
You can also use some functions to draw information arranged into an array of channels by channel.
Automatic scaling is used by default when drawing images, but noisy channels and different channel types can cause the zoom to be a little small.
Epochs.plot_topo_image (vmin=-250, vmax=250, title='ERF images', sigma=2., fig_facecolor='w', font_color='k') on how to use Epochs to achieve data visualization in Python is shared here. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.