coco_pipe.io.utils¶
Helper functions for IO operations.
Attributes¶
Functions¶
|
Lazily import MNE so base IO structures stay lightweight. |
Lazily import mne-bids' |
|
Lazily import the MNE-BIDS raw reader. |
|
|
Calculate a 'badness' score for each row (NaNs + Infs + Zeros). |
|
Create a single stratification label from multiple covariates. |
|
Sample indices for each class based on size_map. |
|
Split a column into (unit, feature) using sep and reverse. |
|
|
|
Reads participants.tsv and returns dict: {sub_id: {col: val, ...}}. |
|
|
|
|
|
Detect available runs for a given subject/session/task. |
|
|
|
Module Contents¶
- coco_pipe.io.utils.logger¶
- coco_pipe.io.utils.mne = None¶
- coco_pipe.io.utils.BIDSPath = None¶
- coco_pipe.io.utils.read_raw_bids = None¶
- coco_pipe.io.utils.row_quality_score(df: pandas.DataFrame, exclude_cols: List[str] | None = None, count_zero: bool = True) pandas.Series[source]¶
Calculate a ‘badness’ score for each row (NaNs + Infs + Zeros). Lower is better.
- coco_pipe.io.utils.make_strata(df: pandas.DataFrame, covariates: List[str], n_bins: int = 5, binning: str = 'quantile') pandas.Series[source]¶
Create a single stratification label from multiple covariates. Numeric covariates are binned.
- coco_pipe.io.utils.sample_indices(df: pandas.DataFrame, target: str, size_map: Dict[Any, int], rng, replace: bool, prefer_clean: bool, exclude: List[str]) pandas.Index[source]¶
Sample indices for each class based on size_map.
- coco_pipe.io.utils.split_column(name: str, sep: str, reverse: bool) Tuple[str, str][source]¶
Split a column into (unit, feature) using sep and reverse.
- coco_pipe.io.utils.read_bids_entry(bids_path: Any, is_pre_epoched: bool, is_evoked: bool, mode: str, window_length: float | None, stride: float | None, event_id: Dict[str, int] | str | List[str] | None = None, tmin: float = -0.2, tmax: float = 0.5, baseline: Tuple[float | None, float | None] | None = None) Tuple[numpy.ndarray, numpy.ndarray, List[str], float, numpy.ndarray | None][source]¶
- coco_pipe.io.utils.load_participants_tsv(root: pathlib.Path) Dict[str, Dict[str, Any]][source]¶
Reads participants.tsv and returns dict: {sub_id: {col: val, …}}.