lina-usc / pylossless

🧠 EEG Processing pipeline that annotates continuous data
https://pylossless.readthedocs.io/en/latest/
MIT License
15 stars 8 forks source link

Implement rejection policy #115

Closed christian-oreilly closed 8 months ago

christian-oreilly commented 1 year ago

Conceptually the pipeline has the following parts:

The rejection should be based on an established "policy" which describes how the flags should be mapped to rejections. We should have an existing default policy that can be changed using a config file. We should probably create a Policy class to manage this.

E.g. of default policy could be :

scott-huberty commented 12 months ago

@christian-oreilly Based off todays dev meeting, here is a summary of my understanding, and a proposal.

We should implement a class, something like RejectionPolicy.

Proposal:

A pipeline instance can have an attribute rejection_policy, which is an instance of the RejectionPolicy class.

RejectionPolicy can have attributes for channels and ICs.

Each attribute can br a list of the flag types to exclude. When constructing the RejectionPolicy instance, if channels or ic are None (default), Then pipeline.rejection_policycan follow the historical matlab lossless use-case:

['ch_sd', 'low_r', 'bridged']for the channels attribute,

and ['muscle', 'heart', 'ch_noise','eye'] - basically all the iclabels except for brain and other - for the ics attribute.

(we can make this configurable in the config or something).

In principle we could add a configurable threshold iclabel confidence rate, (so users t don't have to accept the 30% confidence threshold), which must be met for the ic to be rejected, but thinking that about 95% of use cases probably won't change it maybe we wait until this is needed?

finally, when the user runs functions like launch_QC or apply_flags, those functions can take the rejection policy instance and use it to color code flagged ICs and flagged channels (QC dashboard) or add pipeline flags to MNE bads (apply_flags).

Is that what you had in mind?