Hi,
I’m working with ERPs data and I need to stratify the response based on some other EEGs parameters. For example: if the trigger was presented when the ongoing slow oscillation was in the up-state vs in the down-state.
What I did for the up-state case is:
- to get EEG data via Raw.from_data_frame method
- mask those timepoints that fell in the down-state with nan values.
In this way, I got a dataframe containing only those timepoints falling on the up-state for each channel, allowing me to analyze up-state responses separately from down-state responses.
3, I converted the DataFrame to an EpochArray-friendly numpy array, and successfully created both the EpochArray and Evoked classes.
Now the problem arises: when I try to make a joint plot, plotting is prevented due to the presence of those nan values used as mask. Please find the full Traceback at the bottom of the Topic.
Would it be possible to average across channels with a function able to get rid of NaN timepoints (such as np.nanmean)? I would take advantage of Evoked.plot_joint to show the difference between up and down states’ responses in publications.
MNE version: 1.2.2
OS: Windows 10
Traceback (most recent call last):
File " \Python\Python310\lib\site-packages\mne\evoked.py", line 452, in plot_joint
return plot_evoked_joint(self, times=times, title=title, picks=picks,
File " \Python\Python310\lib\site-packages\mne\viz\evoked.py", line 1517, in plot_evoked_joint
_plot_evoked(evoked, axes=ts_ax, show=False, plot_type=‘butterfly’,
File " \Python\Python310\lib\site-packages\mne\viz\evoked.py", line 364, in _plot_evoked
_plot_lines(evoked.data, info, picks, fig, axes, spatial_colors, unit,
File " \Python\Python310\lib\site-packages\mne\viz\evoked.py", line 449, in _plot_lines
_check_if_nan(D)
File " \Python\Python310\lib\site-packages\mne\utils\check.py", line 570, in _check_if_nan
raise ValueError(“Some of the values {} are NaN.”.format(msg))
ValueError: Some of the values to be plotted are NaN.