pcntoolkit.dataio.data_factory#

Attributes#

Functions#

fetch_example_correlation_matrix(→ str)

Download an example correlation matrix and return the path to its CSV.

load_fcon1000([save_path])

Download and save fcon dataset to specified path, or load it from there

load_lifespan_big(→ pcntoolkit.dataio.norm_data.NormData)

Load the lifespan_big dataset, which is a large lifespan dataset with many sites.

load_lnm(→ pcntoolkit.dataio.norm_data.NormData)

Download and save the LNM longitudinal dataset, or load it from disk.

Module Contents#

fetch_example_correlation_matrix(save_path: str | None = None) → str#

Download an example correlation matrix and return the path to its CSV.

Parameters:

save_path (str | None) – Folder to save the matrix to. Defaults to pcntoolkit_resources/data/correlation_matrix.

Returns:

Path to the CSV, named <response_var>.csv as CorrelationMatrix.load expects.

Return type:

str

load_fcon1000(save_path: str | None = None)#

Download and save fcon dataset to specified path, or load it from there if it is already downloaded

Parameters:

save_path (str | None) – The path to save the dataset to, or load it from if it is already downloaded

Returns:

The loaded dataset as a NormData object

Return type:

NormData

load_lifespan_big(n_response_vars: int | None = None, n_largest_sites: int | None = None, n_subjects: int | None = None) → pcntoolkit.dataio.norm_data.NormData#

Load the lifespan_big dataset, which is a large lifespan dataset with many sites.

Parameters:
  • n_response_vars (int | None) – If specified, only use the first n_response_vars response variables.

  • n_largest_sites (int | None) – If specified, only keep data from the n_largest_sites largest sites.

  • n_subjects (int | None) – If specified, randomly sample n_subjects subjects.

Returns:

The loaded dataset as a NormData object.

Return type:

NormData

load_lnm(save_path: str | None = None, group: Literal['control', 'patient'] | None = None) → pcntoolkit.dataio.norm_data.NormData#

Download and save the LNM longitudinal dataset, or load it from disk.

The dataset has two visits per subject (controls and patients).

Parameters:
  • save_path (str | None) – Folder to save or load LNM_data.csv from. Defaults to pcntoolkit_resources/data.

  • group ({"control", "patient"} | None) – Keep only the subjects of this group. Defaults to None, which keeps everyone.

Returns:

Longitudinal dataset with visits="visit".

Return type:

NormData

Raises:

ValueError – If group is not "control", "patient" or None.

CORRELATION_MATRIX_RESPONSE_VAR = 'rh_G_front_middle_thickness'#
CORRELATION_MATRIX_URL = 'https://raw.githubusercontent.com/CharFraza/CPC_ML_tutorial/master/data/cmat_rh_G_front_middle_t...#