Cohort selector

Select participants based on any field.

source

CohortSelector

 CohortSelector (base_path:str='/home/ec2-user/studies/hpp/',
                 cohort:str=None, errors:str='raise', **kwargs)

Class for selecting a subset of a cohort’s data based on a query.

Args:

base_path (str, optional): Base path of the datasets. Defaults to DATASETS_PATH.
cohort (str, optional): Name of the cohort. Defaults to COHORT.
errors (str, optional): Error action. Defaults to ERROR_ACTION.
**kwargs: Additional keyword arguments.

Attributes:

cohort (str): Name of the cohort.
base_path (str): Base path of the datasets.
errors (str): Error action.
kwargs: Additional keyword arguments.
ml (MetaLoader): MetaLoader object for loading metadata and data.
cs = CohortSelector(base_path='examples/')
cs.select('15 < ahi < 20 & total_sleep_time > 12000')
ahi total_sleep_time
participant_id cohort research_stage array_index
9 10k 02_00_visit 2 18.39 23748.0
15 10k 00_00_visit 0 19.54 19230.0
30 10k 00_00_visit 0 18.52 25111.0
42 10k 00_00_visit 1 17.84 24966.0
49 10k 02_00_visit 0 17.58 21980.0
... ... ... ... ... ...
902 10k 02_00_visit 2 19.78 24162.0
914 10k 02_00_visit 2 17.54 26479.0
936 10k 00_00_visit 1 17.43 20865.0
941 10k 00_00_visit 0 17.82 17606.0
965 10k 00_00_visit 2 15.38 24390.0

78 rows × 2 columns