Repository navigation
MRG, ENH: viz.plot_drop_log() gains special-handling for subject=None - #9015
Conversation
05f6b4b to
7d13436
Compare
Now omits displaying the subject name in the title if it's None Also changes the title of the drop log plot to make it clearer what is being shown.
|
|
||
| @copy_function_doc_to_method_doc(plot_drop_log) | ||
| def plot_drop_log(self, threshold=0, n_max_plot=20, subject='Unknown', | ||
| def plot_drop_log(self, threshold=0, n_max_plot=20, subject='Unknown subj', |
There was a problem hiding this comment.
This is for consistency with viz.plot_drop_log()
drammock
left a comment
There was a problem hiding this comment.
I know this is already merged, but see comment below
| epochs = read_epochs(epo_fname) | ||
| kwargs = dict(subject=self.subject, show=False) | ||
| kwargs = dict( | ||
| subject=self.subject if self.subject is not None else self.subject, |
There was a problem hiding this comment.
What does this change do exactly? Why is the conditional needed?
|
@drammock [semi-unrelated] For historical reasons (I guess?), [actual argument starts here] There was, however, no way to entirely disable displaying the subject ID, e.g. if you didn't have one. In this case, you'd either have to go with the default of # %%
import os
import mne
path = mne.datasets.sample.data_path()
fname_raw = os.path.join(path, 'MEG', 'sample', 'sample_audvis_raw.fif')
raw = mne.io.read_raw_fif(fname_raw, verbose=False).crop(tmax=60)
events = mne.find_events(raw, stim_channel='STI 014')
event_id = {'auditory/left': 1, 'auditory/right': 2, 'visual/left': 3,
'visual/right': 4, 'face': 5, 'buttonpress': 32}
# create some epochs and ensure we drop a few, so we can then plot the drop log
reject = dict(eeg=150e-6)
epochs = mne.Epochs(raw=raw, events=events, event_id=event_id,
tmin=-0.2, tmax=0.7, reject=reject, preload=True)
epochs.plot_drop_log()
epochs.plot_drop_log(subject=None)
epochs.plot_drop_log(subject='')As you can see, Now running the above with the changes made in this PR, the first two plots (default arguments and You could of course argue that one could've just special-cased You could also argue that users could just alter the title after plotting in whichever way they like; however, since we already have a Does that make sense? |
|
sure, but what doesn't make sense is why subject=self.subject if self.subject is not None else self.subjectis different/better than subject=self.subjectOr more simply, why do this: foo = x if x is not None else xinstead of this: foo = x |
... oh. yes this doesn't make any sense |
|
I suppose this is some leftover / cruft honestly. This should be simplified. I will do a followup PR to get this fixed. Thanks for catching this! |
as pointed out by @drammock
* upstream/main: (135 commits) DOC: use bibtex in plot_source_power_spectrum_opm.py (mne-tools#8906) (mne-tools#9050) DOC: use bibtex in plot_sleep (mne-tools#9044) FIX: fix sideways helmet plot (mne-tools#9059) FIX: bibtex mne-tools#8933 (mne-tools#9047) Fix bibtex citation issue mne-tools#8929. (mne-tools#9051) bibtex fix plot_time_frequency_global_field_power (mne-tools#9052) Fixed bibtex references in plot_background_statistics (mne-tools#9046) Bibtex raw py (mne-tools#9048) DOC update footcite maxwell.py (mne-tools#9043) update footcite [skip github] [skip azp] (mne-tools#9054) Adding bibtex in plot_otp (mne-tools#9049) fix bibtex plot_evoked_whitening (mne-tools#9042) MAINT: Link earlier [skip github] [skip azp] (mne-tools#9041) DOC: convert references in plot_parcellation to use footcite (mne-tools#9032) MAINT: Fix circle (mne-tools#9039) ENH: Allow adding custom JavaScript to Report (mne-tools#9037) MRG, DOC: Bump theme version (mne-tools#9036) MAINT: Simplify expression (followup to mne-tools#9015) (mne-tools#9035) MRG, MAINT: Cleaner split, fewer skips in _brain tests (mne-tools#9029) MRG, ENH: viz.plot_drop_log() gains special-handling for subject=None (mne-tools#9015) ...



Now omits displaying the subject name in the title if it's
None(would display literalNonebefore, causing confusion to some!)Also changes the title of the drop log plot to make it clearer what is being shown.