Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: Add param to report.add_epochs to report reject/flat #12396

Open
larsoner opened this issue Jan 30, 2024 · 4 comments
Open

ENH: Add param to report.add_epochs to report reject/flat #12396

larsoner opened this issue Jan 30, 2024 · 4 comments
Labels

Comments

@larsoner
Copy link
Member

I think the value of the "reject" parameter should be included via upstream changes to mne.Report.add_epochs().

Originally posted by @hoechenberger in mne-tools/mne-bids-pipeline#839 (comment)

In other words, epochs.reject and maybe epochs.flat could be useful to allow opt-in to reporting in add_epochs so people know what rejection has been done. See linked PR for how it's done in MNE-BIDS-Pipeline for example.

@larsoner larsoner added the EASY label Jan 30, 2024
@Forchapeatl
Copy link

Forchapeatl commented Feb 24, 2024

Hello @larsoner , I am Forcha Pearl from Cameroon. It's a pleasure meeting you. I would love to participate in GSOC 2024 under mne-tools, Please is this what you mean ?

    @fill_doc
    def add_epochs(
        self,
        epochs,
        title,
        *,
        psd=True,
        projs=None,
        image_kwargs=None,
        topomap_kwargs=None,
        drop_log_ignore=("IGNORED",),
        tags=("epochs",),
        replace=False,
+       reject=epochs.reject,
    ):

@larsoner
Copy link
Member Author

Not exactly -- I actually don't think we need any new parameter, but should just automatically always add a subsection that is basically the contents of this:

https://github.com/mne-tools/mne-bids-pipeline/blob/61b35530b16a61753b25fa663b575d9b2f7a6ed5/mne_bids_pipeline/steps/preprocessing/_09_ptp_reject.py#L215-L221

So just a new add_html in mne.Report._add_epochs, probably inside this conditional:

if epochs._bad_dropped:

Probably need one for reject and one for flat.

@jairajmahadev
Copy link

Hello @larsoner, this is my first time trying to solve an issue. From what I understood, is this correct? and sorry if I'm totally incorrect.

if epochs._bad_dropped:
            self.add_html(
                html=f"<code>{reject}</code>",
                title=f"{kind} thresholds",
                section=title,
                replace=True,
                tags=tags,
            )
            report.add_html(
                html=f"<code>{flat}</code>",
                title=f"{kind} thresholds",
                section=title,
                replace=True,
                tags=tags,
            )

@larsoner
Copy link
Member Author

larsoner commented Mar 6, 2024

Something like that. Not sure what kind is in your example -- that might be MNE-BIDS-Pipeline specific. Maybe try implementing something and running the report tutorial and see if it works as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants